aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorLars Müller <34514239+appgurueu@users.noreply.github.com>2022-03-05 22:16:17 +0100
committerGitHub <noreply@github.com>2022-03-05 22:16:17 +0100
commitb9e886726c68613d39459acc8cb1a2f663b0362c (patch)
tree64fa90ee6201c209d28d0f7697728f4c1852f8e1 /src/script/lua_api/l_object.cpp
parent44fc888bd64cc00836b0fea0666aa763b2565513 (diff)
downloadminetest-b9e886726c68613d39459acc8cb1a2f663b0362c.tar.gz
minetest-b9e886726c68613d39459acc8cb1a2f663b0362c.tar.bz2
minetest-b9e886726c68613d39459acc8cb1a2f663b0362c.zip
Readd basic_debug as a HUD flag (#12020)
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index ba86fbc48..1ed6b0d5c 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1617,20 +1617,11 @@ int ObjectRef::l_hud_get_flags(lua_State *L)
return 0;
lua_newtable(L);
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_HOTBAR_VISIBLE);
- lua_setfield(L, -2, "hotbar");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_HEALTHBAR_VISIBLE);
- lua_setfield(L, -2, "healthbar");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE);
- lua_setfield(L, -2, "crosshair");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE);
- lua_setfield(L, -2, "wielditem");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_BREATHBAR_VISIBLE);
- lua_setfield(L, -2, "breathbar");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE);
- lua_setfield(L, -2, "minimap");
- lua_pushboolean(L, player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE);
- lua_setfield(L, -2, "minimap_radar");
+ const EnumString *esp = es_HudBuiltinElement;
+ for (int i = 0; esp[i].str; i++) {
+ lua_pushboolean(L, (player->hud_flags & esp[i].num) != 0);
+ lua_setfield(L, -2, esp[i].str);
+ }
return 1;
}