Module:Authority control/doc and Module:AocUtils: Difference between pages

From ZeldaMods (Breath of the Wild)
< Module:Authority control(Difference between pages)
Jump to navigation Jump to search
 
imported>Leoetlino
No edit summary
 
Line 1: Line 1:
{{High-risk|694,000+}}
local pack = {}
{{Module rating|protected}}
{{Lua sidebar}}
{{Uses Wikidata|section=Parameters}}
{{Lua|Module:Navbox|Module:ResolveEntityId|Module:No globals}}


This module contains the code of the {{T|Authority control}} template. See its documentation.
aoc_resource_prefixes = {
  "^Terrain/A/AocField",
  "^UI/StaffRollDLC/",
  "^Map/MainField/",
  "^Map/MainFieldDungeon/",
  "^Map/AocField/",
  "^Physics/StaticCompound/AocField/",
  "^Physics/StaticCompound/MainFieldDungeon/",
  "^Movie/Demo6",
  "^Game/AocField/",
  "^NavMesh/AocField/",
  "^NavMesh/MainFieldDungeon/",
  "^Physics/TeraMeshRigidBody/AocField/",
  "^Voice/.*/Stream_Demo6.*/.*\.bfstm$",
  "^System/AocVersion\.txt$",
  "^Pack/RemainsWind.pack$",
  "^Pack/RemainsElectric.pack$",
  "^Pack/RemainsWater.pack$",
  "^Pack/RemainsFire.pack$",
  "^Pack/FinalTrial.pack$",
}


{{Anchor|Parameters|Parameter names|Wikidata|Wikidata properties|Tracking categories}}
function has_aoc_dungeon_num(s)
== Parameters, Wikidata properties, and tracking categories ==
  local dungeon_num_str = string.match(s, "Dungeon(%d%d%d)")
{{#invoke:Authority control|docConfTable}}
  if dungeon_num_str == nil then
  return false
  end
  local dungeon_num = tonumber(dungeon_num_str)
  return dungeon_num > 119
end


== Additional tracking categories ==
function should_use_aoc_file_device(path)
This module also implements the following hidden tracking categories:
  for i, p in ipairs(aoc_resource_prefixes) do
    if string.find(path, p) then
      return true
    end
  end
  if string.find(path, "^Pack/") and string.find(path, "\.pack$") and has_aoc_dungeon_num(path) then
return true
  end
  if string.find(path, "^Map/CDungeon/") and has_aoc_dungeon_num(path) then
return true
  end
  if string.find(path, "^Physics/StaticCompound/") and has_aoc_dungeon_num(path) then
return true
  end
  if string.find(path, "^NavMesh/CDungeon/") and has_aoc_dungeon_num(path) then
return true
  end
  return false
end


* {{clc|Pages with red-linked authority control categories}}
function pack.get_aoc_canonical_path(frame)
* {{clc|Wikipedia articles with deprecated authority control identifiers}}
  local path = frame.args.path
* {{clc|Wikipedia articles with suppressed authority control identifiers}}
  local aoc_only = not not frame.args.aoc_only
* {{clc|Pages using authority control with parameters}}
  if not path then
  return "(unknown)"
  end
  if aoc_only or should_use_aoc_file_device(path) then
  return "Aoc/0010/" .. path
  end
  return path
end


=== Number of identifiers ===
return pack
* {{clc|AC with 14 elements}}
* {{clc|AC with 15 elements}}
* {{clc|AC with 16 elements}}
* {{clc|AC with 17 elements}}
* {{clc|AC with 18 elements}}
* {{clc|AC with 19 elements}}
* {{clc|AC with 20 elements}}
* {{clc|AC with 21 elements}}
* {{clc|AC with 22 elements}}
* {{clc|AC with 23 elements}}
* {{clc|AC with 24 elements}}
 
<includeonly>{{sandbox other||
[[Category:Modules that add a tracking category]]
[[Category:Modules using data from Wikidata]]
}}</includeonly>

Revision as of 21:32, 8 September 2018

Documentation for this module may be created at Module:AocUtils/doc

local pack = {}

aoc_resource_prefixes = {
  "^Terrain/A/AocField",
  "^UI/StaffRollDLC/",
  "^Map/MainField/",
  "^Map/MainFieldDungeon/",
  "^Map/AocField/",
  "^Physics/StaticCompound/AocField/",
  "^Physics/StaticCompound/MainFieldDungeon/",
  "^Movie/Demo6",
  "^Game/AocField/",
  "^NavMesh/AocField/",
  "^NavMesh/MainFieldDungeon/",
  "^Physics/TeraMeshRigidBody/AocField/",
  "^Voice/.*/Stream_Demo6.*/.*\.bfstm$",
  "^System/AocVersion\.txt$",
  "^Pack/RemainsWind.pack$",
  "^Pack/RemainsElectric.pack$",
  "^Pack/RemainsWater.pack$",
  "^Pack/RemainsFire.pack$",
  "^Pack/FinalTrial.pack$",
}

function has_aoc_dungeon_num(s)
  local dungeon_num_str = string.match(s, "Dungeon(%d%d%d)")
  if dungeon_num_str == nil then
  	return false
  end
  local dungeon_num = tonumber(dungeon_num_str)
  return dungeon_num > 119
end

function should_use_aoc_file_device(path)
  for i, p in ipairs(aoc_resource_prefixes) do
    if string.find(path, p) then
      return true
    end
  end
  if string.find(path, "^Pack/") and string.find(path, "\.pack$") and has_aoc_dungeon_num(path) then
	return true
  end
  if string.find(path, "^Map/CDungeon/") and has_aoc_dungeon_num(path) then
	return true
  end
  if string.find(path, "^Physics/StaticCompound/") and has_aoc_dungeon_num(path) then
	return true
  end
  if string.find(path, "^NavMesh/CDungeon/") and has_aoc_dungeon_num(path) then
	return true
  end
  return false
end

function pack.get_aoc_canonical_path(frame)
  local path = frame.args.path
  local aoc_only = not not frame.args.aoc_only
  if not path then
  	return "(unknown)"
  end
  if aoc_only or should_use_aoc_file_device(path) then
  	return "Aoc/0010/" .. path
  end
  return path
end

return pack