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

@ -2306,7 +2306,10 @@ void read_hud_element(lua_State *L, HudElement *elem)
elem->dir = getintfield_default(L, 2, "dir", 0);
lua_getfield(L, 2, "alignment");
elem->align = lua_istable(L, -1) ? read_v2f(L, -1) : v2f();
if (lua_istable(L, -1))
elem->align = read_v2f(L, -1);
else
elem->align = elem->type == HUD_ELEM_INVENTORY ? v2f(1.0f, 1.0f) : v2f();
lua_pop(L, 1);
lua_getfield(L, 2, "offset");