Skip to content
Snippets Groups Projects
Commit 38cf080a authored by Kahrl's avatar Kahrl Committed by Craig Robbins
Browse files

Disallow object:remove() if the object is a player

Rebased by Zeno- (conflict in lua_api.txt)
parent cd4324e5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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="<<co->getId()<<std::endl;
co->m_removed = true;
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment