From 36dde87249e87c5693162a6e890875d828f93d6d Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 3 Apr 2022 22:36:49 +0200 Subject: Core/Movement: Delay creating MoveSplineInit objects used by GenericMovementGenerator to spline launch time * This fixes inconsistent transport state detection for players exiting vehicles that are on transport (ICC gunship battle), fixes players being telerpoted to middle of nowhere on that fight (cherry picked from commit b1a94bf94c500b64a5c4ae92642a95d048d9f392) --- src/server/scripts/World/npcs_special.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/server/scripts/World') diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index e4c5af9010f..8b8e8a61aeb 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2302,11 +2302,13 @@ public: break; } - Movement::MoveSplineInit init(who); - init.DisableTransportPathTransformations(); - init.MoveTo(x, y, z, false); - init.SetFacing(o); - who->GetMotionMaster()->LaunchMoveSpline(std::move(init), EVENT_VEHICLE_BOARD, MOTION_PRIORITY_HIGHEST); + std::function initializer = [=](Movement::MoveSplineInit& init) + { + init.DisableTransportPathTransformations(); + init.MoveTo(x, y, z, false); + init.SetFacing(o); + }; + who->GetMotionMaster()->LaunchMoveSpline(std::move(initializer), EVENT_VEHICLE_BOARD, MOTION_PRIORITY_HIGHEST); who->m_Events.AddEvent(new CastFoodSpell(who, _chairSpells.at(who->GetEntry())), who->m_Events.CalculateTime(1s)); if (Creature* creature = who->ToCreature()) creature->SetDisplayFromModel(0); -- cgit v1.2.3