1
0
鏡像自 https://github.com/luanti-org/luanti.git 已同步 2025-12-16 03:55:24 +01:00

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

Rebased by Zeno- (conflict in lua_api.txt)
此提交包含在:
Kahrl
2015-02-23 16:48:51 +10:00
提交者 Craig Robbins
父節點 cd4324e5a8
當前提交 38cf080a9c
共有 2 個檔案被更改,包括 2 行新增0 行删除

查看文件

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