Module:Sandbox/Skills/Cartography: Difference between revisions

Adding get POI by XY coords function
No edit summary
Tag: Manual revert
(Adding get POI by XY coords function)
Line 12: Line 12:
for i, POI in pairs(SkillData.Cartography.worldMaps[1].pointsOfInterest) do
for i, POI in pairs(SkillData.Cartography.worldMaps[1].pointsOfInterest) do
if POI.id == id then
if POI.id == id then
return POI
end
end
return nil
end
function p.getPointOfInterestByXY(X, Y)
local hex = p.getHexByXY(X, Y)
if hex == nil then
return nil
end
for i, POI in pairs(SkillData.Cartography.worldMaps[1].pointsOfInterest) do
if (POI.coords.q == hex.coordinates.q and
    POI.coords.r == hex.coordinates.r) then
return POI
return POI
end
end
432

edits