aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorsapier <sapier at gmx dot net>2017-01-14 19:32:10 +0100
committersapier <sapier at gmx dot net>2017-01-21 17:01:02 +0100
commitc57b4ff9b592617539aa978374c13cdd5f1603a6 (patch)
tree26174f5add5e5f1a681323459ea27e14bf316f32 /src/script
parent72535d33281ed4c863013590e5fd032c39f0b781 (diff)
downloadminetest-c57b4ff9b592617539aa978374c13cdd5f1603a6.tar.gz
minetest-c57b4ff9b592617539aa978374c13cdd5f1603a6.tar.bz2
minetest-c57b4ff9b592617539aa978374c13cdd5f1603a6.zip
Add Entity get_texture_mod() to Lua API
Send texture modifier to clients connecting later too
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_object.cpp13
-rw-r--r--src/script/lua_api/l_object.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index f579c0b86..1fa3663ca 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -900,6 +900,19 @@ int ObjectRef::l_set_texture_mod(lua_State *L)
return 0;
}
+// get_texture_mod(self)
+int ObjectRef::l_get_texture_mod(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ ObjectRef *ref = checkobject(L, 1);
+ LuaEntitySAO *co = getluaobject(ref);
+ if (co == NULL) return 0;
+ // Do it
+ std::string mod = co->getTextureMod();
+ lua_pushstring(L, mod.c_str());
+ return 1;
+}
+
// set_sprite(self, p={x=0,y=0}, num_frames=1, framelength=0.2,
// select_horiz_by_yawpitch=false)
int ObjectRef::l_set_sprite(lua_State *L)
diff --git a/src/script/lua_api/l_object.h b/src/script/lua_api/l_object.h
index 06b1bb79b..96d0abae8 100644
--- a/src/script/lua_api/l_object.h
+++ b/src/script/lua_api/l_object.h
@@ -164,6 +164,9 @@ private:
// set_texture_mod(self, mod)
static int l_set_texture_mod(lua_State *L);
+ // l_get_texture_mod(self)
+ static int l_get_texture_mod(lua_State *L);
+
// set_sprite(self, p={x=0,y=0}, num_frames=1, framelength=0.2,
// select_horiz_by_yawpitch=false)
static int l_set_sprite(lua_State *L);