This commit is contained in:
Xeno333 2024-11-19 12:40:09 -06:00
parent 21fbf39b2e
commit 51c3eedd73
2 changed files with 14 additions and 23 deletions

View File

@ -1,4 +1,5 @@
local player_huds = {} -- Needs moved to API for player tabless #fixme
core_1042.player_huds = {} -- Needs moved to API for player tabless #fixme
local player_huds = core_1042.player_huds
local aux1_cooldown = {}
@ -71,6 +72,9 @@ end)
core.register_on_joinplayer(function(player, last_join)
local name = player:get_player_name()
player_huds[name] = {}
aux1_cooldown[name] = 0
player:set_properties({
visual = "mesh",
mesh = "player.gltf",
@ -108,7 +112,7 @@ core.register_on_joinplayer(function(player, last_join)
minimap_radar = false,
crosshair = false,
basic_debug = false,
--hotbar = false
hotbar = false -- We use custom one
}
)
@ -232,9 +236,8 @@ core.register_on_joinplayer(function(player, last_join)
hotbar.direction = 2
hotbar.position = {x=0.05, y=0.5}
end
-- #FIXME
core.hud_replace_builtin("hotbar", hotbar)
player_huds[name].hotbar = player:hud_add(hotbar)
player:hud_add({
@ -254,19 +257,10 @@ core.register_on_joinplayer(function(player, last_join)
style = 3
})
--[[player:hud_add({
type = "hotbar",
name = "hotbar",
direction = 2,
position = {x=0.05, y=0.5}
})]]
player:hud_set_hotbar_itemcount(10)
player:hud_set_hotbar_image("1042_plain_node.png^[colorize:#00ffff:64")
player:hud_set_hotbar_selected_image("1042_plain_node.png^[colorize:#00ffff:128")
player_huds[name] = {}
aux1_cooldown[name] = 0
end)

View File

@ -191,19 +191,16 @@ core.register_on_player_receive_fields(function(player, form, fields)
elseif fields.setting_hud_at_bottom then
core_1042.set("playersetting_"..player:get_player_name().."_hud_at_bottom", fields.setting_hud_at_bottom)
local hotbar = {
type = "hotbar",
name = "hotbar",
text = "main",
}
local id = core_1042.player_huds[player:get_player_name()].hotbar
if fields.setting_hud_at_bottom == "true" then
hotbar.direction = 0
hotbar.position = {x=0.5, y=0.95}
player:hud_change(id, "direction", 0)
player:hud_change(id, "position", {x=0.5, y=0.95})
else
hotbar.direction = 2
hotbar.position = {x=0.05, y=0.5}
player:hud_change(id, "direction", 2)
player:hud_change(id, "position", {x=0.05, y=0.5})
end
core.hud_replace_builtin("hotbar", hotbar)
player:set_inventory_formspec(core_1042.make_inv_formspec(player))