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:
@@ -17,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
public override string Name => "Access";
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<string> _tags = new HashSet<string>();
|
||||
private readonly HashSet<string> _tags = new();
|
||||
|
||||
public ISet<string> Tags => _tags;
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
public override string Name => "AccessReader";
|
||||
|
||||
private readonly List<ISet<string>> _accessLists = new List<ISet<string>>();
|
||||
private readonly HashSet<string> _denyTags = new HashSet<string>();
|
||||
private readonly List<ISet<string>> _accessLists = new();
|
||||
private readonly HashSet<string> _denyTags = new();
|
||||
|
||||
/// <summary>
|
||||
/// List of access lists to check allowed against. For an access check to pass
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
private BlockGame? _game;
|
||||
|
||||
private IPlayerSession? _player;
|
||||
private readonly List<IPlayerSession> _spectators = new List<IPlayerSession>();
|
||||
private readonly List<IPlayerSession> _spectators = new();
|
||||
|
||||
public void Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
|
||||
private readonly BlockGameArcadeComponent _component;
|
||||
|
||||
private readonly List<BlockGameBlock> _field = new List<BlockGameBlock>();
|
||||
private readonly List<BlockGameBlock> _field = new();
|
||||
|
||||
private BlockGamePiece _currentPiece;
|
||||
|
||||
@@ -733,7 +733,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
|
||||
private readonly BlockGamePieceType[] _allBlockGamePieces;
|
||||
|
||||
private List<BlockGamePieceType> _blockGamePiecesBuffer = new List<BlockGamePieceType>();
|
||||
private List<BlockGamePieceType> _blockGamePiecesBuffer = new();
|
||||
|
||||
private BlockGamePiece GetRandomBlockGamePiece(IRobustRandom random)
|
||||
{
|
||||
|
||||
@@ -429,7 +429,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
/// <returns>A Metadata-message.</returns>
|
||||
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>
|
||||
@@ -439,7 +439,7 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
public SpaceVillainArcadeDataUpdateMessage
|
||||
GenerateUpdateMessage()
|
||||
{
|
||||
return new SpaceVillainArcadeDataUpdateMessage(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage,
|
||||
return new(_playerHp, _playerMp, _enemyHp, _enemyMp, _latestPlayerActionMessage,
|
||||
_latestEnemyActionMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction
|
||||
{
|
||||
private bool _resisting = false;
|
||||
private readonly List<EntityUid> _collided = new List<EntityUid>();
|
||||
private readonly List<EntityUid> _collided = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool OnFire { get; private set; }
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
private bool _paused = false;
|
||||
private float _timer = 0f;
|
||||
private Stopwatch _stopwatch = new Stopwatch();
|
||||
private Stopwatch _stopwatch = new();
|
||||
private GridId _gridId;
|
||||
|
||||
[ComponentDependency] private IMapGridComponent? _mapGridComponent = default!;
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _tileEqualizeLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<ExcitedGroup> _excitedGroups = new HashSet<ExcitedGroup>(1000);
|
||||
private readonly HashSet<ExcitedGroup> _excitedGroups = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int ExcitedGroupCount => _excitedGroups.Count;
|
||||
@@ -84,10 +84,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _excitedGroupLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
protected readonly Dictionary<Vector2i, TileAtmosphere> Tiles = new Dictionary<Vector2i, TileAtmosphere>(1000);
|
||||
protected readonly Dictionary<Vector2i, TileAtmosphere> Tiles = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<TileAtmosphere> _activeTiles = new HashSet<TileAtmosphere>(1000);
|
||||
private readonly HashSet<TileAtmosphere> _activeTiles = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int ActiveTilesCount => _activeTiles.Count;
|
||||
@@ -96,7 +96,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _activeTilesLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<TileAtmosphere> _hotspotTiles = new HashSet<TileAtmosphere>(1000);
|
||||
private readonly HashSet<TileAtmosphere> _hotspotTiles = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int HotspotTilesCount => _hotspotTiles.Count;
|
||||
@@ -105,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _hotspotsLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<TileAtmosphere> _superconductivityTiles = new HashSet<TileAtmosphere>(1000);
|
||||
private readonly HashSet<TileAtmosphere> _superconductivityTiles = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int SuperconductivityTilesCount => _superconductivityTiles.Count;
|
||||
@@ -114,13 +114,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _superconductivityLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<Vector2i> _invalidatedCoords = new HashSet<Vector2i>(1000);
|
||||
private readonly HashSet<Vector2i> _invalidatedCoords = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int InvalidatedCoordsCount => _invalidatedCoords.Count;
|
||||
|
||||
[ViewVariables]
|
||||
private HashSet<TileAtmosphere> _highPressureDelta = new HashSet<TileAtmosphere>(1000);
|
||||
private HashSet<TileAtmosphere> _highPressureDelta = new(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private int HighPressureDeltaCount => _highPressureDelta.Count;
|
||||
@@ -129,28 +129,28 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private double _highPressureDeltaLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<IPipeNet> _pipeNets = new HashSet<IPipeNet>();
|
||||
private readonly HashSet<IPipeNet> _pipeNets = new();
|
||||
|
||||
[ViewVariables]
|
||||
private double _pipeNetLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<PipeNetDeviceComponent> _pipeNetDevices = new HashSet<PipeNetDeviceComponent>();
|
||||
private readonly HashSet<PipeNetDeviceComponent> _pipeNetDevices = new();
|
||||
|
||||
[ViewVariables]
|
||||
private double _pipeNetDevicesLastProcess;
|
||||
|
||||
[ViewVariables]
|
||||
private Queue<TileAtmosphere> _currentRunTiles = new Queue<TileAtmosphere>();
|
||||
private Queue<TileAtmosphere> _currentRunTiles = new();
|
||||
|
||||
[ViewVariables]
|
||||
private Queue<ExcitedGroup> _currentRunExcitedGroups = new Queue<ExcitedGroup>();
|
||||
private Queue<ExcitedGroup> _currentRunExcitedGroups = new();
|
||||
|
||||
[ViewVariables]
|
||||
private Queue<IPipeNet> _currentRunPipeNet = new Queue<IPipeNet>();
|
||||
private Queue<IPipeNet> _currentRunPipeNet = new();
|
||||
|
||||
[ViewVariables]
|
||||
private Queue<PipeNetDeviceComponent> _currentRunPipeNetDevice = new Queue<PipeNetDeviceComponent>();
|
||||
private Queue<PipeNetDeviceComponent> _currentRunPipeNetDevice = new();
|
||||
|
||||
[ViewVariables]
|
||||
private ProcessState _state = ProcessState.TileEqualize;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
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)
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
/// Used to track how long each reagent has been in the stomach
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private readonly List<ReagentDelta> _reagentDeltas = new List<ReagentDelta>();
|
||||
private readonly List<ReagentDelta> _reagentDeltas = new();
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Server.GameObjects.Components.Body
|
||||
/// </summary>
|
||||
private BodyScannerUIState InterfaceState(IBody body)
|
||||
{
|
||||
return new BodyScannerUIState(body.Owner.Uid);
|
||||
return new(body.Owner.Uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.Components.Body.Part
|
||||
[ComponentReference(typeof(IBodyPart))]
|
||||
public class BodyPartComponent : SharedBodyPartComponent, IAfterInteract
|
||||
{
|
||||
private readonly Dictionary<int, object> _optionsCache = new Dictionary<int, object>();
|
||||
private readonly Dictionary<int, object> _optionsCache = new();
|
||||
private IBody? _owningBodyCache;
|
||||
private int _idHash;
|
||||
private IEntity? _surgeonCache;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.GameObjects.Components.Body
|
||||
public override string Name => "SurgeryTool";
|
||||
public override uint? NetID => ContentNetIDs.SURGERY;
|
||||
|
||||
private readonly Dictionary<int, object> _optionsCache = new Dictionary<int, object>();
|
||||
private readonly Dictionary<int, object> _optionsCache = new();
|
||||
|
||||
private float _baseOperateTime;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
[ViewVariables] private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||
|
||||
[ViewVariables] private readonly SolutionContainerComponent BufferSolution = new SolutionContainerComponent();
|
||||
[ViewVariables] private readonly SolutionContainerComponent BufferSolution = new();
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ChemMasterUiKey.Key);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components
|
||||
[ViewVariables] private BoundUserInterface UserInterface => Owner.GetUIOrNull(ConfigurationUiKey.Key);
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<string, string> _config = new Dictionary<string, string>();
|
||||
private readonly Dictionary<string, string> _config = new();
|
||||
|
||||
private Regex _validation;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
private string _startingNodeIdentifier = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
private HashSet<string> _containers = new HashSet<string>();
|
||||
private HashSet<string> _containers = new();
|
||||
[ViewVariables]
|
||||
private List<List<ConstructionGraphStep>>? _edgeNestedStepProgress = null;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
private ActSystem _actSystem;
|
||||
|
||||
public override List<DamageState> SupportedDamageStates =>
|
||||
new List<DamageState> {DamageState.Alive, DamageState.Dead};
|
||||
new() {DamageState.Alive, DamageState.Dead};
|
||||
|
||||
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
|
||||
/* Set in YAML */
|
||||
protected int Damage;
|
||||
private List<ToolQuality> _tools = new List<ToolQuality>();
|
||||
private List<ToolQuality> _tools = new();
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
protected string DestroySoundCollection { get; private set; }
|
||||
|
||||
public override List<DamageState> SupportedDamageStates =>
|
||||
new List<DamageState> {DamageState.Alive, DamageState.Dead};
|
||||
new() {DamageState.Alive, DamageState.Dead};
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// A list of tags attached to the content, used for sorting
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public HashSet<string> Tags { get; set; } = new HashSet<string>();
|
||||
public HashSet<string> Tags { get; set; } = new();
|
||||
|
||||
private bool CanInsert(IEntity entity)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
[ViewVariables]
|
||||
private TimeSpan _lastExitAttempt;
|
||||
|
||||
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
|
||||
public static readonly Regex TagRegex = new("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// The current pressure of this disposal unit.
|
||||
@@ -101,7 +101,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
[ViewVariables] public IReadOnlyList<IEntity> ContainedEntities => _container.ContainedEntities;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly List<string> _targetList = new List<string>();
|
||||
private readonly List<string> _targetList = new();
|
||||
|
||||
[ViewVariables]
|
||||
private string _target = "";
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
public override string Name => "DisposalRouter";
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<string> _tags = new HashSet<string>();
|
||||
private readonly HashSet<string> _tags = new();
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// <returns>Returns a <see cref="DisposalTaggerUserInterfaceState"/></returns>
|
||||
private DisposalTaggerUserInterfaceState GetUserInterfaceState()
|
||||
{
|
||||
return new DisposalTaggerUserInterfaceState(_tag);
|
||||
return new(_tag);
|
||||
}
|
||||
|
||||
private void UpdateUserInterface()
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Server.GameObjects.Components
|
||||
public sealed class DoAfterComponent : SharedDoAfterComponent
|
||||
{
|
||||
public IReadOnlyCollection<DoAfter> DoAfters => _doAfters.Keys;
|
||||
private readonly Dictionary<DoAfter, byte> _doAfters = new Dictionary<DoAfter, byte>();
|
||||
private readonly Dictionary<DoAfter, byte> _doAfters = new();
|
||||
|
||||
// So the client knows which one to update (and so we don't send all of the do_afters every time 1 updates)
|
||||
// we'll just send them the index. Doesn't matter if it wraps around.
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
/// </summary>
|
||||
private static readonly TimeSpan PowerWiresTimeout = TimeSpan.FromSeconds(5.0);
|
||||
|
||||
private CancellationTokenSource _powerWiresPulsedTimerCancel = new CancellationTokenSource();
|
||||
private CancellationTokenSource _powerWiresPulsedTimerCancel = new();
|
||||
|
||||
private bool _powerWiresPulsed;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
protected float CloseSpeed = AutoCloseDelay;
|
||||
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly CancellationTokenSource _cancellationTokenSource = new();
|
||||
|
||||
protected virtual TimeSpan CloseTimeOne => TimeSpan.FromSeconds(0.3f);
|
||||
protected virtual TimeSpan CloseTimeTwo => TimeSpan.FromSeconds(0.9f);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables] private readonly List<Hand> _hands = new List<Hand>();
|
||||
[ViewVariables] private readonly List<Hand> _hands = new();
|
||||
|
||||
public IEnumerable<string> Hands => _hands.Select(h => h.Name);
|
||||
|
||||
@@ -744,7 +744,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
|
||||
public SharedHand ToShared(int index, HandLocation location)
|
||||
{
|
||||
return new SharedHand(index, Name, Entity?.Uid, location, Enabled);
|
||||
return new(index, Name, Entity?.Uid, location, Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.Components.GUI
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<Slots, ContainerSlot> _slotContainers = new Dictionary<Slots, ContainerSlot>();
|
||||
private readonly Dictionary<Slots, ContainerSlot> _slotContainers = new();
|
||||
|
||||
private KeyValuePair<Slots, (EntityUid entity, bool fits)>? _hoverEntity;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Headset
|
||||
|
||||
private RadioSystem _radioSystem = default!;
|
||||
|
||||
private List<int> _channels = new List<int>();
|
||||
private List<int> _channels = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private int BroadcastFrequency { get; set; }
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
[RegisterComponent]
|
||||
public class ExpendableLightComponent : SharedExpendableLightComponent, IUse
|
||||
{
|
||||
private static readonly AudioParams LoopedSoundParams = new AudioParams(0, 1, "Master", 62.5f, 1, AudioMixTarget.Stereo, true, 0.3f);
|
||||
private static readonly AudioParams LoopedSoundParams = new(0, 1, "Master", 62.5f, 1, AudioMixTarget.Stereo, true, 0.3f);
|
||||
|
||||
/// <summary>
|
||||
/// Status of light, whether or not it is emitting light.
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
private bool _storageInitialCalculated;
|
||||
private int _storageUsed;
|
||||
private int _storageCapacityMax;
|
||||
public readonly HashSet<IPlayerSession> SubscribedSessions = new HashSet<IPlayerSession>();
|
||||
public readonly HashSet<IPlayerSession> SubscribedSessions = new();
|
||||
|
||||
[ViewVariables]
|
||||
public override IReadOnlyList<IEntity>? StoredEntities => _storage?.ContainedEntities;
|
||||
|
||||
@@ -24,10 +24,10 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
public override string Name => "ConditionalSpawner";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<string> Prototypes { get; set; } = new List<string>();
|
||||
public List<string> Prototypes { get; set; } = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private readonly List<string> _gameRules = new List<string>();
|
||||
private readonly List<string> _gameRules = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Chance { get; set; } = 1.0f;
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
public override string Name => "TimedSpawner";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<string> Prototypes { get; set; } = new List<string>();
|
||||
public List<string> Prototypes { get; set; } = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Chance { get; set; } = 1.0f;
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
public override string Name => "TrashSpawner";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<string> RarePrototypes { get; set; } = new List<string>();
|
||||
public List<string> RarePrototypes { get; set; } = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private List<string> _gameRules = new List<string>();
|
||||
private List<string> _gameRules = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float RareChance { get; set; } = 0.05f;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
private TimeSpan _lastInternalOpenAttempt;
|
||||
|
||||
private ContainerSlot _bodyContainer = default!;
|
||||
private readonly Vector2 _ejectOffset = new Vector2(0f, 0f);
|
||||
private readonly Vector2 _ejectOffset = new(0f, 0f);
|
||||
|
||||
[ViewVariables]
|
||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||
@@ -95,7 +95,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
}
|
||||
|
||||
private static readonly MedicalScannerBoundUserInterfaceState EmptyUIState =
|
||||
new MedicalScannerBoundUserInterfaceState(
|
||||
new(
|
||||
null,
|
||||
new Dictionary<DamageClass, int>(),
|
||||
new Dictionary<DamageType, int>(),
|
||||
|
||||
@@ -43,11 +43,11 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _suffocationDamage;
|
||||
|
||||
[ViewVariables] public Dictionary<Gas, float> NeedsGases { get; set; } = new Dictionary<Gas, float>();
|
||||
[ViewVariables] public Dictionary<Gas, float> NeedsGases { get; set; } = new();
|
||||
|
||||
[ViewVariables] public Dictionary<Gas, float> ProducesGases { get; set; } = new Dictionary<Gas, float>();
|
||||
[ViewVariables] public Dictionary<Gas, float> ProducesGases { get; set; } = new();
|
||||
|
||||
[ViewVariables] public Dictionary<Gas, float> DeficitGases { get; set; } = new Dictionary<Gas, float>();
|
||||
[ViewVariables] public Dictionary<Gas, float> DeficitGases { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Heat generated due to metabolism. It's generated via metabolism
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<OverlayContainer> ActiveOverlays { get; } = new List<OverlayContainer>();
|
||||
public List<OverlayContainer> ActiveOverlays { get; } = new();
|
||||
|
||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession session = null)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
[Dependency] private readonly IComponentManager _componentManager = default!;
|
||||
|
||||
public static readonly Regex SentenceRegex = new Regex(@"(?<=[\.!\?])");
|
||||
public static readonly Regex SentenceRegex = new(@"(?<=[\.!\?])");
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Mobs.Speech
|
||||
}.AsReadOnly();
|
||||
private string RandomFace => _random.Pick(Faces);
|
||||
|
||||
private static readonly Dictionary<string, string> SpecialWords = new Dictionary<string, string>
|
||||
private static readonly Dictionary<string, string> SpecialWords = new()
|
||||
{
|
||||
{ "you", "wu" },
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.GameObjects.Components.Mobs.State
|
||||
[ComponentReference(typeof(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.Critical, new CriticalState()},
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Dictionary<HungerThreshold, float> HungerThresholds => _hungerThresholds;
|
||||
private readonly Dictionary<HungerThreshold, float> _hungerThresholds = new Dictionary<HungerThreshold, float>
|
||||
private readonly Dictionary<HungerThreshold, float> _hungerThresholds = new()
|
||||
{
|
||||
{HungerThreshold.Overfed, 600.0f},
|
||||
{HungerThreshold.Okay, 450.0f},
|
||||
@@ -70,7 +70,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
}
|
||||
|
||||
|
||||
public static readonly Dictionary<HungerThreshold, AlertType> HungerThresholdAlertTypes = new Dictionary<HungerThreshold, AlertType>
|
||||
public static readonly Dictionary<HungerThreshold, AlertType> HungerThresholdAlertTypes = new()
|
||||
{
|
||||
{ HungerThreshold.Overfed, AlertType.Overfed },
|
||||
{ HungerThreshold.Peckish, AlertType.Peckish },
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
private float _currentThirst;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public Dictionary<ThirstThreshold, float> ThirstThresholds { get; } = new Dictionary<ThirstThreshold, float>
|
||||
public Dictionary<ThirstThreshold, float> ThirstThresholds { get; } = new()
|
||||
{
|
||||
{ThirstThreshold.OverHydrated, 600.0f},
|
||||
{ThirstThreshold.Okay, 450.0f},
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
{ThirstThreshold.Dead, 0.0f},
|
||||
};
|
||||
|
||||
public static readonly Dictionary<ThirstThreshold, AlertType> ThirstThresholdAlertTypes = new Dictionary<ThirstThreshold, AlertType>
|
||||
public static readonly Dictionary<ThirstThreshold, AlertType> ThirstThresholdAlertTypes = new()
|
||||
{
|
||||
{ThirstThreshold.OverHydrated, AlertType.Overhydrated},
|
||||
{ThirstThreshold.Thirsty, AlertType.Thirsty},
|
||||
|
||||
@@ -441,7 +441,7 @@ namespace Content.Server.GameObjects.Components.PDA
|
||||
private sealed class PdaAccessSet : ISet<string>
|
||||
{
|
||||
private readonly PDAComponent _pdaComponent;
|
||||
private static readonly HashSet<string> EmptySet = new HashSet<string>();
|
||||
private static readonly HashSet<string> EmptySet = new();
|
||||
|
||||
public PdaAccessSet(PDAComponent pdaComponent)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.Components.Portal
|
||||
[ViewVariables] private bool _onCooldown;
|
||||
[ViewVariables] private string _departureSound = "";
|
||||
[ViewVariables] private string _arrivalSound = "";
|
||||
public readonly List<IEntity> ImmuneEntities = new List<IEntity>(); // K
|
||||
public readonly List<IEntity> ImmuneEntities = new(); // K
|
||||
[ViewVariables(VVAccess.ReadWrite)] private float _aliveTime;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<PowerReceiverComponent> LinkedReceivers => _linkedReceivers;
|
||||
private List<PowerReceiverComponent> _linkedReceivers = new List<PowerReceiverComponent>();
|
||||
private List<PowerReceiverComponent> _linkedReceivers = new();
|
||||
|
||||
/// <summary>
|
||||
/// If <see cref="PowerReceiverComponent"/>s should consider connecting to this.
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
||||
On
|
||||
}
|
||||
|
||||
public Dictionary<EmergencyLightState, string> BatteryStateText = new Dictionary<EmergencyLightState, string>
|
||||
public Dictionary<EmergencyLightState, string> BatteryStateText = new()
|
||||
{
|
||||
{ EmergencyLightState.Full, "[color=darkgreen]Full[/color]"},
|
||||
{ EmergencyLightState.Empty, "[color=darkred]Empty[/color]"},
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components.Power.PowerNetComponents
|
||||
|
||||
public class PowerNetManager : IPowerNetManager
|
||||
{
|
||||
private readonly HashSet<IPowerNet> _dirtyPowerNets = new HashSet<IPowerNet>();
|
||||
private readonly HashSet<IPowerNet> _dirtyPowerNets = new();
|
||||
|
||||
public void AddDirtyPowerNet(IPowerNet powerNet)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.GameObjects.Components.Radio
|
||||
private RadioSystem _radioSystem = default!;
|
||||
|
||||
private bool _radioOn;
|
||||
private List<int> _channels = new List<int>();
|
||||
private List<int> _channels = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private int BroadcastFrequency { get; set; }
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Recycling
|
||||
{
|
||||
public override string Name => "Recycler";
|
||||
|
||||
private readonly List<IEntity> _intersecting = new List<IEntity>();
|
||||
private readonly List<IEntity> _intersecting = new();
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not sentient beings will be recycled
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
public const int VolumePerSheet = 3750;
|
||||
|
||||
[ViewVariables]
|
||||
public Queue<LatheRecipePrototype> Queue { get; } = new Queue<LatheRecipePrototype>();
|
||||
public Queue<LatheRecipePrototype> Queue { get; } = new();
|
||||
|
||||
[ViewVariables]
|
||||
public bool Producing { get; private set; }
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
public class MaterialStorageComponent : SharedMaterialStorageComponent
|
||||
{
|
||||
[ViewVariables]
|
||||
protected override Dictionary<string, int> Storage { get; set; } = new Dictionary<string, int>();
|
||||
protected override Dictionary<string, int> Storage { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// How much material the storage can store in total.
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace Content.Server.GameObjects.Components.Research
|
||||
public IReadOnlyList<TechnologyPrototype> UnlockedTechnologies => Database.Technologies;
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public List<ResearchPointSourceComponent> PointSources { get; } = new List<ResearchPointSourceComponent>();
|
||||
public List<ResearchPointSourceComponent> PointSources { get; } = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public List<ResearchClientComponent> Clients { get; } = new List<ResearchClientComponent>();
|
||||
public List<ResearchClientComponent> Clients { get; } = new();
|
||||
|
||||
public int Point => _points;
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
{
|
||||
public readonly ContainmentFieldGeneratorComponent Generator1;
|
||||
public readonly ContainmentFieldGeneratorComponent Generator2;
|
||||
private readonly List<IEntity> _fields = new List<IEntity>();
|
||||
private readonly List<IEntity> _fields = new();
|
||||
private int _sharedEnergyPool;
|
||||
private readonly CancellationTokenSource _powerDecreaseCancellationTokenSource = new CancellationTokenSource();
|
||||
private readonly CancellationTokenSource _powerDecreaseCancellationTokenSource = new();
|
||||
public int SharedEnergyPool
|
||||
{
|
||||
get => _sharedEnergyPool;
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
_singularityController?.Push(pushVector.Normalized, 2);
|
||||
}
|
||||
|
||||
private readonly List<IEntity> _previousPulledEntities = new List<IEntity>();
|
||||
private readonly List<IEntity> _previousPulledEntities = new();
|
||||
public void PullUpdate()
|
||||
{
|
||||
foreach (var previousPulledEntity in _previousPulledEntities)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Suspicion
|
||||
public class SuspicionRoleComponent : SharedSuspicionRoleComponent, IExamine
|
||||
{
|
||||
private Role? _role;
|
||||
private readonly HashSet<SuspicionRoleComponent> _allies = new HashSet<SuspicionRoleComponent>();
|
||||
private readonly HashSet<SuspicionRoleComponent> _allies = new();
|
||||
|
||||
[ViewVariables]
|
||||
public Role? Role
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
{
|
||||
public override string Name => "RangedMagazine";
|
||||
|
||||
private readonly Stack<IEntity> _spawnedAmmo = new Stack<IEntity>();
|
||||
private readonly Stack<IEntity> _spawnedAmmo = new();
|
||||
private Container _ammoContainer;
|
||||
|
||||
public int ShotsLeft => _spawnedAmmo.Count + _unspawnedCount;
|
||||
|
||||
@@ -118,22 +118,22 @@ namespace Content.Server.GameObjects.Components
|
||||
/// Contains all registered wires.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly List<Wire> WiresList = new List<Wire>();
|
||||
public readonly List<Wire> WiresList = new();
|
||||
|
||||
/// <summary>
|
||||
/// Status messages are displayed at the bottom of the UI.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<object, object> _statuses = new Dictionary<object, object>();
|
||||
private readonly Dictionary<object, object> _statuses = new();
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="AssignAppearance"/> and <see cref="WiresBuilder.CreateWire"/>.
|
||||
/// </summary>
|
||||
private readonly List<WireColor> _availableColors =
|
||||
new List<WireColor>((WireColor[]) Enum.GetValues(typeof(WireColor)));
|
||||
new((WireColor[]) Enum.GetValues(typeof(WireColor)));
|
||||
|
||||
private readonly List<WireLetter> _availableLetters =
|
||||
new List<WireLetter>((WireLetter[]) Enum.GetValues(typeof(WireLetter)));
|
||||
new((WireLetter[]) Enum.GetValues(typeof(WireLetter)));
|
||||
|
||||
private string _boardName = default!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user