Update content vectors to numerics (#17759)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user