From: Kahrl Date: Mon, 23 Feb 2015 06:48:51 +0000 (+1000) Subject: Disallow object:remove() if the object is a player X-Git-Tag: 0.4.13~569 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=38cf080a9c2a1e5b9ad41cf62d2eacdc92133d16;p=oweals%2Fminetest.git Disallow object:remove() if the object is a player Rebased by Zeno- (conflict in lua_api.txt) --- diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 1e25fb812..69a3a6828 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2294,6 +2294,7 @@ This is basically a reference to a C++ `ServerActiveObject` #### Methods * `remove()`: remove object (after returning from Lua) + * Note: Doesn't work on players, use minetest.kick_player instead * `getpos()`: returns `{x=num, y=num, z=num}` * `setpos(pos)`; `pos`=`{x=num, y=num, z=num}` * `moveto(pos, continuous=false)`: interpolated move diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index e048d072f..73f6e93b3 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -131,6 +131,7 @@ int ObjectRef::l_remove(lua_State *L) ObjectRef *ref = checkobject(L, 1); ServerActiveObject *co = getobject(ref); if(co == NULL) return 0; + if(co->getType() == ACTIVEOBJECT_TYPE_PLAYER) return 0; verbosestream<<"ObjectRef::l_remove(): id="<getId()<m_removed = true; return 0;