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:
@@ -18,12 +18,12 @@ namespace Content.Shared.GameObjects.Components.Body.Mechanism
|
||||
{
|
||||
public override string Name => "Mechanism";
|
||||
|
||||
protected readonly Dictionary<int, object> OptionsCache = new Dictionary<int, object>();
|
||||
protected readonly Dictionary<int, object> OptionsCache = new();
|
||||
protected IBody? BodyCache;
|
||||
protected int IdHash;
|
||||
protected IEntity? PerformerCache;
|
||||
private IBodyPart? _part;
|
||||
private readonly Dictionary<Type, IMechanismBehavior> _behaviors = new Dictionary<Type, IMechanismBehavior>();
|
||||
private readonly Dictionary<Type, IMechanismBehavior> _behaviors = new();
|
||||
|
||||
public IBody? Body => Part?.Body;
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
private IBody? _body;
|
||||
|
||||
// TODO BODY Remove
|
||||
private List<string> _mechanismIds = new List<string>();
|
||||
private List<string> _mechanismIds = new();
|
||||
public IReadOnlyList<string> MechanismIds => _mechanismIds;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<IMechanism> _mechanisms = new HashSet<IMechanism>();
|
||||
private readonly HashSet<IMechanism> _mechanisms = new();
|
||||
|
||||
[ViewVariables]
|
||||
public IBody? Body
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.Components.Body.Preset
|
||||
|
||||
[ViewVariables] public string Name => _name;
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> PartIDs => new Dictionary<string, string>(_partIDs);
|
||||
[ViewVariables] public Dictionary<string, string> PartIDs => new(_partIDs);
|
||||
|
||||
public virtual void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -32,19 +32,19 @@ namespace Content.Shared.GameObjects.Components.Body
|
||||
|
||||
private string? _centerSlot;
|
||||
|
||||
private Dictionary<string, string> _partIds = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> _partIds = new();
|
||||
|
||||
private readonly Dictionary<string, IBodyPart> _parts = new Dictionary<string, IBodyPart>();
|
||||
private readonly Dictionary<string, IBodyPart> _parts = new();
|
||||
|
||||
[ViewVariables] public string? TemplateName { get; private set; }
|
||||
|
||||
[ViewVariables] public string? PresetName { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, BodyPartType> Slots { get; private set; } = new Dictionary<string, BodyPartType>();
|
||||
public Dictionary<string, BodyPartType> Slots { get; private set; } = new();
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, List<string>> Connections { get; private set; } = new Dictionary<string, List<string>>();
|
||||
public Dictionary<string, List<string>> Connections { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Maps slots to the part filling each one.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Shared.GameObjects.Components.Body.Surgery
|
||||
{
|
||||
public override string Name => "BiologicalSurgeryData";
|
||||
|
||||
private readonly List<IMechanism> _disconnectedOrgans = new List<IMechanism>();
|
||||
private readonly List<IMechanism> _disconnectedOrgans = new();
|
||||
|
||||
private bool _skinOpened;
|
||||
private bool _skinRetracted;
|
||||
|
||||
@@ -30,15 +30,15 @@ namespace Content.Shared.GameObjects.Components.Body.Template
|
||||
|
||||
[ViewVariables] public string CenterSlot => _centerSlot;
|
||||
|
||||
[ViewVariables] public Dictionary<string, BodyPartType> Slots => new Dictionary<string, BodyPartType>(_slots);
|
||||
[ViewVariables] public Dictionary<string, BodyPartType> Slots => new(_slots);
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, List<string>> Connections =>
|
||||
_connections.ToDictionary(x => x.Key, x => x.Value.ToList());
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> Layers => new Dictionary<string, string>(_layers);
|
||||
[ViewVariables] public Dictionary<string, string> Layers => new(_layers);
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> MechanismLayers => new Dictionary<string, string>(_mechanismLayers);
|
||||
[ViewVariables] public Dictionary<string, string> MechanismLayers => new(_mechanismLayers);
|
||||
|
||||
public virtual void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user