mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Creatures: Stop falling if corpse is removed (can happen when alive unit is despawned instantly in air) (#18995)
Do not allow to start waypoint movement when unit is dead
This commit is contained in:
@@ -295,6 +295,10 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
if (setSpawnTime)
|
||||
m_respawnTime = time(NULL) + respawnDelay;
|
||||
|
||||
// if corpse was removed during falling, the falling will continue and override relocation to respawn position
|
||||
if (IsFalling())
|
||||
StopMoving();
|
||||
|
||||
float x, y, z, o;
|
||||
GetRespawnPosition(x, y, z, &o);
|
||||
SetHomePosition(x, y, z, o);
|
||||
|
||||
@@ -98,6 +98,10 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature)
|
||||
if (!i_path || i_path->empty())
|
||||
return false;
|
||||
|
||||
// Dont allow dead creatures to move
|
||||
if (!creature->IsAlive())
|
||||
return false;
|
||||
|
||||
if (Stopped())
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user