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

@@ -19,7 +19,7 @@ namespace Content.Client.GameObjects.EntitySystems.AI
[Dependency] private readonly IEyeManager _eyeManager = default!;
private AiDebugMode _tooltips = AiDebugMode.None;
private readonly Dictionary<IEntity, PanelContainer> _aiBoxes = new Dictionary<IEntity,PanelContainer>();
private readonly Dictionary<IEntity, PanelContainer> _aiBoxes = new();
public override void Update(float frameTime)
{

View File

@@ -179,27 +179,27 @@ namespace Content.Client.GameObjects.EntitySystems.AI
public PathfindingDebugMode Modes { get; set; } = PathfindingDebugMode.None;
// Graph debugging
public readonly Dictionary<int, List<Vector2>> Graph = new Dictionary<int, List<Vector2>>();
private readonly Dictionary<int, Color> _graphColors = new Dictionary<int, Color>();
public readonly Dictionary<int, List<Vector2>> Graph = new();
private readonly Dictionary<int, Color> _graphColors = new();
// Cached regions
public readonly Dictionary<GridId, Dictionary<int, List<Vector2>>> CachedRegions =
new Dictionary<GridId, Dictionary<int, List<Vector2>>>();
new();
private readonly Dictionary<GridId, Dictionary<int, Color>> _cachedRegionColors =
new Dictionary<GridId, Dictionary<int, Color>>();
new();
// Regions
public readonly Dictionary<GridId, Dictionary<int, Dictionary<int, List<Vector2>>>> Regions =
new Dictionary<GridId, Dictionary<int, Dictionary<int, List<Vector2>>>>();
new();
private readonly Dictionary<GridId, Dictionary<int, Dictionary<int, Color>>> _regionColors =
new Dictionary<GridId, Dictionary<int, Dictionary<int, Color>>>();
new();
// Route debugging
// As each pathfinder is very different you'll likely want to draw them completely different
public readonly List<SharedAiDebug.AStarRouteMessage> AStarRoutes = new List<SharedAiDebug.AStarRouteMessage>();
public readonly List<SharedAiDebug.JpsRouteMessage> JpsRoutes = new List<SharedAiDebug.JpsRouteMessage>();
public readonly List<SharedAiDebug.AStarRouteMessage> AStarRoutes = new();
public readonly List<SharedAiDebug.JpsRouteMessage> JpsRoutes = new();
public DebugPathfindingOverlay() : base(nameof(DebugPathfindingOverlay))
{

View File

@@ -18,7 +18,7 @@ namespace Content.Client.GameObjects.EntitySystems
[Dependency] private readonly IMapManager _mapManager = default!;
private readonly Dictionary<GridId, AtmosDebugOverlayMessage> _tileData =
new Dictionary<GridId, AtmosDebugOverlayMessage>();
new();
public override void Initialize()
{

View File

@@ -29,7 +29,7 @@ namespace Content.Client.GameObjects.EntitySystems
[Dependency] private readonly IPlayerManager _playerManager = default!;
private int _nextId;
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new Dictionary<int, ConstructionGhostComponent>();
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new();
private ConstructionMenu _constructionMenu;
/// <inheritdoc />

View File

@@ -21,11 +21,11 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
private readonly Dictionary<byte, PanelContainer> _doAfterControls = new Dictionary<byte, PanelContainer>();
private readonly Dictionary<byte, DoAfterBar> _doAfterBars = new Dictionary<byte, DoAfterBar>();
private readonly Dictionary<byte, PanelContainer> _doAfterControls = new();
private readonly Dictionary<byte, DoAfterBar> _doAfterBars = new();
// We'll store cancellations for a little bit just so we can flash the graphic to indicate it's cancelled
private readonly Dictionary<byte, TimeSpan> _cancelledDoAfters = new Dictionary<byte, TimeSpan>();
private readonly Dictionary<byte, TimeSpan> _cancelledDoAfters = new();
public IEntity? AttachedEntity { get; set; }
private ScreenCoordinates _playerPosition;

View File

@@ -35,7 +35,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
// Each component in range will have its own vBox which we need to keep track of so if they go out of range or
// come into range it needs altering
private readonly HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>();
private readonly HashSet<DoAfterComponent> _knownComponents = new();
private IEntity? _attachedEntity;

View File

@@ -51,7 +51,7 @@ namespace Content.Client.GameObjects.EntitySystems
// entity performing the drag action
private IEntity _dragger;
private IEntity _draggedEntity;
private readonly List<IDraggable> _draggables = new List<IDraggable>();
private readonly List<IDraggable> _draggables = new();
private IEntity _dragShadow;
private DragState _state;
// time since mouse down over the dragged entity
@@ -71,7 +71,7 @@ namespace Content.Client.GameObjects.EntitySystems
private SharedInteractionSystem _interactionSystem;
private InputSystem _inputSystem;
private readonly List<SpriteComponent> _highlightedSprites = new List<SpriteComponent>();
private readonly List<SpriteComponent> _highlightedSprites = new();
private enum DragState
{

View File

@@ -24,7 +24,7 @@ namespace Content.Client.GameObjects.EntitySystems
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
private readonly Dictionary<float, Color> _fireCache = new Dictionary<float, Color>();
private readonly Dictionary<float, Color> _fireCache = new();
// Gas overlays
private readonly float[] _timer = new float[Atmospherics.TotalNumberOfGases];
@@ -42,7 +42,7 @@ namespace Content.Client.GameObjects.EntitySystems
private readonly Texture[][] _fireFrames = new Texture[FireStates][];
private readonly Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>> _tileData =
new Dictionary<GridId, Dictionary<Vector2i, GasOverlayChunk>>();
new();
private AtmosphereSystem _atmosphereSystem = default!;

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.EntitySystems
{
[Dependency] private readonly IMapManager _mapManager = default!;
private readonly Queue<IEntity> _dirtyEntities = new Queue<IEntity>();
private readonly Queue<IEntity> _dirtyEntities = new();
private int _generation;

View File

@@ -10,7 +10,7 @@ namespace Content.Client.GameObjects.EntitySystems
[UsedImplicitly]
public sealed class WindowSystem : EntitySystem
{
private readonly Queue<IEntity> _dirtyEntities = new Queue<IEntity>();
private readonly Queue<IEntity> _dirtyEntities = new();
public override void Initialize()
{