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:
@@ -234,10 +234,12 @@ namespace Game.Entities
|
||||
|
||||
public void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false)
|
||||
{
|
||||
MoveSplineInit init = new(this);
|
||||
init.MoveTo(x, y, z, generatePath, forceDestination);
|
||||
init.SetVelocity(speed);
|
||||
GetMotionMaster().LaunchMoveSpline(init, 0, MovementGeneratorPriority.Normal, MovementGeneratorType.Point);
|
||||
var initializer = (MoveSplineInit init) =>
|
||||
{
|
||||
init.MoveTo(x, y, z, generatePath, forceDestination);
|
||||
init.SetVelocity(speed);
|
||||
};
|
||||
GetMotionMaster().LaunchMoveSpline(initializer, 0, MovementGeneratorPriority.Normal, MovementGeneratorType.Point);
|
||||
}
|
||||
|
||||
public void KnockbackFrom(Position origin, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
|
||||
|
||||
@@ -1108,18 +1108,20 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
float height = pos.GetPositionZ() + vehicle.GetBase().GetCollisionHeight();
|
||||
var initializer = (MoveSplineInit init) =>
|
||||
{
|
||||
float height = pos.GetPositionZ() + vehicle.GetBase().GetCollisionHeight();
|
||||
|
||||
MoveSplineInit init = new(this);
|
||||
// Creatures without inhabit type air should begin falling after exiting the vehicle
|
||||
if (IsTypeId(TypeId.Unit) && !CanFly() && height > GetMap().GetWaterOrGroundLevel(GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + vehicle.GetBase().GetCollisionHeight(), ref height))
|
||||
init.SetFall();
|
||||
|
||||
// Creatures without inhabit type air should begin falling after exiting the vehicle
|
||||
if (IsTypeId(TypeId.Unit) && !ToCreature().CanFly() && height > GetMap().GetWaterOrGroundLevel(GetPhaseShift(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + vehicle.GetBase().GetCollisionHeight(), ref height))
|
||||
init.SetFall();
|
||||
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
|
||||
init.SetFacing(pos.GetOrientation());
|
||||
init.SetTransportExit();
|
||||
};
|
||||
|
||||
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
|
||||
init.SetFacing(pos.GetOrientation());
|
||||
init.SetTransportExit();
|
||||
GetMotionMaster().LaunchMoveSpline(init, EventId.VehicleExit, MovementGeneratorPriority.Highest);
|
||||
GetMotionMaster().LaunchMoveSpline(initializer, EventId.VehicleExit, MovementGeneratorPriority.Highest);
|
||||
|
||||
if (player != null)
|
||||
player.ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
@@ -718,14 +718,16 @@ namespace Game.Entities
|
||||
|
||||
Passenger.SendClearTarget(); // SMSG_BREAK_TARGET
|
||||
Passenger.SetControlled(true, UnitState.Root); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
|
||||
// also adds MOVEMENTFLAG_ROOT
|
||||
// also adds MOVEMENTFLAG_ROOT
|
||||
|
||||
MoveSplineInit init = new(Passenger);
|
||||
init.DisableTransportPathTransformations();
|
||||
init.MoveTo(x, y, z, false, true);
|
||||
init.SetFacing(o);
|
||||
init.SetTransportEnter();
|
||||
Passenger.GetMotionMaster().LaunchMoveSpline(init, EventId.VehicleBoard, MovementGeneratorPriority.Highest);
|
||||
var initializer = (MoveSplineInit init) =>
|
||||
{
|
||||
init.DisableTransportPathTransformations();
|
||||
init.MoveTo(x, y, z, false, true);
|
||||
init.SetFacing(o);
|
||||
init.SetTransportEnter();
|
||||
};
|
||||
Passenger.GetMotionMaster().LaunchMoveSpline(initializer, EventId.VehicleBoard, MovementGeneratorPriority.Highest);
|
||||
|
||||
foreach (var (_, threatRef) in Passenger.GetThreatManager().GetThreatenedByMeList())
|
||||
threatRef.GetOwner().GetThreatManager().AddThreat(Target.GetBase(), threatRef.GetThreat(), null, true, true);
|
||||
|
||||
Reference in New Issue
Block a user