From 8111f50d035c1915165cb8ecd4938ba97820ed10 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sun, 6 Jun 2021 17:51:00 +0200 Subject: Core/Movement: Add new flag MOVEMENTGENERATOR_FLAG_PERSIST_ON_DEATH (#26549) * Core/Movement: Add new flag MOVEMENTGENERATOR_FLAG_PERSIST_ON_DEATH Add new flag MOVEMENTGENERATOR_FLAG_PERSIST_ON_DEATH to keep movement generators even after death. Fixes #23095 Could replace ff26027453179448bb972d88a51e565d71e95f3f * Core/Movement: reorder new method MotionMaster::StopOnDeath * Core/Movement: reorder new method MotionMaster::StopOnDeath * Keep MoveJump movement generator after death Co-authored-by: ccrs (cherry picked from commit 9fe9dc087b4dc52af7897942a83c1f880d3a4ef8) --- src/server/game/Entities/Unit/Unit.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/server/game/Entities/Unit') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b11af5f555f..5ad1a1b6d19 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8259,19 +8259,8 @@ void Unit::setDeathState(DeathState s) // Don't clear the movement if the Unit was on a vehicle as we are exiting now if (!isOnVehicle) { - if (IsInWorld()) - { - // Only clear MotionMaster for entities that exists in world - // Avoids crashes in the following conditions : - // * Using 'call pet' on dead pets - // * Using 'call stabled pet' - // * Logging in with dead pets - GetMotionMaster()->Clear(); - GetMotionMaster()->MoveIdle(); - } - - StopMoving(); - DisableSpline(); + if (GetMotionMaster()->StopOnDeath()) + DisableSpline(); } // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp -- cgit v1.2.3