Update HUD
parent
5d6efc741a
commit
cf71c5d87d
19
hud.lua
19
hud.lua
|
@ -5,14 +5,13 @@ local S = areas.S
|
||||||
areas.hud = {}
|
areas.hud = {}
|
||||||
|
|
||||||
local vround = vector.round
|
local vround = vector.round
|
||||||
local tconcat = table.concat
|
local tconcat, tinsert = table.concat, table.insert
|
||||||
|
|
||||||
local function update_hud(player, name, pos)
|
local function update_hud(player, name, pos)
|
||||||
local areaStrings = {
|
local areaStrings = {}
|
||||||
S("Areas:")
|
local getAreasAtPos = areas:getAreasAtPos(pos)
|
||||||
}
|
|
||||||
|
|
||||||
for id, area in pairs(areas:getAreasAtPos(pos)) do
|
for id, area in pairs(getAreasAtPos) do
|
||||||
areaStrings[#areaStrings + 1] = ("%s [%u] (%s)%s%s")
|
areaStrings[#areaStrings + 1] = ("%s [%u] (%s)%s%s")
|
||||||
:format(area.name, id, area.owner,
|
:format(area.name, id, area.owner,
|
||||||
area.open and (" [" .. S("Open") .. "]") or "",
|
area.open and (" [" .. S("Open") .. "]") or "",
|
||||||
|
@ -27,9 +26,15 @@ local function update_hud(player, name, pos)
|
||||||
areaStrings[#areaStrings + 1] = str
|
areaStrings[#areaStrings + 1] = str
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "Areas:" text has index 1
|
if areas.invite_code then
|
||||||
local areaString = #areaStrings > 1 and tconcat(areaStrings, "\n") or ""
|
areaStrings[#areaStrings + 1] = areas.invite_code
|
||||||
|
end
|
||||||
|
|
||||||
|
if next(getAreasAtPos) then
|
||||||
|
tinsert(areaStrings, 1, S("Areas:"))
|
||||||
|
end
|
||||||
|
|
||||||
|
local areaString = tconcat(areaStrings, "\n")
|
||||||
local hud = areas.hud[name]
|
local hud = areas.hud[name]
|
||||||
if not hud then
|
if not hud then
|
||||||
hud = {}
|
hud = {}
|
||||||
|
|
Loading…
Reference in New Issue