Skip to content

Commit 99a8c9f

Browse files
committed
Add SetSpawnedByDefault gameobject method
1 parent fe8f5e5 commit 99a8c9f

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

methods/CMangos/GameObjectMethods.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ namespace LuaGameObject
331331
{ "SaveToDB", &LuaGameObject::SaveToDB },
332332

333333
// Not implemented methods
334-
{ "IsDestructible", METHOD_REG_NONE } // Not implemented
334+
{ "IsDestructible", METHOD_REG_NONE }, // Not implemented
335+
{ "SetSpawnedByDefault", METHOD_REG_NONE } // Not implemented
335336
};
336337
};
337338
#endif

methods/Mangos/GameObjectMethods.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ namespace LuaGameObject
337337
{ "SaveToDB", &LuaGameObject::SaveToDB },
338338

339339
// Not implemented methods
340-
{ "IsDestructible", METHOD_REG_NONE } // Not implemented
340+
{ "IsDestructible", METHOD_REG_NONE }, // Not implemented
341+
{ "SetSpawnedByDefault", METHOD_REG_NONE } // Not implemented
341342
};
342343
};
343344
#endif

methods/TrinityCore/GameObjectMethods.h

+16
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,21 @@ namespace LuaGameObject
298298
return 0;
299299
}
300300

301+
/**
302+
* Sets whether or not the [GameObject] will be spawned by default
303+
*
304+
* Primarily used for temporary spawns.
305+
*
306+
* @param bool spawn = true : if false, it will prevent the [GameObject] from respawning by default
307+
*/
308+
int SetSpawnedByDefault(Eluna* E, GameObject* go)
309+
{
310+
bool spawn = E->CHECKVAL<bool>(2, true);
311+
312+
go->SetSpawnedByDefault(spawn);
313+
return 0;
314+
}
315+
301316
ElunaRegister<GameObject> GameObjectMethods[] =
302317
{
303318
// Getters
@@ -312,6 +327,7 @@ namespace LuaGameObject
312327
{ "SetGoState", &LuaGameObject::SetGoState },
313328
{ "SetLootState", &LuaGameObject::SetLootState },
314329
{ "SetRespawnTime", &LuaGameObject::SetRespawnTime },
330+
{ "SetSpawnedByDefault", &LuaGameObject::SetSpawnedByDefault },
315331

316332
// Boolean
317333
{ "IsTransport", &LuaGameObject::IsTransport },

methods/VMangos/GameObjectMethods.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ namespace LuaGameObject
330330
{ "SaveToDB", &LuaGameObject::SaveToDB },
331331

332332
// Not implemented methods
333-
{ "IsDestructible", METHOD_REG_NONE } // Not implemented
333+
{ "IsDestructible", METHOD_REG_NONE }, // Not implemented
334+
{ "SetSpawnedByDefault", METHOD_REG_NONE } // Not implemented
334335
};
335336
};
336337
#endif

0 commit comments

Comments
 (0)