Add NPC stuck detection (#14410)
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Threading;
|
||||
using Content.Server.NPC.Pathfinding;
|
||||
using Content.Shared.NPC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.NPC.Components;
|
||||
|
||||
@@ -39,12 +40,25 @@ public sealed class NPCSteeringComponent : Component
|
||||
/// <summary>
|
||||
/// Next time we can change our steering direction.
|
||||
/// </summary>
|
||||
[DataField("nextSteer", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextSteer = TimeSpan.Zero;
|
||||
|
||||
[DataField("lastSteerDirection")]
|
||||
public Vector2 LastSteerDirection = Vector2.Zero;
|
||||
|
||||
public const int SteeringFrequency = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Last position we considered for being stuck.
|
||||
/// </summary>
|
||||
[DataField("lastStuckCoordinates")]
|
||||
public EntityCoordinates LastStuckCoordinates;
|
||||
|
||||
[DataField("lastStuckTime", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan LastStuckTime;
|
||||
|
||||
public const float StuckDistance = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Have we currently requested a path.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user