Add ClientObjectRef:remove

This commit is contained in:
Elias Fleckenstein 2021-03-26 13:15:10 +01:00
parent 22f73e9f27
commit e0b4859e7c
4 changed files with 32 additions and 19 deletions

View File

@ -1400,6 +1400,7 @@ This is basically a reference to a C++ `GenericCAO`.
* `get_max_hp()`: returns the maximum heath
* `punch()`: punches the object
* `rightclick()`: rightclicks the object
* `remove()`: removes the object permanently
### `Raycast`

View File

@ -173,6 +173,15 @@ int ClientObjectRef::l_rightclick(lua_State *L)
return 0;
}
int ClientObjectRef::l_remove(lua_State *L)
{
ClientObjectRef *ref = checkobject(L, 1);
ClientActiveObject *cao = get_cao(ref);
getClient(L)->getEnv().removeActiveObject(cao->getId());
return 0;
}
ClientObjectRef::ClientObjectRef(ClientActiveObject *object) : m_object(object)
{
}

View File

@ -89,4 +89,7 @@ private:
// rightclick(self)
static int l_rightclick(lua_State *L);
// remove(self)
static int l_remove(lua_State *L);
};