From Arms of God Wiki
Renders Codex records from Data:Codex.json on index and detail pages.
infobox— infobox for one record (used via Template:Codex infobox)index— sortable index table on Codexbody/crossRefs— per-section renderers invoked from detail pages
Bot-published: the module and its Data: page are regenerated on re-publish. Restyle via the per-section templates rather than editing page wikitext.
-- Module:Codex — per-category shim + lore lookup (Arms of God).
-- Category rendering binds to Module:Core like every other shim. The extra
-- `lore` entry point powers the '== Lore ==' section on weapon / enemy /
-- character / codex pages: it finds the matching codex record at render
-- time, so a dev edit to Data:Codex.json updates every entity page on
-- purge.
--
-- {{#invoke:Codex|lore|<id-or-name>}} — cross-category match
-- {{#invoke:Codex|lore|<id-or-name>|<Category>}} — category-scoped; falls
-- back to the entity's own `description` when no codex entry matches.
local Core = require('Module:Core')
local p = {}
local CAT = 'Codex'
function p.infobox(frame) return Core.infoboxEntry(CAT, frame) end
function p.body(frame) return Core.bodyEntry(CAT, frame) end
function p.crossRefs(frame)
return require('Module:CrossRef').entry(CAT, frame)
end
function p.index(frame) return Core.indexEntry(CAT, frame) end
function p.render(frame) return Core.renderEntry(CAT, frame) end
-- Codex entry type expected for an entity category (nil = any type).
local TYPE_FOR_CAT = {Weapons = 'Weapons', Enemies = 'Enemies'}
function p.lore(frame)
local key = (frame.args[1] or ''):gsub('^%s+', ''):gsub('%s+$', '')
if key == '' then return '' end
local catHint = Core.resolveCategory(frame.args[2] or '')
local entity = nil
if catHint then
entity = Core.byId(catHint)[key]
end
if not entity then
local foundCat, rec = Core.find(key)
if rec then
entity = rec
catHint = catHint or foundCat
end
end
local name = (entity and entity.name) or key
if catHint == 'Codex' then
-- standalone codex page: its own prose
return (entity and entity.description) or ''
end
local cx = Core.codexFor(name, TYPE_FOR_CAT[catHint])
if cx and cx.description and cx.description ~= '' then
return cx.description
end
-- no codex entry: the entity's own description (heroes, unmatched enemies)
return (entity and entity.description) or ''
end
return p