Core/Movement: Delay creating MoveSplineInit objects used by GenericMovementGenerator to spline launch time

Port From (https://github.com/TrinityCore/TrinityCore/commit/36dde87249e87c5693162a6e890875d828f93d6d)
This commit is contained in:
hondacrx
2022-06-15 15:48:07 -04:00
parent 5ff87102ca
commit f91230ae33
7 changed files with 154 additions and 127 deletions
+8 -5
View File
@@ -2039,11 +2039,14 @@ namespace Scripts.World.NpcSpecial
break;
}
MoveSplineInit init = new(who);
init.DisableTransportPathTransformations();
init.MoveTo(x, y, z, false);
init.SetFacing(o);
who.GetMotionMaster().LaunchMoveSpline(init, EventId.VehicleBoard, MovementGeneratorPriority.Highest);
var initializer = (MoveSplineInit init) =>
{
init.DisableTransportPathTransformations();
init.MoveTo(x, y, z, false);
init.SetFacing(o);
};
who.GetMotionMaster().LaunchMoveSpline(initializer, EventId.VehicleBoard, MovementGeneratorPriority.Highest);
who.m_Events.AddEvent(new CastFoodSpell(who, SpellIds.ChairSpells[who.GetEntry()]), who.m_Events.CalculateTime(TimeSpan.FromSeconds(1)));
Creature creature = who.ToCreature();
if (creature)