aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-04-03 22:36:49 +0200
committerShauren <shauren.trinity@gmail.com>2022-04-03 22:36:49 +0200
commitb1a94bf94c500b64a5c4ae92642a95d048d9f392 (patch)
treef336113e8a55715b491c3dda0738fe0fe5895413 /src/server/scripts/World
parent3f55647b3e2c65595d9822fa962810bcf559b73d (diff)
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
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/npcs_special.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index fe448d38124..1299df63c8b 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -2398,11 +2398,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<void(Movement::MoveSplineInit&)> 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 (who->GetTypeId() == TYPEID_UNIT)
who->SetDisplayId(who->ToCreature()->GetCreatureTemplate()->Modelid1);