mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
parent
da71e86633
commit
f195db2d14
5 changed files with 27 additions and 3 deletions
|
@ -2323,6 +2323,21 @@ int ObjectRef::l_get_lighting(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// respawn(self)
|
||||
int ObjectRef::l_respawn(lua_State *L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
ObjectRef *ref = checkobject(L, 1);
|
||||
RemotePlayer *player = getplayer(ref);
|
||||
if (player == nullptr)
|
||||
return 0;
|
||||
|
||||
getServer(L)->RespawnPlayer(player->getPeerId());
|
||||
lua_pushboolean(L, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
ObjectRef::ObjectRef(ServerActiveObject *object):
|
||||
m_object(object)
|
||||
{}
|
||||
|
@ -2478,5 +2493,7 @@ luaL_Reg ObjectRef::methods[] = {
|
|||
luamethod(ObjectRef, set_minimap_modes),
|
||||
luamethod(ObjectRef, set_lighting),
|
||||
luamethod(ObjectRef, get_lighting),
|
||||
luamethod(ObjectRef, respawn),
|
||||
|
||||
{0,0}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue