aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2015-01-07 19:08:51 +0000
committersfan5 <sfan5@live.de>2015-01-07 20:51:47 +0100
commit2504da28afcaf34235c760f13da1f0fc615aa10b (patch)
tree1998bc1ca7da9dc1e4236de98aa28d145954d353 /src/script/lua_api
parentef140eb7b0339d180cd38e3a98f5aa8abe604765 (diff)
downloadminetest-2504da28afcaf34235c760f13da1f0fc615aa10b.tar.gz
minetest-2504da28afcaf34235c760f13da1f0fc615aa10b.tar.bz2
minetest-2504da28afcaf34235c760f13da1f0fc615aa10b.zip
Fix direction property of HUD
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_object.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 7f98c9458..4286840fe 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -442,7 +442,7 @@ int ObjectRef::l_set_eye_offset(lua_State *L)
// Do it
v3f offset_first = v3f(0, 0, 0);
v3f offset_third = v3f(0, 0, 0);
-
+
if(!lua_isnil(L, 2))
offset_first = read_v3f(L, 2);
if(!lua_isnil(L, 3))
@@ -914,7 +914,11 @@ int ObjectRef::l_hud_add(lua_State *L)
elem->text = getstringfield_default(L, 2, "text", "");
elem->number = getintfield_default(L, 2, "number", 0);
elem->item = getintfield_default(L, 2, "item", 0);
- elem->dir = getintfield_default(L, 2, "dir", 0);
+ elem->dir = getintfield_default(L, 2, "direction", 0);
+
+ // Deprecated, only for compatibility's sake
+ if (elem->dir == 0)
+ elem->dir = getintfield_default(L, 2, "dir", 0);
lua_getfield(L, 2, "alignment");
elem->align = lua_istable(L, -1) ? read_v2f(L, -1) : v2f();
@@ -1076,6 +1080,10 @@ int ObjectRef::l_hud_get(lua_State *L)
lua_setfield(L, -2, "item");
lua_pushnumber(L, e->dir);
+ lua_setfield(L, -2, "direction");
+
+ // Deprecated, only for compatibility's sake
+ lua_pushnumber(L, e->dir);
lua_setfield(L, -2, "dir");
push_v3f(L, e->world_pos);
@@ -1095,7 +1103,7 @@ int ObjectRef::l_hud_set_flags(lua_State *L)
u32 flags = 0;
u32 mask = 0;
bool flag;
-
+
const EnumString *esp = es_HudBuiltinElement;
for (int i = 0; esp[i].str; i++) {
if (getboolfield(L, 2, esp[i].str, flag)) {