using System.Threading; using Content.Server.CPUJob.JobQueues; using Robust.Shared.Map; namespace Content.Server.NPC.Components; /// /// Added to NPCs that are moving. /// [RegisterComponent] public sealed class NPCSteeringComponent : Component { [ViewVariables] public Job>? Pathfind = null; [ViewVariables] public CancellationTokenSource? PathfindToken = null; /// /// Current path we're following to our coordinates. /// [ViewVariables] public Queue CurrentPath = new(); /// /// End target that we're trying to move to. /// [ViewVariables(VVAccess.ReadWrite)] public EntityCoordinates Coordinates; /// /// Target that we're trying to move to. If we have a path then this will be the first node on the path. /// [ViewVariables] public EntityCoordinates CurrentTarget; /// /// How close are we trying to get to the coordinates before being considered in range. /// [ViewVariables(VVAccess.ReadWrite)] public float Range = 0.2f; /// /// How far does the last node in the path need to be before considering re-pathfinding. /// [ViewVariables(VVAccess.ReadWrite)] public float RepathRange = 1.5f; [ViewVariables] public SteeringStatus Status = SteeringStatus.Moving; } public enum SteeringStatus : byte { /// /// If we can't reach the target (e.g. different map). /// NoPath, /// /// Are we moving towards our target /// Moving, /// /// Are we currently in range of our target. /// InRange, }