Module:GauTest/Township: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 478: Line 478:
-- Gets the modifiers for the specified entity
-- Gets the modifiers for the specified entity
function p.GetModifiers(name, type)
function p.GetModifiers(name, type)
local function findID(_table, name)
for key, value in pairs(_table) do
if _table[key].name == name then
return key
end
end
error('name not found within _table')
end
if type == 'building' then
if type == 'building' then
return p._GetBuildingModifiers(p._GetBuildingByName(name))
return p._GetBuildingModifiers(p._GetBuildingByName(name))
end
end
if type == 'resource' then
if type == 'resource' then
return p._GetResourceModifiers(name)
return p._GetResourceModifiers(p._GetResourceByName(name).id)
end
end
if type == 'stat' then
if type == 'stat' then
return p._GetStatModifiers(name)
for key, value in pairs(p.stats) do
if _table[key].name == name then
return p._GetStatModifiers(key)
end
end
end
end
if type == 'biome' then
if type == 'biome' then
return p._GetBiomeModifiers(name)
return p._GetBiomeModifiers(GameData.GetEntityByName(Township.biomes, name).id)
end
end
end
end
572

edits