Core/Creatures: Remove hover on death

(cherry picked from commit 241109327bf573460d488d707d7eb19f82f1350c)
This commit is contained in:
Shauren
2021-08-24 13:45:34 +02:00
parent f8c03a9066
commit a91edcb952
4 changed files with 13 additions and 6 deletions
@@ -2140,7 +2140,10 @@ void Creature::setDeathState(DeathState s)
if (m_formation && m_formation->GetLeader() == this)
m_formation->FormationReset(true);
if ((CanFly() || IsFlying()))
bool needsFalling = IsFlying() || IsHovering();
SetHover(false);
if (needsFalling)
GetMotionMaster()->MoveFall();
Unit::setDeathState(CORPSE);
@@ -3150,7 +3153,7 @@ void Creature::UpdateMovementFlags()
{
SetCanFly(false);
SetDisableGravity(false);
if (CanHover() || HasAuraType(SPELL_AURA_HOVER))
if (IsAlive() && (CanHover() || HasAuraType(SPELL_AURA_HOVER)))
SetHover(true);
}
+2 -1
View File
@@ -13532,7 +13532,8 @@ bool Unit::SetHover(bool enable)
else
{
RemoveUnitMovementFlag(MOVEMENTFLAG_HOVER);
if (hoverHeight)
//! Dying creatures will MoveFall from setDeathState
if (hoverHeight && (!isDying() || GetTypeId() != TYPEID_UNIT))
{
float newZ = GetPositionZ() - hoverHeight;
UpdateAllowedPositionZ(GetPositionX(), GetPositionY(), newZ);
+6 -2
View File
@@ -456,11 +456,15 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
if (!fields[60].IsNull())
creatureTemplate.Movement.Ground = static_cast<CreatureGroundMovementType>(fields[60].GetUInt8());
creatureTemplate.Movement.Swim = fields[61].GetBool();
if (!fields[61].IsNull())
creatureTemplate.Movement.Swim = fields[61].GetBool();
if (!fields[62].IsNull())
creatureTemplate.Movement.Flight = static_cast<CreatureFlightMovementType>(fields[62].GetUInt8());
creatureTemplate.Movement.Rooted = fields[63].GetBool();
if (!fields[63].IsNull())
creatureTemplate.Movement.Rooted = fields[63].GetBool();
creatureTemplate.HoverHeight = fields[64].GetFloat();
creatureTemplate.ModHealth = fields[65].GetFloat();
creatureTemplate.ModHealthExtra = fields[66].GetFloat();
@@ -228,7 +228,6 @@ struct boss_twin_baseAI : public BossAI
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
me->SetHover(false);
if (Creature* pSister = GetSister())
{
if (!pSister->IsAlive())