Move stuff to HUD

This commit is contained in:
Jean-Patrick Guerrero
2021-11-26 04:58:57 +01:00
parent 54ba95ac80
commit b3f1cf255d
3 changed files with 23 additions and 21 deletions

View File

@ -20,7 +20,7 @@ local trash = create_inventory("i3_trash", {
trash:set_size("main", 1)
local function init_inventories(player)
local function init_detached(player)
local name = player:get_player_name()
local output_rcp = create_inventory(fmt("i3_output_rcp_%s", name), {}, name)
@ -30,4 +30,4 @@ local function init_inventories(player)
output_usg:set_size("main", 1)
end
return init_inventories
return init_detached

View File

@ -1,4 +1,5 @@
local get_player_by_name = i3.get("get_player_by_name")
local get_player_by_name, str_to_pos, add_hud_waypoint =
i3.get("get_player_by_name", "str_to_pos", "add_hud_waypoint")
local function init_hud(player)
local name = player:get_player_name()
@ -98,4 +99,20 @@ core.register_globalstep(function()
end
end)
return init_hud
local function init_waypoints(player)
local name = player:get_player_name()
local data = i3.data[name]
data.waypoints = data.waypoints or {}
for _, v in ipairs(data.waypoints) do
if not v.hide then
local id = add_hud_waypoint(player, v.name, str_to_pos(v.pos), v.color)
v.id = id
end
end
end
return function(player)
init_hud(player)
init_waypoints(player)
end