1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add hotbar Lua HUD element and replace hardcoded hotbar

This commit is contained in:
cx384 2024-01-29 16:43:37 +01:00
parent efd7792add
commit 52376fd87a
11 changed files with 165 additions and 31 deletions

View file

@ -42,6 +42,7 @@ core.features = {
node_interaction_actor = true,
moveresult_new_pos = true,
override_item_remove_fields = true,
hotbar_hud_element = true,
}
function core.has_feature(arg)

View file

@ -259,3 +259,18 @@ register_builtin_hud_element("minimap", {
core.get_player_information(player:get_player_name()).protocol_version >= 44
end,
})
--- Hotbar
register_builtin_hud_element("hotbar", {
elem_def = {
type = "hotbar",
position = {x = 0.5, y = 1},
direction = 0,
alignment = {x = 0, y = -1},
offset = {x = 0, y = -4}, -- Extra padding below.
},
show_elem = function(player, flags)
return flags.hotbar
end,
})