Module:Sandbox/GauTest/Township: Difference between revisions

Statue special case
(Reset for STATUE fix)
(Statue special case)
Line 303: Line 303:
-- Gets a Township building by ID, e.g. melvorF:Hunters_Cabin
-- Gets a Township building by ID, e.g. melvorF:Hunters_Cabin
function p._GetBuildingByID(id)
function p._GetBuildingByID(id)
return GameData.getEntityByID(Township.buildings, id)
-- Check for the special statue case
if id == 'melvorF:Statues' then
local building = Shared.clone(GameData.getEntityByID(Township.buildings, id))
building.name = 'Statue of Worship'
return building
else
return GameData.getEntityByID(Township.buildings, id)
end
end
end


-- Gets a Township building by name, e.g. Hunters Cabin
-- Gets a Township building by name, e.g. Hunters Cabin
function p._GetBuildingByName(name)
function p._GetBuildingByName(name)
return GameData.getEntityByName(Township.buildings, name)
-- Check for the special statue case
local STATUE_OF = 'Statue of '
if strsub(name, 1, strlen(STATUE_OF)) == STATUE_OF then
local building = Shared.clone(GameData.getEntityByName(Township.buildings, 'STATUE_NAME'))
building.name = name
return building
else
return GameData.getEntityByName(Township.buildings, name)
end
end
end


572

edits