diff options
author | Diego MartÃnez <kaeza@users.sf.net> | 2013-04-22 20:47:59 -0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2013-04-23 09:34:11 +0300 |
commit | 9894167bbf516c40bf2b8577179ff8f13b8b54e2 (patch) | |
tree | 245d10d35d9adbe9883394cfa7b6c4f8a5950486 /src/scriptapi_object.cpp | |
parent | 7c37b1891adcddc0e7d11e5faafddaa554443318 (diff) | |
download | minetest-9894167bbf516c40bf2b8577179ff8f13b8b54e2.tar.gz minetest-9894167bbf516c40bf2b8577179ff8f13b8b54e2.tar.bz2 minetest-9894167bbf516c40bf2b8577179ff8f13b8b54e2.zip |
Added offset support for HUD items
Diffstat (limited to 'src/scriptapi_object.cpp')
-rw-r--r-- | src/scriptapi_object.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/scriptapi_object.cpp b/src/scriptapi_object.cpp index c07f6565d..6669ad871 100644 --- a/src/scriptapi_object.cpp +++ b/src/scriptapi_object.cpp @@ -48,6 +48,7 @@ struct EnumString es_HudElementStat[] = {HUD_STAT_ITEM, "item"}, {HUD_STAT_DIR, "direction"}, {HUD_STAT_ALIGN, "alignment"}, + {HUD_STAT_OFFSET, "offset"}, {0, NULL}, }; @@ -756,6 +757,10 @@ int ObjectRef::l_hud_add(lua_State *L) elem->align = lua_istable(L, -1) ? read_v2f(L, -1) : v2f(); lua_pop(L, 1); + lua_getfield(L, 2, "offset"); + elem->offset = lua_istable(L, -1) ? read_v2f(L, -1) : v2f(); + lua_pop(L, 1); + u32 id = get_server(L)->hudAdd(player, elem); if (id == (u32)-1) { delete elem; @@ -841,6 +846,9 @@ int ObjectRef::l_hud_change(lua_State *L) case HUD_STAT_ALIGN: e->align = read_v2f(L, 4); value = &e->align; + case HUD_STAT_OFFSET: + e->offset = read_v2f(L, 4); + value = &e->offset; } get_server(L)->hudChange(player, id, stat, value); |