diff options
author | Tai @ Flex <dch.tai@gmail.com> | 2016-11-26 07:20:23 +0000 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2016-12-19 16:36:37 +0000 |
commit | 6080ff065ea89e899f356ba723ea2467b6d32ccb (patch) | |
tree | 7cae444532994bafbb711f18e6b3af48fa3c4bcd /hud.lua | |
parent | 23f81f6278af2269bb11f41ec424936b05c2655f (diff) |
Add API for adding areas to HUD
Diffstat (limited to 'hud.lua')
-rw-r--r-- | hud.lua | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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".. |