1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add Entity get_texture_mod() to Lua API

Send texture modifier to clients connecting later too
This commit is contained in:
sapier 2017-01-14 19:32:10 +01:00
parent 72535d3328
commit c57b4ff9b5
7 changed files with 53 additions and 8 deletions

View file

@ -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)