From 2ae77b64410ffbc4cf46f951381406548ae7213c Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:17:59 +0100 Subject: [PATCH] feat(LuaEngine/GameObjectMethods): ddd SetRespawnDelay (#239) --- src/LuaEngine/LuaFunctions.cpp | 1 + src/LuaEngine/methods/GameObjectMethods.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 7aaded4..46aaf72 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -855,6 +855,7 @@ ElunaRegister GameObjectMethods[] = { "SetGoState", &LuaGameObject::SetGoState }, { "SetLootState", &LuaGameObject::SetLootState }, { "SetRespawnTime", &LuaGameObject::SetRespawnTime }, + { "SetRespawnDelay", &LuaGameObject::SetRespawnDelay }, // Boolean { "IsTransport", &LuaGameObject::IsTransport }, diff --git a/src/LuaEngine/methods/GameObjectMethods.h b/src/LuaEngine/methods/GameObjectMethods.h index 9a4ecaf..f55e1ae 100644 --- a/src/LuaEngine/methods/GameObjectMethods.h +++ b/src/LuaEngine/methods/GameObjectMethods.h @@ -353,5 +353,20 @@ namespace LuaGameObject go->SetRespawnTime(respawn); return 0; } + + /** + * Sets the respawn or despawn time for the gameobject. + * + * Respawn time is also used as despawn time depending on gameobject settings + * + * @param int32 delay = 0 : cooldown time in seconds to respawn or despawn the object. 0 means never + */ + int SetRespawnDelay(lua_State* L, GameObject* go) + { + int32 respawn = Eluna::CHECKVAL(L, 2); + + go->SetRespawnDelay(respawn); + return 0; + } }; #endif