diff options
author | BlockMen <nmuelll@web.de> | 2015-11-20 23:46:33 +0100 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2015-12-15 23:32:19 +0100 |
commit | 9eee3c3f465c071bb9908749cf48be3c131a1bdf (patch) | |
tree | 916b11e605c29b789db01d0c775dc0bc7c4c8983 /src/script/common | |
parent | 19f73e4efc14622b4d020c9d373176cd7801e37f (diff) | |
download | minetest-9eee3c3f465c071bb9908749cf48be3c131a1bdf.tar.gz minetest-9eee3c3f465c071bb9908749cf48be3c131a1bdf.tar.bz2 minetest-9eee3c3f465c071bb9908749cf48be3c131a1bdf.zip |
Add option to give every object a nametag
or change the nametag text of players
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_content.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index fe429b5d4..4d277ec59 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -201,6 +201,14 @@ void read_object_properties(lua_State *L, int index, } lua_pop(L, 1); getboolfield(L, -1, "backface_culling", prop->backface_culling); + getstringfield(L, -1, "nametag", prop->nametag); + lua_getfield(L, -1, "nametag_color"); + if (!lua_isnil(L, -1)) { + video::SColor color = prop->nametag_color; + if (read_color(L, -1, &color)) + prop->nametag_color = color; + } + lua_pop(L, 1); } /******************************************************************************/ @@ -261,6 +269,11 @@ void push_object_properties(lua_State *L, ObjectProperties *prop) lua_setfield(L, -2, "automatic_face_movement_dir"); lua_pushboolean(L, prop->backface_culling); lua_setfield(L, -2, "backface_culling"); + lua_pushlstring(L, prop->nametag.c_str(), prop->nametag.size()); + lua_setfield(L, -2, "nametag"); + lua_newtable(L); + push_ARGB8(L, prop->nametag_color); + lua_setfield(L, -2, "nametag_color"); } /******************************************************************************/ |