Skip to content

Commit

Permalink
Disallow object:remove() if the object is a player
Browse files Browse the repository at this point in the history
Rebased by Zeno- (conflict in lua_api.txt)
  • Loading branch information
kahrl authored and Zeno- committed Feb 23, 2015
1 parent cd4324e commit 38cf080
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/lua_api.txt
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/script/lua_api/l_object.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 38cf080

Please sign in to comment.