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) if (m_formation != null && m_formation.GetLeader() == this)
m_formation.FormationReset(true); m_formation.FormationReset(true);
if ((CanFly() || IsFlying())) bool needsFalling = IsFlying() || IsHovering();
SetHover(false);
if (needsFalling)
GetMotionMaster().MoveFall(); GetMotionMaster().MoveFall();
base.SetDeathState(DeathState.Corpse); base.SetDeathState(DeathState.Corpse);
@@ -2848,7 +2851,7 @@ namespace Game.Entities
{ {
SetCanFly(false); SetCanFly(false);
SetDisableGravity(false); SetDisableGravity(false);
if (CanHover() || HasAuraType(AuraType.Hover)) if (IsAlive() && (CanHover() || HasAuraType(AuraType.Hover)))
SetHover(true); SetHover(true);
} }
@@ -362,12 +362,10 @@ namespace Game.Entities
Rooted = false; Rooted = false;
} }
public bool IsGroundAllowed() { return Ground != CreatureGroundMovementType.None; }
public bool IsSwimAllowed() { return Swim; }
bool IsGroundAllowed() { return Ground != CreatureGroundMovementType.None; } public bool IsFlightAllowed() { return Flight != CreatureFlightMovementType.None; }
bool IsSwimAllowed() { return Swim; } public bool IsRooted() { return Rooted; }
bool IsFlightAllowed() { return Flight != CreatureFlightMovementType.None; }
bool IsRooted() { return Rooted; }
public override string ToString() public override string ToString()
{ {
+3 -1
View File
@@ -989,7 +989,9 @@ namespace Game.Entities
else else
{ {
RemoveUnitMovementFlag(MovementFlag.Hover); RemoveUnitMovementFlag(MovementFlag.Hover);
if (hoverHeight != 0)
//! Dying creatures will MoveFall from setDeathState
if (hoverHeight != 0 && (!IsDying() || !IsUnit()))
{ {
float newZ = GetPositionZ() - hoverHeight; float newZ = GetPositionZ() - hoverHeight;
UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), ref newZ); UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), ref newZ);
+6 -3
View File
@@ -1813,12 +1813,15 @@ namespace Game
if (!fields.IsNull(60)) if (!fields.IsNull(60))
creature.Movement.Ground = (CreatureGroundMovementType)fields.Read<byte>(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)) if (!fields.IsNull(62))
creature.Movement.Flight = (CreatureFlightMovementType)fields.Read<byte>(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.HoverHeight = fields.Read<float>(64);
creature.ModHealth = fields.Read<float>(65); creature.ModHealth = fields.Read<float>(65);
creature.ModHealthExtra = fields.Read<float>(66); creature.ModHealthExtra = fields.Read<float>(66);
@@ -4966,7 +4969,7 @@ namespace Game
} }
public CreatureMovementData GetCreatureMovementOverride(ulong spawnId) public CreatureMovementData GetCreatureMovementOverride(ulong spawnId)
{ {
return creatureMovementOverrides.lookupbykey(spawnId); return creatureMovementOverrides.LookupByKey(spawnId);
} }
public EquipmentInfo GetEquipmentInfo(uint entry, int id) public EquipmentInfo GetEquipmentInfo(uint entry, int id)
{ {