Skip to content

Commit 957a3b8

Browse files
Niam5Foereaper
andcommitted
Add SetSpawnedByDefault gameobject method
Co-Authored-By: Foe <[email protected]>
1 parent 1ce6a90 commit 957a3b8

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

methods/CMangos/GameObjectMethods.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,22 @@ namespace LuaGameObject
301301
go->SetRespawnTime(respawn);
302302
return 0;
303303
}
304-
304+
305+
/**
306+
* Sets whether or not the [GameObject] will be spawned by default
307+
*
308+
* Primarily used for temporary spawns.
309+
*
310+
* @param bool spawn = true : if false, it will prevent the [GameObject] from respawning by default
311+
*/
312+
int SetSpawnedByDefault(Eluna* E, GameObject* go)
313+
{
314+
bool spawn = E->CHECKVAL<bool>(2, true);
315+
316+
go->SetSpawnedByDefault(spawn);
317+
return 0;
318+
}
319+
305320
ElunaRegister<GameObject> GameObjectMethods[] =
306321
{
307322
// Getters
@@ -316,6 +331,7 @@ namespace LuaGameObject
316331
{ "SetGoState", &LuaGameObject::SetGoState },
317332
{ "SetLootState", &LuaGameObject::SetLootState },
318333
{ "SetRespawnTime", &LuaGameObject::SetRespawnTime },
334+
{ "SetSpawnedByDefault", &LuaGameObject::SetSpawnedByDefault },
319335

320336
// Boolean
321337
{ "IsTransport", &LuaGameObject::IsTransport },
@@ -331,8 +347,7 @@ namespace LuaGameObject
331347
{ "SaveToDB", &LuaGameObject::SaveToDB },
332348

333349
// Not implemented methods
334-
{ "IsDestructible", METHOD_REG_NONE }, // Not implemented
335-
{ "SetSpawnedByDefault", METHOD_REG_NONE } // Not implemented
350+
{ "IsDestructible", METHOD_REG_NONE } // Not implemented
336351
};
337352
};
338353
#endif

0 commit comments

Comments
 (0)