mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
feat(Core/Creature): Actually despawn creatures on evade with Despawn… (#14786)
This commit is contained in:
@@ -2097,22 +2097,24 @@ void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds f
|
||||
ForcedDespawn(msTimeToDespawn.count(), forcedRespawnTimer);
|
||||
}
|
||||
|
||||
void Creature::DespawnOnEvade()
|
||||
void Creature::DespawnOnEvade(Seconds respawnDelay)
|
||||
{
|
||||
SetVisible(false);
|
||||
AI()->SummonedCreatureDespawnAll();
|
||||
}
|
||||
|
||||
void Creature::RespawnOnEvade()
|
||||
{
|
||||
SetVisible(true);
|
||||
UpdateMovementFlags();
|
||||
AI()->Reset();
|
||||
AI()->JustReachedHome();
|
||||
if (IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
|
||||
if (respawnDelay < 2s)
|
||||
{
|
||||
GetVehicleKit()->Reset(true);
|
||||
LOG_WARN("entities.unit", "DespawnOnEvade called with delay of {} seconds, defaulting to 2.", respawnDelay.count());
|
||||
respawnDelay = 2s;
|
||||
}
|
||||
|
||||
if (TempSummon* whoSummon = ToTempSummon())
|
||||
{
|
||||
LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
|
||||
whoSummon->UnSummon();
|
||||
return;
|
||||
}
|
||||
|
||||
DespawnOrUnsummon(Milliseconds(0), respawnDelay);
|
||||
}
|
||||
|
||||
void Creature::InitializeReactState()
|
||||
|
||||
@@ -272,8 +272,7 @@ public:
|
||||
|
||||
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer);
|
||||
void DespawnOrUnsummon(uint32 msTimeToDespawn = 0) { DespawnOrUnsummon(Milliseconds(msTimeToDespawn), 0s); };
|
||||
void DespawnOnEvade();
|
||||
void RespawnOnEvade();
|
||||
void DespawnOnEvade(Seconds respawnDelay = 20s);
|
||||
|
||||
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
[[nodiscard]] time_t GetRespawnTimeEx() const;
|
||||
|
||||
Reference in New Issue
Block a user