feat(CreatureMethods): Add GetCreatureSpawnId and SetCorpseDelay methods (#300)

This commit is contained in:
Aldori
2025-08-22 15:24:33 -04:00
committed by GitHub
parent afae63555b
commit 42e5be76fc
2 changed files with 25 additions and 0 deletions

View File

@@ -776,6 +776,7 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "GetRespawnDelay", &LuaCreature::GetRespawnDelay },
{ "GetWanderRadius", &LuaCreature::GetWanderRadius },
{ "GetCurrentWaypointId", &LuaCreature::GetCurrentWaypointId },
{ "GetSpawnId", &LuaCreature::GetSpawnId },
{ "GetWaypointPath", &LuaCreature::GetWaypointPath },
{ "GetLootMode", &LuaCreature::GetLootMode },
{ "GetLootRecipient", &LuaCreature::GetLootRecipient },
@@ -795,6 +796,7 @@ ElunaRegister<Creature> CreatureMethods[] =
{ "SetHover", &LuaCreature::SetHover },
{ "SetDisableGravity", &LuaCreature::SetDisableGravity },
{ "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
{ "SetCorpseDelay", &LuaCreature::SetCorpseDelay },
{ "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance },
{ "SetNoSearchAssistance", &LuaCreature::SetNoSearchAssistance },
{ "SetDefaultMovementType", &LuaCreature::SetDefaultMovementType },

View File

@@ -434,6 +434,17 @@ namespace LuaCreature
return 1;
}
/**
* Returns the spawn ID for this [Creature].
*
* @return uint32 spawnId
*/
int GetSpawnId(lua_State* L, Creature* creature)
{
Eluna::Push(L, creature->GetSpawnId());
return 1;
}
/**
* Returns the default movement type for this [Creature].
*
@@ -1134,6 +1145,18 @@ namespace LuaCreature
return 0;
}
/**
* Sets the time it takes for the [Creature]'s corpse to despawn when killed.
*
* @param uint32 delay : the delay, in seconds
*/
int SetCorpseDelay(lua_State* L, Creature* creature)
{
uint32 delay = Eluna::CHECKVAL<uint32>(L, 2);
creature->SetCorpseDelay(delay);
return 0;
}
/**
* Make the [Creature] start following its waypoint path.
*/