diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-01-15 20:10:24 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-01-15 20:10:24 -0500 |
commit | ed7f57bf2f21af64039f07ac547ff676167b0ede (patch) | |
tree | eeb2fc52fd96b06979d45ea70fbd151fb6a5404e /legacy.lua | |
parent | f7f4c2ddb567ef01bad299ac0c093300909d950c (diff) |
Add IDs to HUD and areas:getAreasAtPos(pos)
Diffstat (limited to 'legacy.lua')
-rw-r--r-- | legacy.lua | 29 |
1 files changed, 7 insertions, 22 deletions
@@ -77,13 +77,8 @@ end -- Returns the name of the first player that owns an area function areas.getNodeOwnerName(pos) - for _, area in pairs(areas.areas) do - p1, p2 = area.pos1, area.pos2 - if pos.x >= p1.x and pos.x <= p2.x and - pos.y >= p1.y and pos.y <= p2.y and - pos.z >= p1.z and pos.z <= p2.z then - return area.owner - end + for id, area in pairs(areas:getAreasAtPos(pos)) do + return area.owner end return false end @@ -93,14 +88,9 @@ function areas.isNodeOwner(pos, name) if minetest.check_player_privs(name, {areas=true}) then return true end - for _, area in pairs(areas.areas) do - p1, p2 = area.pos1, area.pos2 - if pos.x >= p1.x and pos.x <= p2.x and - pos.y >= p1.y and pos.y <= p2.y and - pos.z >= p1.z and pos.z <= p2.z then - if name == area.owner then - return true - end + for id, area in pairs(areas:getAreasAtPos(pos)) do + if name == area.owner then + return true end end return false @@ -108,13 +98,8 @@ end -- Checks if an area has an owner function areas.hasOwner(pos) - for _, area in pairs(areas.areas) do - p1, p2 = area.pos1, area.pos2 - if pos.x >= p1.x and pos.x <= p2.x and - pos.y >= p1.y and pos.y <= p2.y and - pos.z >= p1.z and pos.z <= p2.z then - return true - end + for id, area in pairs(areas:getAreasAtPos(pos)) do + return true end return false end |