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:
xinef1
2017-01-30 10:57:24 +01:00
committed by Shauren
parent 5e46bb3e8c
commit f86ca9e3c9
2 changed files with 8 additions and 0 deletions

View File

@@ -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);

View File

@@ -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;