572
edits
No edit summary |
No edit summary |
||
Line 311: | Line 311: | ||
-- 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) | ||
GameData.getEntityByID(Township.buildings, id) | return GameData.getEntityByID(Township.buildings, id) | ||
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) | ||
GameData.getEntityByName(Township.buildings, | return GameData.getEntityByName(Township.buildings, id) | ||
end | end | ||
Line 327: | Line 327: | ||
-- Gets a building and prepares all the relevant stats for the building | -- Gets a building and prepares all the relevant stats for the building | ||
function p.GetBuildingTable(frame) | function p.GetBuildingTable(frame) | ||
local name = frame.args[1] or frame | local name = frame.args ~= nil and frame.args[1] or frame | ||
local building = p._GetBuildingByName(name) | local building = p._GetBuildingByName(name) | ||
local resources = p._ResourcesData() | local resources = p._ResourcesData() | ||
Line 344: | Line 343: | ||
end | end | ||
p.GameData = GameData | |||
p.Township = Township | |||
return p | return p |
edits