Skip to content

Commit 7a6f846

Browse files
committed
New GetCreatureSpawnId and SetCorpseDelay functions
- Implemented new function to get the creatures spawn ID: - Example: - In Lua, write "creature:GetCreatureSpawnId()" - Implemented new function to set a creatures corpse delay: - Example: - In Lua, write "creature:SetCorpseDelay(5000)" Thanks Sylian!
1 parent a63ef3f commit 7a6f846

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/LuaEngine/LuaFunctions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ ElunaRegister<Creature> CreatureMethods[] =
776776
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
777777
{ "GetWanderRadius", &LuaCreature::GetWanderRadius },
778778
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
779+
{ "GetCreatureSpawnId", &LuaCreature::GetCreatureSpawnId },
779780
{ "GetWaypointPath", &LuaCreature::GetWaypointPath },
780781
{ "GetLootMode", &LuaCreature::GetLootMode },
781782
{ "GetLootRecipient", &LuaCreature::GetLootRecipient },
@@ -795,6 +796,7 @@ ElunaRegister<Creature> CreatureMethods[] =
795796
{ "SetHover", &LuaCreature::SetHover },
796797
{ "SetDisableGravity", &LuaCreature::SetDisableGravity },
797798
{ "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
799+
{ "SetCorpseDelay", &LuaCreature::SetCorpseDelay },
798800
{ "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance },
799801
{ "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance },
800802
{ "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType },

src/LuaEngine/methods/CreatureMethods.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,17 @@ namespace LuaCreature
434434
return 1;
435435
}
436436

437+
/**
438+
* Returns the spawn ID for this [Creature].
439+
*
440+
* @return uint32 spawnId
441+
*/
442+
int GetCreatureSpawnId(lua_State* L, Creature* creature)
443+
{
444+
Eluna::Push(L, creature->GetSpawnId());
445+
return 1;
446+
}
447+
437448
/**
438449
* Returns the default movement type for this [Creature].
439450
*
@@ -1134,6 +1145,18 @@ namespace LuaCreature
11341145
return 0;
11351146
}
11361147

1148+
/**
1149+
* Sets the time it takes for the [Creature]'s corpse to despawn when killed.
1150+
*
1151+
* @param uint32 delay : the delay, in seconds
1152+
*/
1153+
int SetCorpseDelay(lua_State* L, Creature* creature)
1154+
{
1155+
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
1156+
creature->SetCorpseDelay(delay);
1157+
return 0;
1158+
}
1159+
11371160
/**
11381161
* Make the [Creature] start following its waypoint path.
11391162
*/

0 commit comments

Comments
 (0)