Core/Unit: Fix units on vehicles not dismounting on death

Port From (https://github.com/TrinityCore/TrinityCore/commit/b45277f1cf52483f0471f4aa79ca6b288180ee7c)
This commit is contained in:
hondacrx
2022-04-28 10:25:11 -04:00
parent 258c3c489f
commit e271ca1981
+8
View File
@@ -1363,6 +1363,8 @@ namespace Game.Entities
// Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat // Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat
m_deathState = s; m_deathState = s;
bool isOnVehicle = GetVehicle() != null;
if (s != DeathState.Alive && s != DeathState.JustRespawned) if (s != DeathState.Alive && s != DeathState.JustRespawned)
{ {
CombatStop(); CombatStop();
@@ -1383,6 +1385,10 @@ namespace Game.Entities
// remove aurastates allowing special moves // remove aurastates allowing special moves
ClearAllReactives(); ClearAllReactives();
m_Diminishing.Clear(); m_Diminishing.Clear();
// Don't clear the movement if the Unit was on a vehicle as we are exiting now
if (!isOnVehicle)
{
if (IsInWorld) if (IsInWorld)
{ {
// Only clear MotionMaster for entities that exists in world // Only clear MotionMaster for entities that exists in world
@@ -1395,6 +1401,8 @@ namespace Game.Entities
} }
StopMoving(); StopMoving();
DisableSpline(); DisableSpline();
}
// without this when removing IncreaseMaxHealth aura player may stuck with 1 hp // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
// do not why since in IncreaseMaxHealth currenthealth is checked // do not why since in IncreaseMaxHealth currenthealth is checked
SetHealth(0); SetHealth(0);