Use 'new' expression in places where the type is evident for content (#2590)

* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2020-11-27 11:00:49 +01:00
committed by GitHub
parent 4a56df749b
commit 5c0cf1b1a0
235 changed files with 431 additions and 433 deletions

View File

@@ -52,37 +52,37 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
// agent's steering. Should help a lot given this is the most expensive operator by far.
// The AI will keep moving, it's just it'll keep moving in its existing direction.
// If we change to 20/30 TPS you might want to change this but for now it's fine
private readonly List<Dictionary<IEntity, IAiSteeringRequest>> _agentLists = new List<Dictionary<IEntity, IAiSteeringRequest>>(AgentListCount);
private readonly List<Dictionary<IEntity, IAiSteeringRequest>> _agentLists = new(AgentListCount);
private const int AgentListCount = 2;
private int _listIndex;
// Cache nextGrid
private readonly Dictionary<IEntity, EntityCoordinates> _nextGrid = new Dictionary<IEntity, EntityCoordinates>();
private readonly Dictionary<IEntity, EntityCoordinates> _nextGrid = new();
/// <summary>
/// Current live paths for AI
/// </summary>
private readonly Dictionary<IEntity, Queue<TileRef>> _paths = new Dictionary<IEntity, Queue<TileRef>>();
private readonly Dictionary<IEntity, Queue<TileRef>> _paths = new();
/// <summary>
/// Pathfinding request jobs we're waiting on
/// </summary>
private readonly Dictionary<IEntity, (CancellationTokenSource CancelToken, Job<Queue<TileRef>> Job)> _pathfindingRequests =
new Dictionary<IEntity, (CancellationTokenSource, Job<Queue<TileRef>>)>();
new();
/// <summary>
/// Keep track of how long we've been in 1 position and re-path if it's been too long
/// </summary>
private readonly Dictionary<IEntity, int> _stuckCounter = new Dictionary<IEntity, int>();
private readonly Dictionary<IEntity, int> _stuckCounter = new();
/// <summary>
/// Get a fixed position for the target entity; if they move then re-path
/// </summary>
private readonly Dictionary<IEntity, EntityCoordinates> _entityTargetPosition = new Dictionary<IEntity, EntityCoordinates>();
private readonly Dictionary<IEntity, EntityCoordinates> _entityTargetPosition = new();
// Anti-Stuck
// Given the collision avoidance can lead to twitching need to store a reference position and check if we've been near this too long
private readonly Dictionary<IEntity, EntityCoordinates> _stuckPositions = new Dictionary<IEntity, EntityCoordinates>();
private readonly Dictionary<IEntity, EntityCoordinates> _stuckPositions = new();
public override void Initialize()
{