From 6080ff065ea89e899f356ba723ea2467b6d32ccb Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Sat, 26 Nov 2016 07:20:23 +0000 Subject: Add API for adding areas to HUD --- hud.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'hud.lua') 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".. -- cgit v1.2.3