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

@@ -105,7 +105,7 @@ namespace Content.Benchmarks
[MethodImpl(AggressiveOpt)] [MethodImpl(AggressiveOpt)]
public static Color InterpolateSimple(Color a, Color b, float lambda) public static Color InterpolateSimple(Color a, Color b, float lambda)
{ {
return new Color( return new(
a.R + (b.R - a.R) * lambda, a.R + (b.R - a.R) * lambda,
a.G + (b.G - a.G) * lambda, a.G + (b.G - a.G) * lambda,
a.B + (b.G - a.B) * lambda, a.B + (b.G - a.B) * lambda,

View File

@@ -11,14 +11,14 @@ namespace Content.Benchmarks
[Params(5000)] public int NEnt { get; set; } [Params(5000)] public int NEnt { get; set; }
private readonly Dictionary<(EntityUid, Type), BComponent> private readonly Dictionary<(EntityUid, Type), BComponent>
_componentsFlat = new Dictionary<(EntityUid, Type), BComponent>(); _componentsFlat = new();
private readonly Dictionary<Type, Dictionary<EntityUid, BComponent>> _componentsPart = private readonly Dictionary<Type, Dictionary<EntityUid, BComponent>> _componentsPart =
new Dictionary<Type, Dictionary<EntityUid, BComponent>>(); new();
private UniqueIndex<Type, BComponent> _allComponents = new UniqueIndex<Type, BComponent>(); private UniqueIndex<Type, BComponent> _allComponents = new();
private readonly List<EntityUid> _lookupEntities = new List<EntityUid>(); private readonly List<EntityUid> _lookupEntities = new();
[GlobalSetup] [GlobalSetup]
public void Setup() public void Setup()

View File

@@ -13,7 +13,7 @@ namespace Content.Benchmarks
{ {
public class ComponentManagerGetAllComponents public class ComponentManagerGetAllComponents
{ {
private readonly List<IEntity> _entities = new List<IEntity>(); private readonly List<IEntity> _entities = new();
private IComponentManager _componentManager; private IComponentManager _componentManager;

View File

@@ -11,10 +11,10 @@ namespace Content.Benchmarks
{ {
((Box2) default).Enlarged(1), //2x2 square ((Box2) default).Enlarged(1), //2x2 square
((Box2) default).Enlarged(2), //4x4 square ((Box2) default).Enlarged(2), //4x4 square
new Box2(-3, 3, -3, 3), // point off to the bottom left new(-3, 3, -3, 3), // point off to the bottom left
new Box2(-3, -3, -3, -3), // point off to the top left new(-3, -3, -3, -3), // point off to the top left
new Box2(3, 3, 3, 3), // point off to the bottom right new(3, 3, 3, 3), // point off to the bottom right
new Box2(3, -3, 3, -3), // point off to the top right new(3, -3, 3, -3), // point off to the top right
((Box2) default).Enlarged(1), //2x2 square ((Box2) default).Enlarged(1), //2x2 square
((Box2) default).Enlarged(2), //4x4 square ((Box2) default).Enlarged(2), //4x4 square
((Box2) default).Enlarged(1), //2x2 square ((Box2) default).Enlarged(1), //2x2 square
@@ -24,10 +24,10 @@ namespace Content.Benchmarks
((Box2) default).Enlarged(1), //2x2 square ((Box2) default).Enlarged(1), //2x2 square
((Box2) default).Enlarged(2), //4x4 square ((Box2) default).Enlarged(2), //4x4 square
((Box2) default).Enlarged(3), //6x6 square ((Box2) default).Enlarged(3), //6x6 square
new Box2(-3, 3, -3, 3), // point off to the bottom left new(-3, 3, -3, 3), // point off to the bottom left
new Box2(-3, -3, -3, -3), // point off to the top left new(-3, -3, -3, -3), // point off to the top left
new Box2(3, 3, 3, 3), // point off to the bottom right new(3, 3, 3, 3), // point off to the bottom right
new Box2(3, -3, 3, -3), // point off to the top right new(3, -3, 3, -3), // point off to the top right
}; };
private B2DynamicTree<int> _b2Tree; private B2DynamicTree<int> _b2Tree;

View File

@@ -12,8 +12,8 @@ namespace Content.Benchmarks
public int M { get; set; } = 10; public int M { get; set; } = 10;
private readonly DictEntityStorage _dictStorage = new DictEntityStorage(); private readonly DictEntityStorage _dictStorage = new();
private readonly GenEntityStorage _genStorage = new GenEntityStorage(); private readonly GenEntityStorage _genStorage = new();
private IEntityStorage<DictEntity, DictEntityUid> _dictStorageInterface; private IEntityStorage<DictEntity, DictEntityUid> _dictStorageInterface;
private IEntityStorage<GenEntity, GenEntityUid> _genStorageInterface; private IEntityStorage<GenEntity, GenEntityUid> _genStorageInterface;
@@ -146,7 +146,7 @@ namespace Content.Benchmarks
{ {
private int _nextValue; private int _nextValue;
private readonly Dictionary<DictEntityUid, DictEntity> _dict = new Dictionary<DictEntityUid, DictEntity>(); private readonly Dictionary<DictEntityUid, DictEntity> _dict = new();
public override bool TryGetEntity(DictEntityUid entityUid, out DictEntity entity) public override bool TryGetEntity(DictEntityUid entityUid, out DictEntity entity)
{ {
@@ -198,7 +198,7 @@ namespace Content.Benchmarks
private sealed class GenEntityStorage : EntityStorage<GenEntity, GenEntityUid> private sealed class GenEntityStorage : EntityStorage<GenEntity, GenEntityUid>
{ {
private (int generation, GenEntity entity)[] _entities = new (int, GenEntity)[1]; private (int generation, GenEntity entity)[] _entities = new (int, GenEntity)[1];
private readonly List<int> _availableSlots = new List<int> {0}; private readonly List<int> _availableSlots = new() {0};
public override bool TryGetEntity(GenEntityUid entityUid, out GenEntity entity) public override bool TryGetEntity(GenEntityUid entityUid, out GenEntity entity)
{ {

View File

@@ -23,8 +23,8 @@ namespace Content.Benchmarks
[Params(8, 64, 256, 1024)] [Params(8, 64, 256, 1024)]
public int StringLength { get; set; } public int StringLength { get; set; }
private readonly MemoryStream _outputStream = new MemoryStream(2048); private readonly MemoryStream _outputStream = new(2048);
private readonly MemoryStream _inputStream = new MemoryStream(2048); private readonly MemoryStream _inputStream = new(2048);
[GlobalSetup] [GlobalSetup]
public void Setup() public void Setup()

View File

@@ -17,7 +17,7 @@ namespace Content.Client.Administration
[Dependency] private readonly IClientConGroupController _conGroup = default!; [Dependency] private readonly IClientConGroupController _conGroup = default!;
private AdminData? _adminData; private AdminData? _adminData;
private readonly HashSet<string> _availableCommands = new HashSet<string>(); private readonly HashSet<string> _availableCommands = new();
public event Action? AdminStatusUpdated; public event Action? AdminStatusUpdated;

View File

@@ -18,10 +18,10 @@ namespace Content.Client.Arcade
{ {
public class BlockGameMenu : SS14Window public class BlockGameMenu : SS14Window
{ {
private static readonly Color OverlayBackgroundColor = new Color(74,74,81,180); private static readonly Color OverlayBackgroundColor = new(74,74,81,180);
private static readonly Color OverlayShadowColor = new Color(0,0,0,83); private static readonly Color OverlayShadowColor = new(0,0,0,83);
private static readonly Vector2 BlockSize = new Vector2(15,15); private static readonly Vector2 BlockSize = new(15,15);
private readonly BlockGameBoundUserInterface _owner; private readonly BlockGameBoundUserInterface _owner;

View File

@@ -61,7 +61,7 @@ namespace Content.Client.Chat
private const char MeAlias = '@'; private const char MeAlias = '@';
private const char AdminChatAlias = ']'; private const char AdminChatAlias = ']';
private readonly List<StoredChatMessage> filteredHistory = new List<StoredChatMessage>(); private readonly List<StoredChatMessage> filteredHistory = new();
// Filter Button States // Filter Button States
private bool _allState; private bool _allState;
@@ -88,13 +88,13 @@ namespace Content.Client.Chat
/// We track them to push them up when new ones get added. /// We track them to push them up when new ones get added.
/// </summary> /// </summary>
private readonly Dictionary<EntityUid, List<SpeechBubble>> _activeSpeechBubbles = private readonly Dictionary<EntityUid, List<SpeechBubble>> _activeSpeechBubbles =
new Dictionary<EntityUid, List<SpeechBubble>>(); new();
/// <summary> /// <summary>
/// Speech bubbles that are to-be-sent because of the "rate limit" they have. /// Speech bubbles that are to-be-sent because of the "rate limit" they have.
/// </summary> /// </summary>
private readonly Dictionary<EntityUid, SpeechBubbleQueueData> _queuedSpeechBubbles private readonly Dictionary<EntityUid, SpeechBubbleQueueData> _queuedSpeechBubbles
= new Dictionary<EntityUid, SpeechBubbleQueueData>(); = new();
public void Initialize() public void Initialize()
{ {
@@ -532,7 +532,7 @@ namespace Content.Client.Chat
/// </summary> /// </summary>
public float TimeLeft { get; set; } public float TimeLeft { get; set; }
public Queue<SpeechBubbleData> MessageQueue { get; } = new Queue<SpeechBubbleData>(); public Queue<SpeechBubbleData> MessageQueue { get; } = new();
} }
} }
} }

View File

@@ -22,10 +22,10 @@ namespace Content.Client
[Dependency] private readonly IResourceCache _resourceCache = default!; [Dependency] private readonly IResourceCache _resourceCache = default!;
[ViewVariables] [ViewVariables]
private readonly Dictionary<Texture, ClickMap> _textureMaps = new Dictionary<Texture, ClickMap>(); private readonly Dictionary<Texture, ClickMap> _textureMaps = new();
[ViewVariables] private readonly Dictionary<RSI, RsiClickMapData> _rsiMaps = [ViewVariables] private readonly Dictionary<RSI, RsiClickMapData> _rsiMaps =
new Dictionary<RSI, RsiClickMapData>(); new();
public void PostInject() public void PostInject()
{ {

View File

@@ -29,7 +29,7 @@ namespace Content.Client
[Dependency] private readonly IClientNetManager _netManager = default!; [Dependency] private readonly IClientNetManager _netManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!; [Dependency] private readonly IEntityManager _entityManager = default!;
private readonly List<PopupLabel> _aliveLabels = new List<PopupLabel>(); private readonly List<PopupLabel> _aliveLabels = new();
private bool _initialized; private bool _initialized;
public void Initialize() public void Initialize()

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Command
protected override Vector2? CustomSize => new Vector2(600, 400); protected override Vector2? CustomSize => new Vector2(600, 400);
private CommunicationsConsoleBoundUserInterface Owner { get; set; } private CommunicationsConsoleBoundUserInterface Owner { get; set; }
private readonly CancellationTokenSource _timerCancelTokenSource = new CancellationTokenSource(); private readonly CancellationTokenSource _timerCancelTokenSource = new();
private readonly Button _emergencyShuttleButton; private readonly Button _emergencyShuttleButton;
private readonly RichTextLabel _countdownLabel; private readonly RichTextLabel _countdownLabel;

View File

@@ -143,7 +143,7 @@ namespace Content.Client.Construction
private static ItemList.Item GetItem(ConstructionPrototype recipe, ItemList itemList) private static ItemList.Item GetItem(ConstructionPrototype recipe, ItemList itemList)
{ {
return new ItemList.Item(itemList) return new(itemList)
{ {
Metadata = recipe, Metadata = recipe,
Text = recipe.Name, Text = recipe.Name,

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Eui
[Dependency] private readonly IReflectionManager _refl = default!; [Dependency] private readonly IReflectionManager _refl = default!;
[Dependency] private readonly IDynamicTypeFactory _dtf = default!; [Dependency] private readonly IDynamicTypeFactory _dtf = default!;
private readonly Dictionary<uint, EuiData> _openUis = new Dictionary<uint, EuiData>(); private readonly Dictionary<uint, EuiData> _openUis = new();
public void Initialize() public void Initialize()
{ {

View File

@@ -29,7 +29,7 @@ namespace Content.Client.GameObjects.Components.Access
private readonly IdCardConsoleBoundUserInterface _owner; private readonly IdCardConsoleBoundUserInterface _owner;
private readonly Dictionary<string, Button> _accessButtons = new Dictionary<string, Button>(); private readonly Dictionary<string, Button> _accessButtons = new();
private string _lastFullName; private string _lastFullName;
private string _lastJobTitle; private string _lastJobTitle;

View File

@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Cargo
[RegisterComponent] [RegisterComponent]
public class CargoOrderDatabaseComponent : SharedCargoOrderDatabaseComponent public class CargoOrderDatabaseComponent : SharedCargoOrderDatabaseComponent
{ {
private readonly List<CargoOrderData> _orders = new List<CargoOrderData>(); private readonly List<CargoOrderData> _orders = new();
public IReadOnlyList<CargoOrderData> Orders => _orders; public IReadOnlyList<CargoOrderData> Orders => _orders;
/// <summary> /// <summary>

View File

@@ -130,7 +130,7 @@ namespace Content.Client.GameObjects.Components
[ViewVariables] public Box2 East; [ViewVariables] public Box2 East;
[ViewVariables] public Box2 West; [ViewVariables] public Box2 West;
public static DirBoundData Default { get; } = new DirBoundData(); public static DirBoundData Default { get; } = new();
public void ExposeData(ObjectSerializer serializer) public void ExposeData(ObjectSerializer serializer)
{ {

View File

@@ -33,7 +33,7 @@ namespace Content.Client.GameObjects.Components.CloningPod
private CloningPodBoundUserInterfaceState _lastUpdate = null!; private CloningPodBoundUserInterfaceState _lastUpdate = null!;
// List of scans that are visible based on current filter criteria. // List of scans that are visible based on current filter criteria.
private readonly Dictionary<int, string> _filteredScans = new Dictionary<int, string>(); private readonly Dictionary<int, string> _filteredScans = new();
// The indices of the visible scans last time UpdateVisibleScans was ran. // The indices of the visible scans last time UpdateVisibleScans was ran.
// This is inclusive, so end is the index of the last scan, not right after it. // This is inclusive, so end is the index of the last scan, not right after it.

View File

@@ -17,10 +17,9 @@ namespace Content.Client.GameObjects.Components
public override string Name => "DoAfter"; public override string Name => "DoAfter";
public IReadOnlyDictionary<byte, ClientDoAfter> DoAfters => _doAfters; public IReadOnlyDictionary<byte, ClientDoAfter> DoAfters => _doAfters;
private readonly Dictionary<byte, ClientDoAfter> _doAfters = new Dictionary<byte, ClientDoAfter>(); private readonly Dictionary<byte, ClientDoAfter> _doAfters = new();
public readonly List<(TimeSpan CancelTime, ClientDoAfter Message)> CancelledDoAfters = public readonly List<(TimeSpan CancelTime, ClientDoAfter Message)> CancelledDoAfters = new();
new List<(TimeSpan CancelTime, ClientDoAfter Message)>();
public DoAfterGui? Gui { get; set; } public DoAfterGui? Gui { get; set; }

View File

@@ -12,7 +12,7 @@ namespace Content.Client.GameObjects.Components
[UsedImplicitly] [UsedImplicitly]
public class FlashLightVisualizer : AppearanceVisualizer public class FlashLightVisualizer : AppearanceVisualizer
{ {
private readonly Animation _radiatingLightAnimation = new Animation private readonly Animation _radiatingLightAnimation = new()
{ {
Length = TimeSpan.FromSeconds(1), Length = TimeSpan.FromSeconds(1),
AnimationTracks = AnimationTracks =
@@ -32,7 +32,7 @@ namespace Content.Client.GameObjects.Components
} }
}; };
private readonly Animation _blinkingLightAnimation = new Animation private readonly Animation _blinkingLightAnimation = new()
{ {
Length = TimeSpan.FromSeconds(1), Length = TimeSpan.FromSeconds(1),
AnimationTracks = AnimationTracks =

View File

@@ -11,7 +11,7 @@ namespace Content.Client.GameObjects.Components.Gravity
{ {
public class GravityGeneratorVisualizer : AppearanceVisualizer public class GravityGeneratorVisualizer : AppearanceVisualizer
{ {
private readonly Dictionary<GravityGeneratorStatus, string> _spriteMap = new Dictionary<GravityGeneratorStatus, string>(); private readonly Dictionary<GravityGeneratorStatus, string> _spriteMap = new();
public override void InitializeEntity(IEntity entity) public override void InitializeEntity(IEntity entity)
{ {

View File

@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
[RegisterComponent] [RegisterComponent]
public class ClientInventoryComponent : SharedInventoryComponent public class ClientInventoryComponent : SharedInventoryComponent
{ {
private readonly Dictionary<Slots, IEntity> _slots = new Dictionary<Slots, IEntity>(); private readonly Dictionary<Slots, IEntity> _slots = new();
[ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!; [ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!;

View File

@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!; [Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons private readonly Dictionary<Slots, List<ItemSlotButton>> _inventoryButtons
= new Dictionary<Slots, List<ItemSlotButton>>(); = new();
private ItemSlotButton _hudButtonPocket1; private ItemSlotButton _hudButtonPocket1;
private ItemSlotButton _hudButtonPocket2; private ItemSlotButton _hudButtonPocket2;

View File

@@ -42,12 +42,12 @@ namespace Content.Client.GameObjects.Components
private float _timer; private float _timer;
private static readonly StyleBoxFlat _styleBoxLit = new StyleBoxFlat private static readonly StyleBoxFlat _styleBoxLit = new()
{ {
BackgroundColor = Color.Green BackgroundColor = Color.Green
}; };
private static readonly StyleBoxFlat _styleBoxUnlit = new StyleBoxFlat private static readonly StyleBoxFlat _styleBoxUnlit = new()
{ {
BackgroundColor = Color.Black BackgroundColor = Color.Black
}; };

View File

@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Instruments
/// A queue of MidiEvents to be sent to the server. /// A queue of MidiEvents to be sent to the server.
/// </summary> /// </summary>
[ViewVariables] [ViewVariables]
private readonly List<MidiEvent> _midiEventBuffer = new List<MidiEvent>(); private readonly List<MidiEvent> _midiEventBuffer = new();
/// <summary> /// <summary>
/// Whether a midi song will loop or not. /// Whether a midi song will loop or not.

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Items
private HandsGui? _gui; private HandsGui? _gui;
private readonly List<Hand> _hands = new List<Hand>(); private readonly List<Hand> _hands = new();
[ViewVariables] public IReadOnlyList<Hand> Hands => _hands; [ViewVariables] public IReadOnlyList<Hand> Hands => _hands;

View File

@@ -26,8 +26,8 @@ namespace Content.Client.GameObjects.Components.Kitchen
private MicrowaveMenu _menu; private MicrowaveMenu _menu;
private readonly Dictionary<int, EntityUid> _solids = new Dictionary<int, EntityUid>(); private readonly Dictionary<int, EntityUid> _solids = new();
private readonly Dictionary<int, Solution.ReagentQuantity> _reagents =new Dictionary<int, Solution.ReagentQuantity>(); private readonly Dictionary<int, Solution.ReagentQuantity> _reagents =new();
public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey) public MicrowaveBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner,uiKey)
{ {

View File

@@ -11,7 +11,7 @@ namespace Content.Client.GameObjects.Components
[UsedImplicitly] [UsedImplicitly]
public class LanternVisualizer : AppearanceVisualizer public class LanternVisualizer : AppearanceVisualizer
{ {
private readonly Animation _radiatingLightAnimation = new Animation private readonly Animation _radiatingLightAnimation = new()
{ {
Length = TimeSpan.FromSeconds(5), Length = TimeSpan.FromSeconds(5),
AnimationTracks = AnimationTracks =

View File

@@ -361,7 +361,7 @@ namespace Content.Client.GameObjects.Components
} }
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
private readonly List<AnimationContainer> _animations = new List<AnimationContainer>(); private readonly List<AnimationContainer> _animations = new();
private float _originalRadius = default; private float _originalRadius = default;
private float _originalEnergy = default; private float _originalEnergy = default;

View File

@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Mobs
[ViewVariables] [ViewVariables]
private readonly Dictionary<AlertKey, AlertControl> _alertControls private readonly Dictionary<AlertKey, AlertControl> _alertControls
= new Dictionary<AlertKey, AlertControl>(); = new();
/// <summary> /// <summary>
/// Allows calculating if we need to act due to this component being controlled by the current mob /// Allows calculating if we need to act due to this component being controlled by the current mob

View File

@@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Mobs
/// <summary> /// <summary>
/// A list of overlay containers representing the current overlays applied /// A list of overlay containers representing the current overlays applied
/// </summary> /// </summary>
private List<OverlayContainer> _currentEffects = new List<OverlayContainer>(); private List<OverlayContainer> _currentEffects = new();
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]
public List<OverlayContainer> ActiveOverlays public List<OverlayContainer> ActiveOverlays

View File

@@ -14,7 +14,7 @@ namespace Content.Client.GameObjects.Components.Mobs
public sealed class DamageStateVisualizer : AppearanceVisualizer public sealed class DamageStateVisualizer : AppearanceVisualizer
{ {
private DamageState _data = DamageState.Alive; private DamageState _data = DamageState.Alive;
private readonly Dictionary<DamageState, string> _stateMap = new Dictionary<DamageState, string>(); private readonly Dictionary<DamageState, string> _stateMap = new();
private int? _originalDrawDepth; private int? _originalDrawDepth;
public override void LoadData(YamlMappingNode node) public override void LoadData(YamlMappingNode node)

View File

@@ -10,7 +10,7 @@ namespace Content.Client.GameObjects.Components.Mobs.State
[ComponentReference(typeof(SharedMobStateManagerComponent))] [ComponentReference(typeof(SharedMobStateManagerComponent))]
public class MobStateManagerComponent : SharedMobStateManagerComponent public class MobStateManagerComponent : SharedMobStateManagerComponent
{ {
private readonly Dictionary<DamageState, IMobState> _behavior = new Dictionary<DamageState, IMobState> private readonly Dictionary<DamageState, IMobState> _behavior = new()
{ {
{DamageState.Alive, new NormalState()}, {DamageState.Alive, new NormalState()},
{DamageState.Critical, new CriticalState()}, {DamageState.Critical, new CriticalState()},

View File

@@ -19,8 +19,8 @@ namespace Content.Client.GameObjects.Components.Observer
[Dependency] private readonly IGameHud _gameHud = default!; [Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IComponentManager _componentManager = default!; [Dependency] private readonly IComponentManager _componentManager = default!;
public List<string> WarpNames = new List<string>(); public List<string> WarpNames = new();
public Dictionary<EntityUid,string> PlayerNames = new Dictionary<EntityUid,string>(); public Dictionary<EntityUid,string> PlayerNames = new();
private GhostGui? _gui ; private GhostGui? _gui ;

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components
{ {
public class ParticleAcceleratorPartVisualizer : AppearanceVisualizer public class ParticleAcceleratorPartVisualizer : AppearanceVisualizer
{ {
private readonly Dictionary<ParticleAcceleratorVisualState, string> _states = new Dictionary<ParticleAcceleratorVisualState, string>(); private readonly Dictionary<ParticleAcceleratorVisualState, string> _states = new();
public override void LoadData(YamlMappingNode node) public override void LoadData(YamlMappingNode node)
{ {

View File

@@ -17,7 +17,7 @@ namespace Content.Client.GameObjects.Components.Power
[Dependency] private readonly IGameTiming _gameTiming = default; [Dependency] private readonly IGameTiming _gameTiming = default;
private SolarControlWindow _window; private SolarControlWindow _window;
private SolarControlConsoleBoundInterfaceState _lastState = new SolarControlConsoleBoundInterfaceState(0, 0, 0, 0); private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
protected override void Open() protected override void Open()
{ {
@@ -161,7 +161,7 @@ namespace Content.Client.GameObjects.Components.Power
// This makes the display feel a lot smoother. // This makes the display feel a lot smoother.
private IGameTiming _gameTiming; private IGameTiming _gameTiming;
private SolarControlConsoleBoundInterfaceState _lastState = new SolarControlConsoleBoundInterfaceState(0, 0, 0, 0); private SolarControlConsoleBoundInterfaceState _lastState = new(0, 0, 0, 0);
private TimeSpan _lastStateTime = TimeSpan.Zero; private TimeSpan _lastStateTime = TimeSpan.Zero;

View File

@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Research
[ViewVariables] [ViewVariables]
public Queue<LatheRecipePrototype> QueuedRecipes => _queuedRecipes; public Queue<LatheRecipePrototype> QueuedRecipes => _queuedRecipes;
private readonly Queue<LatheRecipePrototype> _queuedRecipes = new Queue<LatheRecipePrototype>(); private readonly Queue<LatheRecipePrototype> _queuedRecipes = new();
public LatheBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) public LatheBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{ {

View File

@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Research
[ComponentReference(typeof(SharedMaterialStorageComponent))] [ComponentReference(typeof(SharedMaterialStorageComponent))]
public class MaterialStorageComponent : SharedMaterialStorageComponent public class MaterialStorageComponent : SharedMaterialStorageComponent
{ {
protected override Dictionary<string, int> Storage { get; set; } = new Dictionary<string, int>(); protected override Dictionary<string, int> Storage { get; set; } = new();
public event Action OnMaterialStorageChanged; public event Action OnMaterialStorageChanged;

View File

@@ -21,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Sound
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new Dictionary<ScheduledSound, IPlayingAudioStream>(); private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new();
private AudioSystem _audioSystem; private AudioSystem _audioSystem;
public override void StopAllSounds() public override void StopAllSounds()

View File

@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects.Components.Storage
[RegisterComponent] [RegisterComponent]
public class ClientStorageComponent : SharedStorageComponent, IDraggable public class ClientStorageComponent : SharedStorageComponent, IDraggable
{ {
private List<IEntity> _storedEntities = new List<IEntity>(); private List<IEntity> _storedEntities = new();
private int StorageSizeUsed; private int StorageSizeUsed;
private int StorageCapacityMax; private int StorageCapacityMax;
private StorageWindow Window; private StorageWindow Window;
@@ -138,8 +138,8 @@ namespace Content.Client.GameObjects.Components.Storage
private readonly Label _information; private readonly Label _information;
public ClientStorageComponent StorageEntity; public ClientStorageComponent StorageEntity;
private readonly StyleBoxFlat _hoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.35f) }; private readonly StyleBoxFlat _hoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.35f) };
private readonly StyleBoxFlat _unHoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.0f) }; private readonly StyleBoxFlat _unHoveredBox = new() { BackgroundColor = Color.Black.WithAlpha(0.0f) };
protected override Vector2? CustomSize => (180, 320); protected override Vector2? CustomSize => (180, 320);

View File

@@ -67,7 +67,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
} }
} }
public HashSet<EntityUid> Allies { get; } = new HashSet<EntityUid>(); public HashSet<EntityUid> Allies { get; } = new();
private bool AddAlly(EntityUid ally) private bool AddAlly(EntityUid ally)
{ {

View File

@@ -23,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
private readonly Font _font; private readonly Font _font;
private readonly IEntity _user; private readonly IEntity _user;
private readonly HashSet<EntityUid> _allies = new HashSet<EntityUid>(); private readonly HashSet<EntityUid> _allies = new();
private readonly string _traitorText = Loc.GetString("Traitor"); private readonly string _traitorText = Loc.GetString("Traitor");
public TraitorOverlay( public TraitorOverlay(

View File

@@ -26,7 +26,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
private Dictionary<string, bool> _baseStates; private Dictionary<string, bool> _baseStates;
private static readonly Dictionary<string, VendingMachineVisualLayers> LayerMap = private static readonly Dictionary<string, VendingMachineVisualLayers> LayerMap =
new Dictionary<string, VendingMachineVisualLayers> new()
{ {
{"off", VendingMachineVisualLayers.Unlit}, {"off", VendingMachineVisualLayers.Unlit},
{"screen", VendingMachineVisualLayers.Screen}, {"screen", VendingMachineVisualLayers.Screen},
@@ -39,7 +39,7 @@ namespace Content.Client.GameObjects.Components.VendingMachines
{"broken", VendingMachineVisualLayers.Unlit}, {"broken", VendingMachineVisualLayers.Unlit},
}; };
private readonly Dictionary<string, Animation> _animations = new Dictionary<string, Animation>(); private readonly Dictionary<string, Animation> _animations = new();
public override void LoadData(YamlMappingNode node) public override void LoadData(YamlMappingNode node)
{ {

View File

@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
[RegisterComponent] [RegisterComponent]
public class ClientMagazineBarrelComponent : Component, IItemStatus public class ClientMagazineBarrelComponent : Component, IItemStatus
{ {
private static readonly Animation AlarmAnimationSmg = new Animation private static readonly Animation AlarmAnimationSmg = new()
{ {
Length = TimeSpan.FromSeconds(1.4), Length = TimeSpan.FromSeconds(1.4),
AnimationTracks = AnimationTracks =
@@ -45,7 +45,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
} }
}; };
private static readonly Animation AlarmAnimationLmg = new Animation private static readonly Animation AlarmAnimationLmg = new()
{ {
Length = TimeSpan.FromSeconds(0.75), Length = TimeSpan.FromSeconds(0.75),
AnimationTracks = AnimationTracks =

View File

@@ -481,7 +481,7 @@ namespace Content.Client.GameObjects.Components.Wires
private sealed class StatusLight : Control private sealed class StatusLight : Control
{ {
private static readonly Animation _blinkingFast = new Animation private static readonly Animation _blinkingFast = new()
{ {
Length = TimeSpan.FromSeconds(0.2), Length = TimeSpan.FromSeconds(0.2),
AnimationTracks = AnimationTracks =
@@ -500,7 +500,7 @@ namespace Content.Client.GameObjects.Components.Wires
} }
}; };
private static readonly Animation _blinkingSlow = new Animation private static readonly Animation _blinkingSlow = new()
{ {
Length = TimeSpan.FromSeconds(0.8), Length = TimeSpan.FromSeconds(0.8),
AnimationTracks = AnimationTracks =

View File

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

View File

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

View File

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

View File

@@ -21,11 +21,11 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
private readonly Dictionary<byte, PanelContainer> _doAfterControls = new Dictionary<byte, PanelContainer>(); private readonly Dictionary<byte, PanelContainer> _doAfterControls = new();
private readonly Dictionary<byte, DoAfterBar> _doAfterBars = new Dictionary<byte, DoAfterBar>(); 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 // 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; } public IEntity? AttachedEntity { get; set; }
private ScreenCoordinates _playerPosition; 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 // 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 // come into range it needs altering
private readonly HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>(); private readonly HashSet<DoAfterComponent> _knownComponents = new();
private IEntity? _attachedEntity; private IEntity? _attachedEntity;

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ namespace Content.Client.GameTicking
[Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly IStateManager _stateManager = default!;
[ViewVariables] private bool _initialized; [ViewVariables] private bool _initialized;
private readonly List<string> _jobsAvailable = new List<string>(); private readonly List<string> _jobsAvailable = new();
[ViewVariables] public bool AreWeReady { get; private set; } [ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; } [ViewVariables] public bool IsGameStarted { get; private set; }

View File

@@ -16,7 +16,7 @@ namespace Content.Client.Parallax
{ {
public class ParallaxGenerator public class ParallaxGenerator
{ {
private readonly List<Layer> Layers = new List<Layer>(); private readonly List<Layer> Layers = new();
public static Image<Rgba32> GenerateParallax(TomlTable config, Size size, ISawmill sawmill, List<Image<Rgba32>> debugLayerDump) public static Image<Rgba32> GenerateParallax(TomlTable config, Size size, ISawmill sawmill, List<Image<Rgba32>> debugLayerDump)
{ {

View File

@@ -24,11 +24,11 @@ namespace Content.Client.Parallax
[Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly ILogManager _logManager = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!; [Dependency] private readonly IConfigurationManager _configurationManager = default!;
private static readonly ResourcePath ParallaxConfigPath = new ResourcePath("/parallax_config.toml"); private static readonly ResourcePath ParallaxConfigPath = new("/parallax_config.toml");
// Both of these below are in the user directory. // Both of these below are in the user directory.
private static readonly ResourcePath ParallaxPath = new ResourcePath("/parallax_cache.png"); private static readonly ResourcePath ParallaxPath = new("/parallax_cache.png");
private static readonly ResourcePath ParallaxConfigOld = new ResourcePath("/parallax_config_old"); private static readonly ResourcePath ParallaxConfigOld = new("/parallax_config_old");
public event Action<Texture> OnTextureLoaded; public event Action<Texture> OnTextureLoaded;
public Texture ParallaxTexture { get; private set; } public Texture ParallaxTexture { get; private set; }

View File

@@ -27,8 +27,8 @@ namespace Content.Client.Research
public LatheBoundUserInterface Owner { get; set; } public LatheBoundUserInterface Owner { get; set; }
private readonly List<LatheRecipePrototype> _recipes = new List<LatheRecipePrototype>(); private readonly List<LatheRecipePrototype> _recipes = new();
private readonly List<LatheRecipePrototype> _shownRecipes = new List<LatheRecipePrototype>(); private readonly List<LatheRecipePrototype> _shownRecipes = new();
public LatheMenu(LatheBoundUserInterface owner = null) public LatheMenu(LatheBoundUserInterface owner = null)
{ {

View File

@@ -18,9 +18,9 @@ namespace Content.Client.Research
protected override Vector2? CustomSize => (800, 400); protected override Vector2? CustomSize => (800, 400);
private readonly List<TechnologyPrototype> _unlockedTechnologyPrototypes = new List<TechnologyPrototype>(); private readonly List<TechnologyPrototype> _unlockedTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _unlockableTechnologyPrototypes = new List<TechnologyPrototype>(); private readonly List<TechnologyPrototype> _unlockableTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _futureTechnologyPrototypes = new List<TechnologyPrototype>(); private readonly List<TechnologyPrototype> _futureTechnologyPrototypes = new();
private readonly Label _pointLabel; private readonly Label _pointLabel;
private readonly Label _pointsPerSecondLabel; private readonly Label _pointsPerSecondLabel;

View File

@@ -15,7 +15,7 @@ namespace Content.Client
{ {
internal class ScreenshotHook : IScreenshotHook internal class ScreenshotHook : IScreenshotHook
{ {
private static readonly ResourcePath BaseScreenshotPath = new ResourcePath("/Screenshots"); private static readonly ResourcePath BaseScreenshotPath = new("/Screenshots");
[Dependency] private readonly IInputManager _inputManager = default; [Dependency] private readonly IInputManager _inputManager = default;
[Dependency] private readonly IClyde _clyde = default; [Dependency] private readonly IClyde _clyde = default;

View File

@@ -40,7 +40,7 @@ namespace Content.Client.State
private bool _isConnecting; private bool _isConnecting;
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
private static readonly Regex IPv6Regex = new Regex(@"\[(.*:.*:.*)](?::(\d+))?"); private static readonly Regex IPv6Regex = new(@"\[(.*:.*:.*)](?::(\d+))?");
/// <inheritdoc /> /// <inheritdoc />
public override void Startup() public override void Startup()

View File

@@ -29,18 +29,18 @@ namespace Content.Client.StationEvents
/// <summary> /// <summary>
/// Current color of a pulse /// Current color of a pulse
/// </summary> /// </summary>
private readonly Dictionary<IEntity, Color> _colors = new Dictionary<IEntity, Color>(); private readonly Dictionary<IEntity, Color> _colors = new();
/// <summary> /// <summary>
/// Whether our alpha is increasing or decreasing and at what time does it flip (or stop) /// Whether our alpha is increasing or decreasing and at what time does it flip (or stop)
/// </summary> /// </summary>
private readonly Dictionary<IEntity, (bool EasingIn, TimeSpan TransitionTime)> _transitions = private readonly Dictionary<IEntity, (bool EasingIn, TimeSpan TransitionTime)> _transitions =
new Dictionary<IEntity, (bool EasingIn, TimeSpan TransitionTime)>(); new();
/// <summary> /// <summary>
/// How much the alpha changes per second for each pulse /// How much the alpha changes per second for each pulse
/// </summary> /// </summary>
private readonly Dictionary<IEntity, float> _alphaRateOfChange = new Dictionary<IEntity, float>(); private readonly Dictionary<IEntity, float> _alphaRateOfChange = new();
private TimeSpan _lastTick; private TimeSpan _lastTick;

View File

@@ -33,30 +33,30 @@ namespace Content.Client.UserInterface.AdminMenu
protected override Vector2? CustomSize => (500, 250); protected override Vector2? CustomSize => (500, 250);
private readonly List<CommandButton> _adminButtons = new List<CommandButton> private readonly List<CommandButton> _adminButtons = new()
{ {
new KickCommandButton(), new KickCommandButton(),
new DirectCommandButton("Admin Ghost", "aghost"), new DirectCommandButton("Admin Ghost", "aghost"),
new TeleportCommandButton(), new TeleportCommandButton(),
}; };
private readonly List<CommandButton> _adminbusButtons = new List<CommandButton> private readonly List<CommandButton> _adminbusButtons = new()
{ {
new SpawnEntitiesCommandButton(), new SpawnEntitiesCommandButton(),
new SpawnTilesCommandButton(), new SpawnTilesCommandButton(),
new StationEventsCommandButton(), new StationEventsCommandButton(),
}; };
private readonly List<CommandButton> _debugButtons = new List<CommandButton> private readonly List<CommandButton> _debugButtons = new()
{ {
new AddAtmosCommandButton(), new AddAtmosCommandButton(),
new FillGasCommandButton(), new FillGasCommandButton(),
}; };
private readonly List<CommandButton> _roundButtons = new List<CommandButton> private readonly List<CommandButton> _roundButtons = new()
{ {
new DirectCommandButton("Start Round", "startround"), new DirectCommandButton("Start Round", "startround"),
new DirectCommandButton("End Round", "endround"), new DirectCommandButton("End Round", "endround"),
new DirectCommandButton("Restart Round", "restartround"), new DirectCommandButton("Restart Round", "restartround"),
}; };
private readonly List<CommandButton> _serverButtons = new List<CommandButton> private readonly List<CommandButton> _serverButtons = new()
{ {
new DirectCommandButton("Reboot", "restart"), new DirectCommandButton("Reboot", "restart"),
new DirectCommandButton("Shutdown", "shutdown"), new DirectCommandButton("Shutdown", "shutdown"),
@@ -463,7 +463,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string RequiredCommand => "events"; public override string RequiredCommand => "events";
public override string? SubmitText => "Run"; public override string? SubmitText => "Run";
private readonly CommandUIDropDown _eventsDropDown = new CommandUIDropDown private readonly CommandUIDropDown _eventsDropDown = new()
{ {
Name = "Event", Name = "Event",
GetData = () => GetData = () =>
@@ -478,7 +478,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((string) obj).ToLower(), GetValueFromData = (obj) => ((string) obj).ToLower(),
}; };
public override List<CommandUIControl> UI => new List<CommandUIControl> public override List<CommandUIControl> UI => new()
{ {
_eventsDropDown, _eventsDropDown,
new CommandUIButton new CommandUIButton
@@ -510,19 +510,19 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Kick"; public override string Name => "Kick";
public override string RequiredCommand => "kick"; public override string RequiredCommand => "kick";
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown private readonly CommandUIDropDown _playerDropDown = new()
{ {
Name = "Player", Name = "Player",
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(), GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})", GetDisplayName = (obj) => $"{((IPlayerSession) obj).Name} ({((IPlayerSession) obj).AttachedEntity?.Name})",
GetValueFromData = (obj) => ((IPlayerSession) obj).Name, GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
}; };
private readonly CommandUILineEdit _reason = new CommandUILineEdit private readonly CommandUILineEdit _reason = new()
{ {
Name = "Reason" Name = "Reason"
}; };
public override List<CommandUIControl> UI => new List<CommandUIControl> public override List<CommandUIControl> UI => new()
{ {
_playerDropDown, _playerDropDown,
_reason _reason
@@ -539,7 +539,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Teleport"; public override string Name => "Teleport";
public override string RequiredCommand => "tpto"; public override string RequiredCommand => "tpto";
private readonly CommandUIDropDown _playerDropDown = new CommandUIDropDown private readonly CommandUIDropDown _playerDropDown = new()
{ {
Name = "Player", Name = "Player",
GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(), GetData = () => IoCManager.Resolve<IPlayerManager>().Sessions.ToList<object>(),
@@ -547,7 +547,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IPlayerSession) obj).Name, GetValueFromData = (obj) => ((IPlayerSession) obj).Name,
}; };
public override List<CommandUIControl> UI => new List<CommandUIControl> public override List<CommandUIControl> UI => new()
{ {
_playerDropDown _playerDropDown
}; };
@@ -563,7 +563,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Add Atmos"; public override string Name => "Add Atmos";
public override string RequiredCommand => "addatmos"; public override string RequiredCommand => "addatmos";
private readonly CommandUIDropDown _grid = new CommandUIDropDown private readonly CommandUIDropDown _grid = new()
{ {
Name = "Grid", Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(), GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
@@ -571,7 +571,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(), GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
}; };
public override List<CommandUIControl> UI => new List<CommandUIControl> public override List<CommandUIControl> UI => new()
{ {
_grid, _grid,
}; };
@@ -587,7 +587,7 @@ namespace Content.Client.UserInterface.AdminMenu
public override string Name => "Fill Gas"; public override string Name => "Fill Gas";
public override string RequiredCommand => "fillgas"; public override string RequiredCommand => "fillgas";
private readonly CommandUIDropDown _grid = new CommandUIDropDown private readonly CommandUIDropDown _grid = new()
{ {
Name = "Grid", Name = "Grid",
GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(), GetData = () => IoCManager.Resolve<IMapManager>().GetAllGrids().Where(g => (int) g.Index != 0).ToList<object>(),
@@ -595,7 +595,7 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(), GetValueFromData = (obj) => ((IMapGrid) obj).Index.ToString(),
}; };
private readonly CommandUIDropDown _gas = new CommandUIDropDown private readonly CommandUIDropDown _gas = new()
{ {
Name = "Gas", Name = "Gas",
GetData = () => GetData = () =>
@@ -607,12 +607,12 @@ namespace Content.Client.UserInterface.AdminMenu
GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(), GetValueFromData = (obj) => ((GasPrototype) obj).ID.ToString(),
}; };
private readonly CommandUISpinBox _amount = new CommandUISpinBox private readonly CommandUISpinBox _amount = new()
{ {
Name = "Amount" Name = "Amount"
}; };
public override List<CommandUIControl> UI => new List<CommandUIControl> public override List<CommandUIControl> UI => new()
{ {
_grid, _grid,
_gas, _gas,

View File

@@ -23,7 +23,7 @@ namespace Content.Client.UserInterface.Cargo
public event Action<BaseButton.ButtonEventArgs> OnOrderApproved; public event Action<BaseButton.ButtonEventArgs> OnOrderApproved;
public event Action<BaseButton.ButtonEventArgs> OnOrderCanceled; public event Action<BaseButton.ButtonEventArgs> OnOrderCanceled;
private readonly List<string> _categoryStrings = new List<string>(); private readonly List<string> _categoryStrings = new();
private Label _accountNameLabel { get; set; } private Label _accountNameLabel { get; set; }
private Label _pointsLabel { get; set; } private Label _pointsLabel { get; set; }

View File

@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
{ {
[Dependency] private readonly IResourceCache _resourceManager = default!; [Dependency] private readonly IResourceCache _resourceManager = default!;
private static readonly Dictionary<string, int> PatronTierPriority = new Dictionary<string, int> private static readonly Dictionary<string, int> PatronTierPriority = new()
{ {
["Nuclear Operative"] = 1, ["Nuclear Operative"] = 1,
["Syndicate Agent"] = 2, ["Syndicate Agent"] = 2,

View File

@@ -10,8 +10,8 @@ namespace Content.Client.UserInterface
{ {
public class GhostGui : Control public class GhostGui : Control
{ {
private readonly Button _returnToBody = new Button() {Text = Loc.GetString("Return to body")}; private readonly Button _returnToBody = new() {Text = Loc.GetString("Return to body")};
private readonly Button _ghostWarp = new Button() {Text = Loc.GetString("Ghost Warp")}; private readonly Button _ghostWarp = new() {Text = Loc.GetString("Ghost Warp")};
private readonly GhostComponent _owner; private readonly GhostComponent _owner;
public GhostGui(GhostComponent owner) public GhostGui(GhostComponent owner)

View File

@@ -25,7 +25,7 @@ namespace Content.Client.UserInterface
{ {
public partial class HumanoidProfileEditor : Control public partial class HumanoidProfileEditor : Control
{ {
private static readonly StyleBoxFlat HighlightedStyle = new StyleBoxFlat private static readonly StyleBoxFlat HighlightedStyle = new()
{ {
BackgroundColor = new Color(47, 47, 53), BackgroundColor = new Color(47, 47, 53),
ContentMarginTopOverride = 10, ContentMarginTopOverride = 10,

View File

@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
public class ItemStatusPanel : Control public class ItemStatusPanel : Control
{ {
[ViewVariables] [ViewVariables]
private readonly List<(IItemStatus, Control)> _activeStatusComponents = new List<(IItemStatus, Control)>(); private readonly List<(IItemStatus, Control)> _activeStatusComponents = new();
[ViewVariables] [ViewVariables]
private readonly Label _itemNameLabel; private readonly Label _itemNameLabel;

View File

@@ -26,7 +26,7 @@ namespace Content.Client.UserInterface
public event Action<string> SelectedId; public event Action<string> SelectedId;
private readonly Dictionary<string, JobButton> _jobButtons = new Dictionary<string, JobButton>(); private readonly Dictionary<string, JobButton> _jobButtons = new();
public LateJoinGui() public LateJoinGui()
{ {

View File

@@ -92,7 +92,7 @@ namespace Content.Client.UserInterface
private static SpriteView MakeSpriteView(IEntity entity, Direction direction) private static SpriteView MakeSpriteView(IEntity entity, Direction direction)
{ {
return new SpriteView return new()
{ {
Sprite = entity.GetComponent<ISpriteComponent>(), Sprite = entity.GetComponent<ISpriteComponent>(),
OverrideDirection = direction, OverrideDirection = direction,

View File

@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
private sealed class KeyRebindControl : Control private sealed class KeyRebindControl : Control
{ {
// List of key functions that must be registered as toggle instead. // List of key functions that must be registered as toggle instead.
private static readonly HashSet<BoundKeyFunction> ToggleFunctions = new HashSet<BoundKeyFunction> private static readonly HashSet<BoundKeyFunction> ToggleFunctions = new()
{ {
EngineKeyFunctions.ShowDebugMonitors, EngineKeyFunctions.ShowDebugMonitors,
EngineKeyFunctions.HideUI, EngineKeyFunctions.HideUI,
@@ -31,9 +31,9 @@ namespace Content.Client.UserInterface
private BindButton? _currentlyRebinding; private BindButton? _currentlyRebinding;
private readonly Dictionary<BoundKeyFunction, KeyControl> _keyControls = private readonly Dictionary<BoundKeyFunction, KeyControl> _keyControls =
new Dictionary<BoundKeyFunction, KeyControl>(); new();
private readonly List<Action> _deferCommands = new List<Action>(); private readonly List<Action> _deferCommands = new();
public KeyRebindControl() public KeyRebindControl()
{ {

View File

@@ -355,7 +355,7 @@ namespace Content.Client.ParticleAccelerator
PASegmentControl Segment(string name) PASegmentControl Segment(string name)
{ {
return new PASegmentControl(this, resourceCache, name); return new(this, resourceCache, name);
} }
} }

View File

@@ -27,10 +27,10 @@ namespace Content.Client.UserInterface.Permissions
[Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IClientAdminManager _adminManager = default!;
private readonly Menu _menu; private readonly Menu _menu;
private readonly List<SS14Window> _subWindows = new List<SS14Window>(); private readonly List<SS14Window> _subWindows = new();
private Dictionary<int, PermissionsEuiState.AdminRankData> _ranks = private Dictionary<int, PermissionsEuiState.AdminRankData> _ranks =
new Dictionary<int, PermissionsEuiState.AdminRankData>(); new();
public PermissionsEui() public PermissionsEui()
{ {
@@ -348,7 +348,7 @@ namespace Content.Client.UserInterface.Permissions
public readonly Button? RemoveButton; public readonly Button? RemoveButton;
public readonly Dictionary<AdminFlags, (Button inherit, Button sub, Button plus)> FlagButtons public readonly Dictionary<AdminFlags, (Button inherit, Button sub, Button plus)> FlagButtons
= new Dictionary<AdminFlags, (Button, Button, Button)>(); = new();
public EditAdminWindow(PermissionsEui ui, PermissionsEuiState.AdminData? data) public EditAdminWindow(PermissionsEui ui, PermissionsEuiState.AdminData? data)
{ {
@@ -519,7 +519,7 @@ namespace Content.Client.UserInterface.Permissions
public readonly LineEdit NameEdit; public readonly LineEdit NameEdit;
public readonly Button SaveButton; public readonly Button SaveButton;
public readonly Button? RemoveButton; public readonly Button? RemoveButton;
public readonly Dictionary<AdminFlags, CheckBox> FlagCheckBoxes = new Dictionary<AdminFlags, CheckBox>(); public readonly Dictionary<AdminFlags, CheckBox> FlagCheckBoxes = new();
public EditAdminRankWindow(PermissionsEui ui, KeyValuePair<int, PermissionsEuiState.AdminRankData>? data) public EditAdminRankWindow(PermissionsEui ui, KeyValuePair<int, PermissionsEuiState.AdminRankData>? data)
{ {

View File

@@ -75,7 +75,7 @@ namespace Content.IntegrationTests
public T AddGameRule<T>() where T : GameRule, new() public T AddGameRule<T>() where T : GameRule, new()
{ {
return new T(); return new();
} }
public bool HasGameRule(Type type) public bool HasGameRule(Type type)
@@ -120,7 +120,7 @@ namespace Content.IntegrationTests
public Dictionary<string, int> GetAvailablePositions() public Dictionary<string, int> GetAvailablePositions()
{ {
return new Dictionary<string, int>(); return new();
} }
} }
} }

View File

@@ -433,7 +433,7 @@ namespace Content.IntegrationTests.Tests.Networking
// Queue of all the events that come in so we can test that they come in perfectly as expected. // Queue of all the events that come in so we can test that they come in perfectly as expected.
public List<(GameTick tick, bool firstPredict, bool old, bool @new, bool value)> EventTriggerList { get; } = public List<(GameTick tick, bool firstPredict, bool old, bool @new, bool value)> EventTriggerList { get; } =
new List<(GameTick, bool, bool, bool, bool)>(); new();
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;

View File

@@ -80,7 +80,7 @@ namespace Content.Server.Database
[Column("preference_id")] public int Id { get; set; } [Column("preference_id")] public int Id { get; set; }
[Column("user_id")] public Guid UserId { get; set; } [Column("user_id")] public Guid UserId { get; set; }
[Column("selected_character_slot")] public int SelectedCharacterSlot { get; set; } [Column("selected_character_slot")] public int SelectedCharacterSlot { get; set; }
public List<Profile> Profiles { get; } = new List<Profile>(); public List<Profile> Profiles { get; } = new();
} }
[Table("profile")] [Table("profile")]
@@ -97,8 +97,8 @@ namespace Content.Server.Database
[Column("facial_hair_color")] public string FacialHairColor { get; set; } = null!; [Column("facial_hair_color")] public string FacialHairColor { get; set; } = null!;
[Column("eye_color")] public string EyeColor { get; set; } = null!; [Column("eye_color")] public string EyeColor { get; set; } = null!;
[Column("skin_color")] public string SkinColor { get; set; } = null!; [Column("skin_color")] public string SkinColor { get; set; } = null!;
public List<Job> Jobs { get; } = new List<Job>(); public List<Job> Jobs { get; } = new();
public List<Antag> Antags { get; } = new List<Antag>(); public List<Antag> Antags { get; } = new();
[Column("pref_unavailable")] public DbPreferenceUnavailableMode PreferenceUnavailable { get; set; } [Column("pref_unavailable")] public DbPreferenceUnavailableMode PreferenceUnavailable { get; set; }

View File

@@ -31,8 +31,8 @@ namespace Content.Server.AI.Utility.AiLogic
/// <summary> /// <summary>
/// The sum of all BehaviorSets gives us what actions the AI can take /// The sum of all BehaviorSets gives us what actions the AI can take
/// </summary> /// </summary>
public Dictionary<Type, BehaviorSet> BehaviorSets { get; } = new Dictionary<Type, BehaviorSet>(); public Dictionary<Type, BehaviorSet> BehaviorSets { get; } = new();
private readonly List<IAiUtility> _availableActions = new List<IAiUtility>(); private readonly List<IAiUtility> _availableActions = new();
/// <summary> /// <summary>
/// The currently running action; most importantly are the operators. /// The currently running action; most importantly are the operators.

View File

@@ -7,7 +7,7 @@ namespace Content.Server.AI.Utility.Considerations
{ {
public class ConsiderationsManager public class ConsiderationsManager
{ {
private readonly Dictionary<Type, Consideration> _considerations = new Dictionary<Type, Consideration>(); private readonly Dictionary<Type, Consideration> _considerations = new();
public void Initialize() public void Initialize()
{ {

View File

@@ -15,8 +15,8 @@ namespace Content.Server.AI.WorldState
// This also stops you from re-writing the same boilerplate everywhere of stuff like "Do I have OuterClothing on?" // This also stops you from re-writing the same boilerplate everywhere of stuff like "Do I have OuterClothing on?"
private readonly Dictionary<Type, IAiState> _states = new Dictionary<Type, IAiState>(); private readonly Dictionary<Type, IAiState> _states = new();
private readonly List<IPlanningState> _planningStates = new List<IPlanningState>(); private readonly List<IPlanningState> _planningStates = new();
public Blackboard(IEntity owner) public Blackboard(IEntity owner)
{ {

View File

@@ -14,7 +14,7 @@ namespace Content.Server.AI.WorldState
{ {
// Cache the known types // Cache the known types
public IReadOnlyCollection<Type> AiStates => _aiStates; public IReadOnlyCollection<Type> AiStates => _aiStates;
private readonly List<Type> _aiStates = new List<Type>(); private readonly List<Type> _aiStates = new();
public void Initialize() public void Initialize()
{ {

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Administration
[Dependency] private readonly IConsoleShell _consoleShell = default!; [Dependency] private readonly IConsoleShell _consoleShell = default!;
[Dependency] private readonly IChatManager _chat = default!; [Dependency] private readonly IChatManager _chat = default!;
private readonly Dictionary<IPlayerSession, AdminReg> _admins = new Dictionary<IPlayerSession, AdminReg>(); private readonly Dictionary<IPlayerSession, AdminReg> _admins = new();
public event Action<AdminPermsChangedEventArgs>? OnPermsChanged; public event Action<AdminPermsChangedEventArgs>? OnPermsChanged;
@@ -49,8 +49,8 @@ namespace Content.Server.Administration
// If a command isn't in this list it's server-console only. // If a command isn't in this list it's server-console only.
// if a command is in but the flags value is null it's available to everybody. // if a command is in but the flags value is null it's available to everybody.
private readonly HashSet<string> _anyCommands = new HashSet<string>(); private readonly HashSet<string> _anyCommands = new();
private readonly Dictionary<string, AdminFlags[]> _adminCommands = new Dictionary<string, AdminFlags[]>(); private readonly Dictionary<string, AdminFlags[]> _adminCommands = new();
public AdminData? GetAdminData(IPlayerSession session, bool includeDeAdmin = false) public AdminData? GetAdminData(IPlayerSession session, bool includeDeAdmin = false)
{ {

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Administration
private bool _isLoading; private bool _isLoading;
private readonly List<(Admin a, string? lastUserName)> _admins = new List<(Admin, string? lastUserName)>(); private readonly List<(Admin a, string? lastUserName)> _admins = new List<(Admin, string? lastUserName)>();
private readonly List<DbAdminRank> _adminRanks = new List<DbAdminRank>(); private readonly List<DbAdminRank> _adminRanks = new();
public PermissionsEui() public PermissionsEui()
{ {

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Atmos
private bool _disposed = false; private bool _disposed = false;
[ViewVariables] [ViewVariables]
private readonly HashSet<TileAtmosphere> _tiles = new HashSet<TileAtmosphere>(); private readonly HashSet<TileAtmosphere> _tiles = new();
[ViewVariables] [ViewVariables]
private GridAtmosphereComponent _gridAtmosphereComponent; private GridAtmosphereComponent _gridAtmosphereComponent;

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Atmos
{ {
private readonly AtmosphereSystem _atmosphereSystem; private readonly AtmosphereSystem _atmosphereSystem;
public static GasMixture SpaceGas => new GasMixture() {Volume = 2500f, Immutable = true, Temperature = Atmospherics.TCMB}; public static GasMixture SpaceGas => new() {Volume = 2500f, Immutable = true, Temperature = Atmospherics.TCMB};
// This must always have a length that is a multiple of 4 for SIMD acceleration. // This must always have a length that is a multiple of 4 for SIMD acceleration.
[ViewVariables] [ViewVariables]
@@ -44,7 +44,7 @@ namespace Content.Server.Atmos
public float LastShare { get; private set; } = 0; public float LastShare { get; private set; } = 0;
[ViewVariables] [ViewVariables]
public readonly Dictionary<GasReaction, float> ReactionResults = new Dictionary<GasReaction, float>() public readonly Dictionary<GasReaction, float> ReactionResults = new()
{ {
// We initialize the dictionary here. // We initialize the dictionary here.
{ GasReaction.Fire, 0f } { GasReaction.Fire, 0f }

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Atmos
private readonly GridTileLookupSystem _gridTileLookupSystem = default!; private readonly GridTileLookupSystem _gridTileLookupSystem = default!;
private static readonly TileAtmosphereComparer Comparer = new TileAtmosphereComparer(); private static readonly TileAtmosphereComparer Comparer = new();
[ViewVariables] private int _archivedCycle; [ViewVariables] private int _archivedCycle;
[ViewVariables] private int _currentCycle; [ViewVariables] private int _currentCycle;

View File

@@ -6,8 +6,8 @@ namespace Content.Server.Cargo
{ {
public class CargoOrderDataManager : ICargoOrderDataManager public class CargoOrderDataManager : ICargoOrderDataManager
{ {
private readonly Dictionary<int, CargoOrderDatabase> _accounts = new Dictionary<int, CargoOrderDatabase>(); private readonly Dictionary<int, CargoOrderDatabase> _accounts = new();
private readonly List<CargoOrderDatabaseComponent> _components = new List<CargoOrderDatabaseComponent>(); private readonly List<CargoOrderDatabaseComponent> _components = new();
public CargoOrderDataManager() public CargoOrderDataManager()
{ {

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Cargo
{ {
public class CargoOrderDatabase public class CargoOrderDatabase
{ {
private readonly Dictionary<int, CargoOrderData> _orders = new Dictionary<int, CargoOrderData>(); private readonly Dictionary<int, CargoOrderData> _orders = new();
private int _orderNumber = 0; private int _orderNumber = 0;
public CargoOrderDatabase(int id) public CargoOrderDatabase(int id)

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Database
// For SQLite we use a single DB context via SQLite. // For SQLite we use a single DB context via SQLite.
// This doesn't allow concurrent access so that's what the semaphore is for. // This doesn't allow concurrent access so that's what the semaphore is for.
// That said, this is bloody SQLite, I don't even think EFCore bothers to truly async it. // That said, this is bloody SQLite, I don't even think EFCore bothers to truly async it.
private readonly SemaphoreSlim _prefsSemaphore = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim _prefsSemaphore = new(1, 1);
private readonly Task _dbReadyTask; private readonly Task _dbReadyTask;
private readonly SqliteServerDbContext _prefsCtx; private readonly SqliteServerDbContext _prefsCtx;

View File

@@ -14,8 +14,8 @@ namespace Content.Server.GameObjects.EntitySystems.DeviceNetwork
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
private readonly Dictionary<int, List<NetworkDevice>> _devices = new Dictionary<int, List<NetworkDevice>>(); private readonly Dictionary<int, List<NetworkDevice>> _devices = new();
private readonly Queue<NetworkPackage> _packages = new Queue<NetworkPackage>(); private readonly Queue<NetworkPackage> _packages = new();
/// <inheritdoc/> /// <inheritdoc/>
public DeviceNetworkConnection Register(int netId, int frequency, OnReceiveNetMessage messageHandler, bool receiveAll = false) public DeviceNetworkConnection Register(int netId, int frequency, OnReceiveNetMessage messageHandler, bool receiveAll = false)

View File

@@ -19,7 +19,7 @@ namespace Content.Server.Eui
[Dependency] private readonly IServerNetManager _net = default!; [Dependency] private readonly IServerNetManager _net = default!;
private readonly Dictionary<IPlayerSession, PlayerEuiData> _playerData = private readonly Dictionary<IPlayerSession, PlayerEuiData> _playerData =
new Dictionary<IPlayerSession, PlayerEuiData>(); new();
private readonly Queue<(IPlayerSession player, uint id)> _stateUpdateQueue = private readonly Queue<(IPlayerSession player, uint id)> _stateUpdateQueue =
new Queue<(IPlayerSession, uint id)>(); new Queue<(IPlayerSession, uint id)>();
@@ -27,7 +27,7 @@ namespace Content.Server.Eui
private sealed class PlayerEuiData private sealed class PlayerEuiData
{ {
public uint NextId = 1; public uint NextId = 1;
public readonly Dictionary<uint, BaseEui> OpenUIs = new Dictionary<uint, BaseEui>(); public readonly Dictionary<uint, BaseEui> OpenUIs = new();
} }
void IPostInjectInit.PostInject() void IPostInjectInit.PostInject()

View File

@@ -17,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Access
public override string Name => "Access"; public override string Name => "Access";
[ViewVariables] [ViewVariables]
private readonly HashSet<string> _tags = new HashSet<string>(); private readonly HashSet<string> _tags = new();
public ISet<string> Tags => _tags; public ISet<string> Tags => _tags;
public bool IsReadOnly => false; public bool IsReadOnly => false;

View File

@@ -25,8 +25,8 @@ namespace Content.Server.GameObjects.Components.Access
{ {
public override string Name => "AccessReader"; public override string Name => "AccessReader";
private readonly List<ISet<string>> _accessLists = new List<ISet<string>>(); private readonly List<ISet<string>> _accessLists = new();
private readonly HashSet<string> _denyTags = new HashSet<string>(); private readonly HashSet<string> _denyTags = new();
/// <summary> /// <summary>
/// List of access lists to check allowed against. For an access check to pass /// List of access lists to check allowed against. For an access check to pass

View File

@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Arcade
private BlockGame? _game; private BlockGame? _game;
private IPlayerSession? _player; private IPlayerSession? _player;
private readonly List<IPlayerSession> _spectators = new List<IPlayerSession>(); private readonly List<IPlayerSession> _spectators = new();
public void Activate(ActivateEventArgs eventArgs) public void Activate(ActivateEventArgs eventArgs)
{ {
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Arcade
private readonly BlockGameArcadeComponent _component; private readonly BlockGameArcadeComponent _component;
private readonly List<BlockGameBlock> _field = new List<BlockGameBlock>(); private readonly List<BlockGameBlock> _field = new();
private BlockGamePiece _currentPiece; private BlockGamePiece _currentPiece;
@@ -733,7 +733,7 @@ namespace Content.Server.GameObjects.Components.Arcade
private readonly BlockGamePieceType[] _allBlockGamePieces; private readonly BlockGamePieceType[] _allBlockGamePieces;
private List<BlockGamePieceType> _blockGamePiecesBuffer = new List<BlockGamePieceType>(); private List<BlockGamePieceType> _blockGamePiecesBuffer = new();
private BlockGamePiece GetRandomBlockGamePiece(IRobustRandom random) private BlockGamePiece GetRandomBlockGamePiece(IRobustRandom random)
{ {

View File

@@ -429,7 +429,7 @@ namespace Content.Server.GameObjects.Components.Arcade
/// <returns>A Metadata-message.</returns> /// <returns>A Metadata-message.</returns>
public SpaceVillainArcadeMetaDataUpdateMessage GenerateMetaDataMessage() public SpaceVillainArcadeMetaDataUpdateMessage GenerateMetaDataMessage()
{ {
return new SpaceVillainArcadeMetaDataUpdateMessage(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage, _latestEnemyActionMessage, Name, _enemyName, !_running); return new(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage, _latestEnemyActionMessage, Name, _enemyName, !_running);
} }
/// <summary> /// <summary>
@@ -439,7 +439,7 @@ namespace Content.Server.GameObjects.Components.Arcade
public SpaceVillainArcadeDataUpdateMessage public SpaceVillainArcadeDataUpdateMessage
GenerateUpdateMessage() GenerateUpdateMessage()
{ {
return new SpaceVillainArcadeDataUpdateMessage(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage, return new(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage,
_latestEnemyActionMessage); _latestEnemyActionMessage);
} }
} }

View File

@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Atmos
public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction
{ {
private bool _resisting = false; private bool _resisting = false;
private readonly List<EntityUid> _collided = new List<EntityUid>(); private readonly List<EntityUid> _collided = new();
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public bool OnFire { get; private set; } public bool OnFire { get; private set; }

View File

@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private bool _paused = false; private bool _paused = false;
private float _timer = 0f; private float _timer = 0f;
private Stopwatch _stopwatch = new Stopwatch(); private Stopwatch _stopwatch = new();
private GridId _gridId; private GridId _gridId;
[ComponentDependency] private IMapGridComponent? _mapGridComponent = default!; [ComponentDependency] private IMapGridComponent? _mapGridComponent = default!;
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _tileEqualizeLastProcess; private double _tileEqualizeLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<ExcitedGroup> _excitedGroups = new HashSet<ExcitedGroup>(1000); private readonly HashSet<ExcitedGroup> _excitedGroups = new(1000);
[ViewVariables] [ViewVariables]
private int ExcitedGroupCount => _excitedGroups.Count; private int ExcitedGroupCount => _excitedGroups.Count;
@@ -84,10 +84,10 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _excitedGroupLastProcess; private double _excitedGroupLastProcess;
[ViewVariables] [ViewVariables]
protected readonly Dictionary<Vector2i, TileAtmosphere> Tiles = new Dictionary<Vector2i, TileAtmosphere>(1000); protected readonly Dictionary<Vector2i, TileAtmosphere> Tiles = new(1000);
[ViewVariables] [ViewVariables]
private readonly HashSet<TileAtmosphere> _activeTiles = new HashSet<TileAtmosphere>(1000); private readonly HashSet<TileAtmosphere> _activeTiles = new(1000);
[ViewVariables] [ViewVariables]
private int ActiveTilesCount => _activeTiles.Count; private int ActiveTilesCount => _activeTiles.Count;
@@ -96,7 +96,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _activeTilesLastProcess; private double _activeTilesLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<TileAtmosphere> _hotspotTiles = new HashSet<TileAtmosphere>(1000); private readonly HashSet<TileAtmosphere> _hotspotTiles = new(1000);
[ViewVariables] [ViewVariables]
private int HotspotTilesCount => _hotspotTiles.Count; private int HotspotTilesCount => _hotspotTiles.Count;
@@ -105,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _hotspotsLastProcess; private double _hotspotsLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<TileAtmosphere> _superconductivityTiles = new HashSet<TileAtmosphere>(1000); private readonly HashSet<TileAtmosphere> _superconductivityTiles = new(1000);
[ViewVariables] [ViewVariables]
private int SuperconductivityTilesCount => _superconductivityTiles.Count; private int SuperconductivityTilesCount => _superconductivityTiles.Count;
@@ -114,13 +114,13 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _superconductivityLastProcess; private double _superconductivityLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<Vector2i> _invalidatedCoords = new HashSet<Vector2i>(1000); private readonly HashSet<Vector2i> _invalidatedCoords = new(1000);
[ViewVariables] [ViewVariables]
private int InvalidatedCoordsCount => _invalidatedCoords.Count; private int InvalidatedCoordsCount => _invalidatedCoords.Count;
[ViewVariables] [ViewVariables]
private HashSet<TileAtmosphere> _highPressureDelta = new HashSet<TileAtmosphere>(1000); private HashSet<TileAtmosphere> _highPressureDelta = new(1000);
[ViewVariables] [ViewVariables]
private int HighPressureDeltaCount => _highPressureDelta.Count; private int HighPressureDeltaCount => _highPressureDelta.Count;
@@ -129,28 +129,28 @@ namespace Content.Server.GameObjects.Components.Atmos
private double _highPressureDeltaLastProcess; private double _highPressureDeltaLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<IPipeNet> _pipeNets = new HashSet<IPipeNet>(); private readonly HashSet<IPipeNet> _pipeNets = new();
[ViewVariables] [ViewVariables]
private double _pipeNetLastProcess; private double _pipeNetLastProcess;
[ViewVariables] [ViewVariables]
private readonly HashSet<PipeNetDeviceComponent> _pipeNetDevices = new HashSet<PipeNetDeviceComponent>(); private readonly HashSet<PipeNetDeviceComponent> _pipeNetDevices = new();
[ViewVariables] [ViewVariables]
private double _pipeNetDevicesLastProcess; private double _pipeNetDevicesLastProcess;
[ViewVariables] [ViewVariables]
private Queue<TileAtmosphere> _currentRunTiles = new Queue<TileAtmosphere>(); private Queue<TileAtmosphere> _currentRunTiles = new();
[ViewVariables] [ViewVariables]
private Queue<ExcitedGroup> _currentRunExcitedGroups = new Queue<ExcitedGroup>(); private Queue<ExcitedGroup> _currentRunExcitedGroups = new();
[ViewVariables] [ViewVariables]
private Queue<IPipeNet> _currentRunPipeNet = new Queue<IPipeNet>(); private Queue<IPipeNet> _currentRunPipeNet = new();
[ViewVariables] [ViewVariables]
private Queue<PipeNetDeviceComponent> _currentRunPipeNetDevice = new Queue<PipeNetDeviceComponent>(); private Queue<PipeNetDeviceComponent> _currentRunPipeNetDevice = new();
[ViewVariables] [ViewVariables]
private ProcessState _state = ProcessState.TileEqualize; private ProcessState _state = ProcessState.TileEqualize;

View File

@@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Atmos
public override TileAtmosphere? GetTile(Vector2i indices, bool createSpace = true) public override TileAtmosphere? GetTile(Vector2i indices, bool createSpace = true)
{ {
return new TileAtmosphere(this, GridId.Invalid, indices, new GasMixture(2500, AtmosphereSystem), true); return new(this, GridId.Invalid, indices, new GasMixture(2500, AtmosphereSystem), true);
} }
protected override IEnumerable<AirtightComponent> GetObstructingComponents(Vector2i indices) protected override IEnumerable<AirtightComponent> GetObstructingComponents(Vector2i indices)

View File

@@ -103,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
/// Used to track how long each reagent has been in the stomach /// Used to track how long each reagent has been in the stomach
/// </summary> /// </summary>
[ViewVariables] [ViewVariables]
private readonly List<ReagentDelta> _reagentDeltas = new List<ReagentDelta>(); private readonly List<ReagentDelta> _reagentDeltas = new();
public override void ExposeData(ObjectSerializer serializer) public override void ExposeData(ObjectSerializer serializer)
{ {

View File

@@ -62,7 +62,7 @@ namespace Content.Server.GameObjects.Components.Body
/// </summary> /// </summary>
private BodyScannerUIState InterfaceState(IBody body) private BodyScannerUIState InterfaceState(IBody body)
{ {
return new BodyScannerUIState(body.Owner.Uid); return new(body.Owner.Uid);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More