diff options
| author | ccrs <ccrs@users.noreply.github.com> | 2025-10-25 17:09:37 +0200 |
|---|---|---|
| committer | ccrs <ccrs@users.noreply.github.com> | 2025-10-25 17:09:37 +0200 |
| commit | f4d8105064afdf98212320b5bd1569f2af3fa68a (patch) | |
| tree | c3eaf88ec42ee6ddcdc3bae86b26ced6708f7724 | |
| parent | 736add62678b5e04399421ee6ebcdaa2c7447712 (diff) | |
Core/Entities: improve unit on death movement
Handle MoveFall spline manually instead on MotionMaster -> prepares and sends movespline just before Set methods -> they "detect" the fall spline and send the necessary DISABLE related packets
Signal MotionMaster to not reset-initialize static idle movement with the new MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION
Prevent spline from generating a path, we want a straight line towards the floor
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 7 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 21 | ||||
| -rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 2 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 0cfa85c237b..0824a95f3c2 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2006,13 +2006,6 @@ void Creature::setDeathState(DeathState s) if (m_formation && m_formation->GetLeader() == this) m_formation->FormationReset(true); - bool needsFalling = (IsFlying() || IsHovering()) && !IsUnderWater(); - SetHover(false, false); - SetDisableGravity(false, false); - - if (needsFalling) - GetMotionMaster()->MoveFall(); - Unit::setDeathState(CORPSE); } else if (s == JUST_RESPAWNED) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 213329d3e96..cca0d47a7e2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8760,9 +8760,28 @@ void Unit::setDeathState(DeathState s) if (!isOnVehicle) { if (GetMotionMaster()->StopOnDeath()) - DisableSpline(); + { + if (!HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED) && GetTypeId() == TYPEID_UNIT && ToCreature()->IsInAir(*this, GetFloorZ(), false) && !IsUnderWater()) + { + GetMotionMaster()->AddFlag(MOTIONMASTER_FLAG_STATIC_PREVENT_INITIALIZATION); + SetFall(true); + Movement::MoveSplineInit init(this); + init.MoveTo(GetPositionX(), GetPositionY(), GetFloorZ(), false, true); + init.SetFall(); + init.Launch(); + } + else + { + StopMoving(); + DisableSpline(); + } + } } + SetDisableGravity(false); + SetCanFly(false); + SetHover(false); + // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp // do not why since in IncreaseMaxHealth currenthealth is checked SetHealth(0); diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index b26d769da59..444847d355d 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -563,8 +563,6 @@ bool MotionMaster::StopOnDeath() MoveIdle(); } - _owner->StopMoving(); - return true; } |
