Update content vectors to numerics (#17759)

This commit is contained in:
metalgearsloth
2023-07-08 14:08:32 +10:00
committed by GitHub
parent 15772478c9
commit 68480af109
383 changed files with 978 additions and 575 deletions

View File

@@ -1,3 +1,5 @@
using System.Numerics;
namespace Content.Shared.NPC;
public abstract class SharedPathfindingSystem : EntitySystem
@@ -9,15 +11,18 @@ public abstract class SharedPathfindingSystem : EntitySystem
public const byte SubStep = 4;
public const byte ChunkSize = 8;
public static readonly Vector2 ChunkSizeVec = new(ChunkSize, ChunkSize);
/// <summary>
/// We won't do points on edges so we'll offset them slightly.
/// </summary>
protected const float StepOffset = 1f / SubStep / 2f;
private static readonly Vector2 StepOffsetVec = new(StepOffset, StepOffset);
public Vector2 GetCoordinate(Vector2i chunk, Vector2i index)
{
return new Vector2(index.X, index.Y) / SubStep+ (chunk) * ChunkSize + StepOffset;
return new Vector2(index.X, index.Y) / SubStep+ (chunk) * ChunkSizeVec + StepOffsetVec;
}
public static float ManhattanDistance(Vector2i start, Vector2i end)