diff options
author | Wuzzy <wuzzy2@mail.ru> | 2020-05-11 21:40:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-11 21:40:45 +0200 |
commit | 6e1372bd894d955300c40d69e5c882e9cc7d7523 (patch) | |
tree | 6273a8c2ddfec5efbc5b69fa49b088368dd78c15 /src/script | |
parent | 88bb8e57e6780130df1877e7a89bb56c9561ea6a (diff) | |
download | minetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.tar.gz minetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.tar.bz2 minetest-6e1372bd894d955300c40d69e5c882e9cc7d7523.zip |
Add support for statbar “off state” icons (#9462)
This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles.
Add "off state" textures to the builtin statbars.
Co-authored-by: SmallJoker <mk939@ymail.com>
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/common/c_content.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index dac828316..540b7222f 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1871,6 +1871,7 @@ void read_hud_element(lua_State *L, HudElement *elem) elem->dir = getintfield_default(L, 2, "direction", 0); elem->z_index = MYMAX(S16_MIN, MYMIN(S16_MAX, getintfield_default(L, 2, "z_index", 0))); + elem->text2 = getstringfield_default(L, 2, "text2", ""); // Deprecated, only for compatibility's sake if (elem->dir == 0) @@ -1939,6 +1940,9 @@ void push_hud_element(lua_State *L, HudElement *elem) lua_pushnumber(L, elem->z_index); lua_setfield(L, -2, "z_index"); + + lua_pushstring(L, elem->text2.c_str()); + lua_setfield(L, -2, "text2"); } HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) @@ -2000,6 +2004,10 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) elem->z_index = MYMAX(S16_MIN, MYMIN(S16_MAX, luaL_checknumber(L, 4))); *value = &elem->z_index; break; + case HUD_STAT_TEXT2: + elem->text2 = luaL_checkstring(L, 4); + *value = &elem->text2; + break; } return stat; } |