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:
@@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<Node> Nodes => _nodes;
|
||||
private List<Node> _nodes = new List<Node>();
|
||||
private List<Node> _nodes = new();
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
|
||||
public AMEControllerComponent MasterController => _masterController;
|
||||
|
||||
private readonly List<AMEShieldComponent> _cores = new List<AMEShieldComponent>();
|
||||
private readonly List<AMEShieldComponent> _cores = new();
|
||||
|
||||
public int CoreCount => _cores.Count;
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
public class ApcNetNodeGroup : BaseNetConnectorNodeGroup<BaseApcNetComponent, IApcNet>, IApcNet
|
||||
{
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<ApcComponent, BatteryComponent> _apcBatteries = new Dictionary<ApcComponent, BatteryComponent>();
|
||||
private readonly Dictionary<ApcComponent, BatteryComponent> _apcBatteries = new();
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<PowerProviderComponent, List<PowerReceiverComponent>> _providerReceivers = new Dictionary<PowerProviderComponent, List<PowerReceiverComponent>>();
|
||||
private readonly Dictionary<PowerProviderComponent, List<PowerReceiverComponent>> _providerReceivers = new();
|
||||
|
||||
//Debug property
|
||||
[ViewVariables]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
{
|
||||
public abstract class BaseNetConnectorNodeGroup<TNetConnector, TNetType> : BaseNodeGroup where TNetConnector : BaseNetConnectorComponent<TNetType>
|
||||
{
|
||||
private readonly Dictionary<Node, List<TNetConnector>> _netConnectorComponents = new Dictionary<Node, List<TNetConnector>>();
|
||||
private readonly Dictionary<Node, List<TNetConnector>> _netConnectorComponents = new();
|
||||
|
||||
protected override void OnAddNode(Node node)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
{
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<Node> Nodes => _nodes;
|
||||
private readonly List<Node> _nodes = new List<Node>();
|
||||
private readonly List<Node> _nodes = new();
|
||||
|
||||
[ViewVariables]
|
||||
public int NodeCount => Nodes.Count;
|
||||
@@ -104,7 +104,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
private class NullNodeGroup : INodeGroup
|
||||
{
|
||||
public IReadOnlyList<Node> Nodes => _nodes;
|
||||
private readonly List<Node> _nodes = new List<Node>();
|
||||
private readonly List<Node> _nodes = new();
|
||||
public void Initialize(Node sourceNode) { }
|
||||
public void AddNode(Node node) { }
|
||||
public void CombineGroup(INodeGroup newGroup) { }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
|
||||
public class NodeGroupManager : INodeGroupManager
|
||||
{
|
||||
private readonly HashSet<INodeGroup> _dirtyNodeGroups = new HashSet<INodeGroup>();
|
||||
private readonly HashSet<INodeGroup> _dirtyNodeGroups = new();
|
||||
|
||||
public void AddDirtyNodeGroup(INodeGroup nodeGroup)
|
||||
{
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
public class PipeNet : BaseNodeGroup, IPipeNet
|
||||
{
|
||||
[ViewVariables]
|
||||
public GasMixture Air { get; set; } = new GasMixture();
|
||||
public GasMixture Air { get; set; } = new();
|
||||
|
||||
public static readonly IPipeNet NullNet = new NullPipeNet();
|
||||
|
||||
[ViewVariables]
|
||||
private readonly List<PipeNode> _pipes = new List<PipeNode>();
|
||||
private readonly List<PipeNode> _pipes = new();
|
||||
|
||||
[ViewVariables] private AtmosphereSystem _atmosphereSystem;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
|
||||
private class NullPipeNet : IPipeNet
|
||||
{
|
||||
GasMixture IGasMixtureHolder.Air { get; set; } = new GasMixture();
|
||||
GasMixture IGasMixtureHolder.Air { get; set; } = new();
|
||||
public void Update() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
||||
[Dependency] private readonly IDynamicTypeFactory _typeFactory = default!;
|
||||
|
||||
private readonly Dictionary<NodeGroupID, Type> _groupTypes = new Dictionary<NodeGroupID, Type>();
|
||||
private readonly Dictionary<NodeGroupID, Type> _groupTypes = new();
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
@@ -32,16 +32,16 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
[Dependency] private readonly IPowerNetManager _powerNetManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly List<PowerSupplierComponent> _suppliers = new List<PowerSupplierComponent>();
|
||||
private readonly List<PowerSupplierComponent> _suppliers = new();
|
||||
|
||||
[ViewVariables]
|
||||
private int _totalSupply = 0;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<Priority, List<PowerConsumerComponent>> _consumersByPriority = new Dictionary<Priority, List<PowerConsumerComponent>>();
|
||||
private readonly Dictionary<Priority, List<PowerConsumerComponent>> _consumersByPriority = new();
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<Priority, int> _drawByPriority = new Dictionary<Priority, int>();
|
||||
private readonly Dictionary<Priority, int> _drawByPriority = new();
|
||||
|
||||
public static readonly IPowerNet NullNet = new NullPowerNet();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user