Add readonly where it is missing and fix those field names according to their modifiers (#2589)
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI
|
||||
|
||||
public Faction GetHostileFactions(Faction faction) => _hostileFactions.TryGetValue(faction, out var hostiles) ? hostiles : Faction.None;
|
||||
|
||||
private Dictionary<Faction, Faction> _hostileFactions = new Dictionary<Faction, Faction>
|
||||
private readonly Dictionary<Faction, Faction> _hostileFactions = new Dictionary<Faction, Faction>
|
||||
{
|
||||
{Faction.NanoTransen,
|
||||
Faction.SimpleHostile | Faction.Syndicate | Faction.Xeno},
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
/// <summary>
|
||||
/// Queued region updates
|
||||
/// </summary>
|
||||
private HashSet<PathfindingChunk> _queuedUpdates = new HashSet<PathfindingChunk>();
|
||||
private readonly HashSet<PathfindingChunk> _queuedUpdates = new HashSet<PathfindingChunk>();
|
||||
|
||||
// Oh god the nesting. Shouldn't need to go beyond this
|
||||
/// <summary>
|
||||
@@ -53,7 +53,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
/// Regions are groups of nodes with the same profile (for pathfinding purposes)
|
||||
/// i.e. same collision, not-space, same access, etc.
|
||||
/// </summary>
|
||||
private Dictionary<GridId, Dictionary<PathfindingChunk, HashSet<PathfindingRegion>>> _regions =
|
||||
private readonly Dictionary<GridId, Dictionary<PathfindingChunk, HashSet<PathfindingRegion>>> _regions =
|
||||
new Dictionary<GridId, Dictionary<PathfindingChunk, HashSet<PathfindingRegion>>>();
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Accessible
|
||||
|
||||
// Also, didn't use a dictionary because there didn't seem to be a clean way to do the lookup
|
||||
// Plus this way we can check if everything is equal except for vision so an entity with a lower vision radius can use an entity with a higher vision radius' cached result
|
||||
private Dictionary<ReachableArgs, Dictionary<PathfindingRegion, (TimeSpan CacheTime, HashSet<PathfindingRegion> Regions)>> _cachedAccessible =
|
||||
private readonly Dictionary<ReachableArgs, Dictionary<PathfindingRegion, (TimeSpan CacheTime, HashSet<PathfindingRegion> Regions)>> _cachedAccessible =
|
||||
new Dictionary<ReachableArgs, Dictionary<PathfindingRegion, (TimeSpan, HashSet<PathfindingRegion>)>>();
|
||||
|
||||
private readonly List<PathfindingRegion> _queuedCacheDeletions = new List<PathfindingRegion>();
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders
|
||||
public static event Action<SharedAiDebug.AStarRouteDebug> DebugRoute;
|
||||
#endif
|
||||
|
||||
private PathfindingNode _startNode;
|
||||
private readonly PathfindingNode _startNode;
|
||||
private PathfindingNode _endNode;
|
||||
private PathfindingArgs _pathfindingArgs;
|
||||
private readonly PathfindingArgs _pathfindingArgs;
|
||||
|
||||
public AStarPathfindingJob(
|
||||
double maxTime,
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding.Pathfinders
|
||||
public static event Action<SharedAiDebug.JpsRouteDebug> DebugRoute;
|
||||
#endif
|
||||
|
||||
private PathfindingNode _startNode;
|
||||
private readonly PathfindingNode _startNode;
|
||||
private PathfindingNode _endNode;
|
||||
private PathfindingArgs _pathfindingArgs;
|
||||
private readonly PathfindingArgs _pathfindingArgs;
|
||||
|
||||
public JpsPathfindingJob(double maxTime,
|
||||
PathfindingNode startNode,
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
||||
// Nodes per chunk row
|
||||
public static int ChunkSize => 8;
|
||||
public PathfindingNode[,] Nodes => _nodes;
|
||||
private PathfindingNode[,] _nodes = new PathfindingNode[ChunkSize,ChunkSize];
|
||||
private readonly PathfindingNode[,] _nodes = new PathfindingNode[ChunkSize,ChunkSize];
|
||||
|
||||
public PathfindingChunk(GridId gridId, Vector2i indices)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
||||
public MapCoordinates TargetMap => _target.Transform.MapPosition;
|
||||
public EntityCoordinates TargetGrid => _target.Transform.Coordinates;
|
||||
public IEntity Target => _target;
|
||||
private IEntity _target;
|
||||
private readonly IEntity _target;
|
||||
|
||||
/// <inheritdoc />
|
||||
public float ArrivalDistance { get; }
|
||||
|
||||
Reference in New Issue
Block a user