Sprite Movement working with AI movement (#33494)
* FINALLY * Update animals.yml
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared.Climbing.Systems;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.NPC;
|
||||
using Content.Shared.NPC.Components;
|
||||
@@ -207,6 +208,9 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
if (EntityManager.TryGetComponent(uid, out InputMoverComponent? controller))
|
||||
{
|
||||
controller.CurTickSprintMovement = Vector2.Zero;
|
||||
|
||||
var ev = new SpriteMoveEvent(false);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
}
|
||||
|
||||
component.PathfindToken?.Cancel();
|
||||
@@ -270,7 +274,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDirection(InputMoverComponent component, NPCSteeringComponent steering, Vector2 value, bool clear = true)
|
||||
private void SetDirection(EntityUid uid, InputMoverComponent component, NPCSteeringComponent steering, Vector2 value, bool clear = true)
|
||||
{
|
||||
if (clear && value.Equals(Vector2.Zero))
|
||||
{
|
||||
@@ -282,6 +286,9 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
component.CurTickSprintMovement = value;
|
||||
component.LastInputTick = _timing.CurTick;
|
||||
component.LastInputSubTick = ushort.MaxValue;
|
||||
|
||||
var ev = new SpriteMoveEvent(true);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -297,7 +304,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
{
|
||||
if (Deleted(steering.Coordinates.EntityId))
|
||||
{
|
||||
SetDirection(mover, steering, Vector2.Zero);
|
||||
SetDirection(uid, mover, steering, Vector2.Zero);
|
||||
steering.Status = SteeringStatus.NoPath;
|
||||
return;
|
||||
}
|
||||
@@ -305,14 +312,14 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
// No path set from pathfinding or the likes.
|
||||
if (steering.Status == SteeringStatus.NoPath)
|
||||
{
|
||||
SetDirection(mover, steering, Vector2.Zero);
|
||||
SetDirection(uid, mover, steering, Vector2.Zero);
|
||||
return;
|
||||
}
|
||||
|
||||
// Can't move at all, just noop input.
|
||||
if (!mover.CanMove)
|
||||
{
|
||||
SetDirection(mover, steering, Vector2.Zero);
|
||||
SetDirection(uid, mover, steering, Vector2.Zero);
|
||||
steering.Status = SteeringStatus.NoPath;
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +348,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
|
||||
if (steering.CanSeek && !TrySeek(uid, mover, steering, body, xform, offsetRot, moveSpeed, interest, frameTime, ref forceSteer))
|
||||
{
|
||||
SetDirection(mover, steering, Vector2.Zero);
|
||||
SetDirection(uid, mover, steering, Vector2.Zero);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -354,7 +361,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
|
||||
if (!forceSteer)
|
||||
{
|
||||
SetDirection(mover, steering, steering.LastSteerDirection, false);
|
||||
SetDirection(uid, mover, steering, steering.LastSteerDirection, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -391,7 +398,7 @@ public sealed partial class NPCSteeringSystem : SharedNPCSteeringSystem
|
||||
|
||||
steering.LastSteerDirection = resultDirection;
|
||||
DebugTools.Assert(!float.IsNaN(resultDirection.X));
|
||||
SetDirection(mover, steering, resultDirection, false);
|
||||
SetDirection(uid, mover, steering, resultDirection, false);
|
||||
}
|
||||
|
||||
private EntityCoordinates GetCoordinates(PathPoly poly)
|
||||
|
||||
Reference in New Issue
Block a user