NPC steering blending (#25666)

* NPC steering blending

Significantly more stable than using LastSteerDirection and also AntiStuck never got tripped locally when I was running around. I also left future notes for me to cleanup the pathfinder in future.

* Remove index
This commit is contained in:
metalgearsloth
2024-02-28 17:41:15 +11:00
committed by GitHub
parent 1c015d1fd5
commit f819404f6d
3 changed files with 56 additions and 48 deletions

View File

@@ -28,11 +28,11 @@ public sealed partial class NPCSteeringComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
public float Radius = 0.35f;
[ViewVariables]
public readonly float[] Interest = new float[SharedNPCSteeringSystem.InterestDirections];
[ViewVariables, DataField]
public float[] Interest = new float[SharedNPCSteeringSystem.InterestDirections];
[ViewVariables]
public readonly float[] Danger = new float[SharedNPCSteeringSystem.InterestDirections];
[ViewVariables, DataField]
public float[] Danger = new float[SharedNPCSteeringSystem.InterestDirections];
// TODO: Update radius, also danger points debug only
public readonly List<Vector2> DangerPoints = new();
@@ -45,21 +45,9 @@ public sealed partial class NPCSteeringComponent : Component
[DataField("forceMove")]
public bool ForceMove = false;
/// <summary>
/// Next time we can change our steering direction.
/// </summary>
[DataField("nextSteer", customTypeSerializer:typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextSteer = TimeSpan.Zero;
[DataField("lastSteerIndex")]
public int LastSteerIndex = -1;
[DataField("lastSteerDirection")]
public Vector2 LastSteerDirection = Vector2.Zero;
public const int SteeringFrequency = 5;
/// <summary>
/// Last position we considered for being stuck.
/// </summary>