Core/Unit: Fix units on vehicles not dismounting on death
Port From (https://github.com/TrinityCore/TrinityCore/commit/b45277f1cf52483f0471f4aa79ca6b288180ee7c)
This commit is contained in:
@@ -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,18 +1385,24 @@ namespace Game.Entities
|
|||||||
// remove aurastates allowing special moves
|
// remove aurastates allowing special moves
|
||||||
ClearAllReactives();
|
ClearAllReactives();
|
||||||
m_Diminishing.Clear();
|
m_Diminishing.Clear();
|
||||||
if (IsInWorld)
|
|
||||||
|
// Don't clear the movement if the Unit was on a vehicle as we are exiting now
|
||||||
|
if (!isOnVehicle)
|
||||||
{
|
{
|
||||||
// Only clear MotionMaster for entities that exists in world
|
if (IsInWorld)
|
||||||
// Avoids crashes in the following conditions :
|
{
|
||||||
// * Using 'call pet' on dead pets
|
// Only clear MotionMaster for entities that exists in world
|
||||||
// * Using 'call stabled pet'
|
// Avoids crashes in the following conditions :
|
||||||
// * Logging in with dead pets
|
// * Using 'call pet' on dead pets
|
||||||
GetMotionMaster().Clear();
|
// * Using 'call stabled pet'
|
||||||
GetMotionMaster().MoveIdle();
|
// * Logging in with dead pets
|
||||||
|
GetMotionMaster().Clear();
|
||||||
|
GetMotionMaster().MoveIdle();
|
||||||
|
}
|
||||||
|
StopMoving();
|
||||||
|
DisableSpline();
|
||||||
}
|
}
|
||||||
StopMoving();
|
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user