summaryrefslogtreecommitdiff
path: root/hud.lua
diff options
context:
space:
mode:
authorTai @ Flex <dch.tai@gmail.com>2016-11-26 07:20:23 +0000
committerShadowNinja <shadowninja@minetest.net>2016-12-19 16:36:37 +0000
commit6080ff065ea89e899f356ba723ea2467b6d32ccb (patch)
tree7cae444532994bafbb711f18e6b3af48fa3c4bcd /hud.lua
parent23f81f6278af2269bb11f41ec424936b05c2655f (diff)
Add API for adding areas to HUD
Diffstat (limited to 'hud.lua')
-rw-r--r--hud.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/hud.lua b/hud.lua
index 4908b92..0b7931f 100644
--- a/hud.lua
+++ b/hud.lua
@@ -7,11 +7,21 @@ minetest.register_globalstep(function(dtime)
local name = player:get_player_name()
local pos = vector.round(player:getpos())
local areaStrings = {}
+
for id, area in pairs(areas:getAreasAtPos(pos)) do
table.insert(areaStrings, ("%s [%u] (%s%s)")
:format(area.name, id, area.owner,
area.open and ":open" or ""))
end
+
+ for i, area in pairs(areas:getExternalHudEntries(pos)) do
+ local str = ""
+ if area.name then str = area.name .. " " end
+ if area.id then str = str.."["..area.id.."] " end
+ if area.owner then str = str.."("..area.owner..")" end
+ table.insert(areaStrings, str)
+ end
+
local areaString = "Areas:"
if #areaStrings > 0 then
areaString = areaString.."\n"..