aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-06-02 20:54:02 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-06-02 20:54:02 +0200
commit827b9f8d7054158b058679999d77c1345162a293 (patch)
treeb03741002579b03d3657c1e496e73993e4070fa9 /src/script/lua_api/l_object.cpp
parent3ff3103e98b350712543f926c429ab339700e252 (diff)
parent9fc018ded10225589d2559d24a5db739e891fb31 (diff)
downloaddragonfireclient-827b9f8d7054158b058679999d77c1345162a293.tar.xz
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index 39b19364e..37ba1521a 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -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}
};