From 21f1bec72433748e220d19e97a846df83340518e Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 26 Jan 2014 21:31:59 +0100 Subject: New HUD element - waypoint. --- src/script/lua_api/l_object.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/script/lua_api/l_object.cpp') 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; } -- cgit v1.2.3