aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorRealBadAngel <maciej.kasatkin@yahoo.com>2014-01-26 21:31:59 +0100
committerRealBadAngel <maciej.kasatkin@yahoo.com>2014-01-26 21:31:59 +0100
commit21f1bec72433748e220d19e97a846df83340518e (patch)
treea4b45526ca5f21a63a5075de17b1911c662eb656 /src/script
parent3f0ee5d6800302f0ad7e56f0aa4ddddddae86823 (diff)
downloadminetest-21f1bec72433748e220d19e97a846df83340518e.tar.gz
minetest-21f1bec72433748e220d19e97a846df83340518e.tar.bz2
minetest-21f1bec72433748e220d19e97a846df83340518e.zip
New HUD element - waypoint.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_object.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 6d4ce54fc..6c6415a09 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -38,6 +38,7 @@ struct EnumString es_HudElementType[] =
{HUD_ELEM_TEXT, "text"},
{HUD_ELEM_STATBAR, "statbar"},
{HUD_ELEM_INVENTORY, "inventory"},
+ {HUD_ELEM_WAYPOINT, "waypoint"},
{0, NULL},
};
@@ -53,6 +54,7 @@ struct EnumString es_HudElementStat[] =
{HUD_STAT_DIR, "direction"},
{HUD_STAT_ALIGN, "alignment"},
{HUD_STAT_OFFSET, "offset"},
+ {HUD_STAT_WORLD_POS, "world_pos"},
{0, NULL},
};
@@ -862,6 +864,10 @@ int ObjectRef::l_hud_add(lua_State *L)
elem->offset = lua_istable(L, -1) ? read_v2f(L, -1) : v2f();
lua_pop(L, 1);
+ lua_getfield(L, 2, "world_pos");
+ elem->world_pos = lua_istable(L, -1) ? read_v3f(L, -1) : v3f();
+ lua_pop(L, 1);
+
u32 id = getServer(L)->hudAdd(player, elem);
if (id == (u32)-1) {
delete elem;
@@ -953,6 +959,10 @@ int ObjectRef::l_hud_change(lua_State *L)
e->offset = read_v2f(L, 4);
value = &e->offset;
break;
+ case HUD_STAT_WORLD_POS:
+ e->world_pos = read_v3f(L, 4);
+ value = &e->world_pos;
+ break;
}
getServer(L)->hudChange(player, id, stat, value);
@@ -1003,6 +1013,9 @@ int ObjectRef::l_hud_get(lua_State *L)
lua_pushnumber(L, e->dir);
lua_setfield(L, -2, "dir");
+ push_v3f(L, e->world_pos);
+ lua_setfield(L, -2, "world_pos");
+
return 1;
}