Core/Creatures: Remove hover on death

Port From (https://github.com/TrinityCore/TrinityCore/commit/a91edcb9524b53f027a8ef8c247a443a9bb42f1e)
This commit is contained in:
hondacrx
2021-08-24 12:27:36 -04:00
parent e4240fcd94
commit 8636712938
4 changed files with 18 additions and 12 deletions
+5 -2
View File
@@ -1824,7 +1824,10 @@ namespace Game.Entities
if (m_formation != null && m_formation.GetLeader() == this)
m_formation.FormationReset(true);
if ((CanFly() || IsFlying()))
bool needsFalling = IsFlying() || IsHovering();
SetHover(false);
if (needsFalling)
GetMotionMaster().MoveFall();
base.SetDeathState(DeathState.Corpse);
@@ -2848,7 +2851,7 @@ namespace Game.Entities
{
SetCanFly(false);
SetDisableGravity(false);
if (CanHover() || HasAuraType(AuraType.Hover))
if (IsAlive() && (CanHover() || HasAuraType(AuraType.Hover)))
SetHover(true);
}
@@ -362,12 +362,10 @@ namespace Game.Entities
Rooted = false;
}
bool IsGroundAllowed() { return Ground != CreatureGroundMovementType.None; }
bool IsSwimAllowed() { return Swim; }
bool IsFlightAllowed() { return Flight != CreatureFlightMovementType.None; }
bool IsRooted() { return Rooted; }
public bool IsGroundAllowed() { return Ground != CreatureGroundMovementType.None; }
public bool IsSwimAllowed() { return Swim; }
public bool IsFlightAllowed() { return Flight != CreatureFlightMovementType.None; }
public bool IsRooted() { return Rooted; }
public override string ToString()
{
+3 -1
View File
@@ -989,7 +989,9 @@ namespace Game.Entities
else
{
RemoveUnitMovementFlag(MovementFlag.Hover);
if (hoverHeight != 0)
//! Dying creatures will MoveFall from setDeathState
if (hoverHeight != 0 && (!IsDying() || !IsUnit()))
{
float newZ = GetPositionZ() - hoverHeight;
UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), ref newZ);
+6 -3
View File
@@ -1813,12 +1813,15 @@ namespace Game
if (!fields.IsNull(60))
creature.Movement.Ground = (CreatureGroundMovementType)fields.Read<byte>(60);
creature.Movement.Swim = fields.Read<bool>(61);
if (!fields.IsNull(61))
creature.Movement.Swim = fields.Read<bool>(61);
if (!fields.IsNull(62))
creature.Movement.Flight = (CreatureFlightMovementType)fields.Read<byte>(62);
if (!fields.IsNull(63))
creature.Movement.Rooted = fields.Read<bool>(63);
creature.Movement.Rooted = fields.Read<uint>(63);
creature.HoverHeight = fields.Read<float>(64);
creature.ModHealth = fields.Read<float>(65);
creature.ModHealthExtra = fields.Read<float>(66);
@@ -4966,7 +4969,7 @@ namespace Game
}
public CreatureMovementData GetCreatureMovementOverride(ulong spawnId)
{
return creatureMovementOverrides.lookupbykey(spawnId);
return creatureMovementOverrides.LookupByKey(spawnId);
}
public EquipmentInfo GetEquipmentInfo(uint entry, int id)
{