Core/Movement: Ensure land and takeoff animations even if gravity enabled/disabled state is not what spline generator expects

Port From (https://github.com/TrinityCore/TrinityCore/commit/be3ae90dc488894afea8e4cca74d9105558fff53)
This commit is contained in:
Hondacrx
2024-08-05 14:17:54 -04:00
parent 9eefaca29a
commit 39198d0ffc
5 changed files with 33 additions and 23 deletions
@@ -17,6 +17,12 @@ namespace Game.Movement
public UnitState BaseUnitState;
public TaskCompletionSource<MovementStopReason> ScriptResult;
~MovementGenerator()
{
// Ensure script doesn't get stuck waiting for this movement
SetScriptResult(MovementStopReason.Interrupted);
}
// on top first update
public virtual void Initialize(Unit owner) { }
+4 -1
View File
@@ -645,6 +645,8 @@ namespace Game.Movement
{
init.MoveTo(pos, false);
init.SetAnimation(AnimTier.Ground, tierTransitionId.GetValueOrDefault(1));
init.SetFly(); // ensure smooth animation even if gravity is enabled before calling this function
init.SetSmooth();
switch (speedSelectionMode)
{
case MovementWalkRunSpeedSelectionMode.ForceRun:
@@ -669,7 +671,8 @@ namespace Game.Movement
var initializer = (MoveSplineInit init) =>
{
init.MoveTo(pos, false);
init.SetAnimation(AnimTier.Hover, tierTransitionId.GetValueOrDefault(15));
init.SetAnimation(AnimTier.Fly, tierTransitionId.GetValueOrDefault(2));
init.SetFly(); // ensure smooth animation even if gravity is disabled after calling this function
switch (speedSelectionMode)
{
case MovementWalkRunSpeedSelectionMode.ForceRun:
+2 -1
View File
@@ -321,7 +321,8 @@ namespace Game.Movement
args.animTier = new();
args.animTier.TierTransitionId = tierTransitionId;
args.animTier.AnimTier = (byte)anim;
args.flags.EnableAnimation();
if (tierTransitionId == 0)
args.flags.EnableAnimation();
}
public void DisableTransportPathTransformations() { args.TransformForTransport = false; }