From fdc78a23507ac54e32d6b74664ba4b2068581e15 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 26 Sep 2021 14:26:58 -0400 Subject: [PATCH] Core/Movement: crashfix workaround Port From (https://github.com/TrinityCore/TrinityCore/commit/ab740026b30b80e8599a0ad8c8a8eb466b6f4222) --- Source/Game/Entities/Unit/Unit.Movement.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Game/Entities/Unit/Unit.Movement.cs b/Source/Game/Entities/Unit/Unit.Movement.cs index 002376230..f4d0d0081 100644 --- a/Source/Game/Entities/Unit/Unit.Movement.cs +++ b/Source/Game/Entities/Unit/Unit.Movement.cs @@ -204,8 +204,12 @@ namespace Game.Entities MoveSplineInit init = new(this); init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false); + if (GetTransport()) + init.DisableTransportPathTransformations(); // It makes no sense to target global orientation init.SetFacing(ori); - GetMotionMaster().LaunchMoveSpline(init, EventId.Face, MovementSlot.Controlled); + + //GetMotionMaster().LaunchMoveSpline(init, EventId.Face, MovementSlot.Controlled); + init.Launch(); } public void SetFacingToObject(WorldObject obj, bool force = true) @@ -215,7 +219,12 @@ namespace Game.Entities return; // @todo figure out under what conditions creature will move towards object instead of facing it where it currently is. - SetFacingTo(GetAbsoluteAngle(obj)); + MoveSplineInit init = new(this); + init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false); + init.SetFacing(GetAbsoluteAngle(obj)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming + + //GetMotionMaster().LaunchMoveSpline(init, EventId.Face, MovementSlot.Controlled); + init.Launch(); } public void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false)