diff --git a/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs index 3c2e949562..3584810116 100644 --- a/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Client/GameObjects/Components/Buckle/BuckleComponent.cs @@ -14,7 +14,7 @@ namespace Content.Client.GameObjects.Components.Buckle public override bool Buckled => _buckled; - public override bool TryBuckle(IEntity user, IEntity to) + public override bool TryBuckle(IEntity? user, IEntity to) { // TODO: Prediction return false; diff --git a/Content.Client/GameObjects/Components/Observer/GhostRoles/GhostRolesWindow.xaml.cs b/Content.Client/GameObjects/Components/Observer/GhostRoles/GhostRolesWindow.xaml.cs index 3265f7c461..df3f34d217 100644 --- a/Content.Client/GameObjects/Components/Observer/GhostRoles/GhostRolesWindow.xaml.cs +++ b/Content.Client/GameObjects/Components/Observer/GhostRoles/GhostRolesWindow.xaml.cs @@ -1,5 +1,4 @@ using System; -using Content.Shared.GameObjects.Components.Observer; using Content.Shared.GameObjects.Components.Observer.GhostRoles; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.CustomControls; diff --git a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs index 787a506322..9e06587891 100644 --- a/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/DragDropSystem.cs @@ -119,48 +119,60 @@ namespace Content.Client.GameObjects.EntitySystems private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args) { - var dragger = args.Session?.AttachedEntity; + if (args.Session?.AttachedEntity == null) + { + return false; + } + + var dragger = args.Session.AttachedEntity; // cancel any current dragging if there is one (shouldn't be because they would've had to have lifted // the mouse, canceling the drag, but just being cautious) _dragDropHelper.EndDrag(); // possibly initiating a drag // check if the clicked entity is draggable - if (EntityManager.TryGetEntity(args.EntityUid, out var entity)) + if (!EntityManager.TryGetEntity(args.EntityUid, out var entity)) { - // check if the entity is reachable - if (!_interactionSystem.InRangeUnobstructed(dragger, entity)) - { - return false; - } - - var canDrag = false; - foreach (var draggable in entity.GetAllComponents()) - { - var dragEventArgs = new StartDragDropEventArgs(dragger, entity); - if (draggable.CanStartDrag(dragEventArgs)) - { - _draggables.Add(draggable); - canDrag = true; - } - } - - if (canDrag) - { - // wait to initiate a drag - _dragDropHelper.MouseDown(entity); - _dragger = dragger; - _mouseDownTime = 0; - // don't want anything else to process the click, - // but we will save the event so we can "re-play" it if this drag does - // not turn into an actual drag so the click can be handled normally - _savedMouseDown = args; - } - - return canDrag; + return false; } - return false; + // check if the entity is reachable + if (!_interactionSystem.InRangeUnobstructed(dragger, entity)) + { + return false; + } + + var canDrag = false; + foreach (var draggable in entity.GetAllComponents()) + { + var dragEventArgs = new StartDragDropEventArgs(dragger, entity); + + if (!draggable.CanStartDrag(dragEventArgs)) + { + continue; + } + + _draggables.Add(draggable); + canDrag = true; + } + + if (!canDrag) + { + return false; + } + + // wait to initiate a drag + _dragDropHelper.MouseDown(entity); + _dragger = dragger; + _mouseDownTime = 0; + + // don't want anything else to process the click, + // but we will save the event so we can "re-play" it if this drag does + // not turn into an actual drag so the click can be handled normally + _savedMouseDown = args; + + return true; + } private bool OnBeginDrag() @@ -279,7 +291,7 @@ namespace Content.Client.GameObjects.EntitySystems return false; } - // now when ending the drag, we will not replay the click because + // now when ending the drag, we will not replay the click because // by this time we've determined the input was actually a drag attempt var range = (args.Coordinates.ToMapPos(EntityManager) - _dragger.Transform.MapPosition.Position).Length + 0.01f; // tell the server we are dropping if we are over a valid drop target in range. @@ -384,7 +396,7 @@ namespace Content.Client.GameObjects.EntitySystems var valid = (bool?) null; // check if it's able to be dropped on by current dragged entity - var dropArgs = new DragDropEventArgs(_dragger, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity); + var dropArgs = new DragDropEventArgs(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity); foreach (var comp in pvsEntity.GetAllComponents()) { diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs index 94c8d49230..cfb582a447 100644 --- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs +++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs @@ -238,7 +238,7 @@ namespace Content.Server.GameObjects.Components.Buckle return true; } - public override bool TryBuckle(IEntity user, IEntity to) + public override bool TryBuckle(IEntity? user, IEntity to) { if (!CanBuckle(user, to, out var strap)) { diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 4c58b7b242..2a6471181e 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -222,7 +222,7 @@ namespace Content.Server.GameObjects.Components.Chemistry if (beaker == null) { return new ReagentDispenserBoundUserInterfaceState(Powered, false, ReagentUnit.New(0), ReagentUnit.New(0), - "", Inventory, Owner.Name, null, _dispenseAmount); + string.Empty, Inventory, Owner.Name, null, _dispenseAmount); } var solution = beaker.GetComponent(); diff --git a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs index ba5751297e..d9ee7f7177 100644 --- a/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs +++ b/Content.Server/GameObjects/Components/Disposal/DisposalMailingUnitComponent.cs @@ -95,10 +95,10 @@ namespace Content.Server.GameObjects.Components.Disposal private readonly List _targetList = new(); [ViewVariables] - private string _target = ""; + private string? _target; [ViewVariables(VVAccess.ReadWrite)] - private string _tag = ""; + private string _tag = string.Empty; [ViewVariables] public bool Powered => @@ -288,6 +288,11 @@ namespace Content.Server.GameObjects.Components.Disposal _container.Remove(entity); } + if (_target == null) + { + return false; + } + var holder = CreateTaggedHolder(entities, _target); entryComponent.TryInsert(holder); @@ -441,7 +446,7 @@ namespace Content.Server.GameObjects.Components.Disposal } } - if (obj.Message is UiTargetUpdateMessage tagMessage && TagRegex.IsMatch(tagMessage.Target)) + if (obj.Message is UiTargetUpdateMessage tagMessage && TagRegex.IsMatch(tagMessage.Target ?? string.Empty)) { _target = tagMessage.Target; } @@ -714,6 +719,11 @@ namespace Content.Server.GameObjects.Components.Disposal bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs) { + if (eventArgs.User == null) + { + return false; + } + if (!eventArgs.User.TryGetComponent(out IActorComponent? actor)) { return false; diff --git a/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs b/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs index 4ff91f8059..56875893b1 100644 --- a/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs +++ b/Content.Server/GameObjects/Components/GUI/StrippableComponent.cs @@ -76,6 +76,11 @@ namespace Content.Server.GameObjects.Components.GUI public override bool Drop(DragDropEventArgs args) { + if (args.User == null) + { + return false; + } + if (!args.User.TryGetComponent(out IActorComponent? actor)) return false; OpenUserInterface(actor.playerSession); diff --git a/Content.Shared/AI/SharedAiDebug.cs b/Content.Shared/AI/SharedAiDebug.cs index 87d31ece09..2ecb1e9c55 100644 --- a/Content.Shared/AI/SharedAiDebug.cs +++ b/Content.Shared/AI/SharedAiDebug.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Access/AccessLevelPrototype.cs b/Content.Shared/Access/AccessLevelPrototype.cs index fec1477147..55673f794c 100644 --- a/Content.Shared/Access/AccessLevelPrototype.cs +++ b/Content.Shared/Access/AccessLevelPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -26,11 +27,11 @@ namespace Content.Shared.Access Name = Loc.GetString(Name); } - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// The player-visible name of the access level, in the ID card console and such. /// - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; } } diff --git a/Content.Shared/Actions/ActionManager.cs b/Content.Shared/Actions/ActionManager.cs index dd9e3fe893..fb03725407 100644 --- a/Content.Shared/Actions/ActionManager.cs +++ b/Content.Shared/Actions/ActionManager.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Robust.Shared.IoC; using Robust.Shared.Log; @@ -14,12 +16,11 @@ namespace Content.Shared.Actions [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - private Dictionary _typeToAction; - private Dictionary _typeToItemAction; + private readonly Dictionary _typeToAction = new(); + private readonly Dictionary _typeToItemAction = new(); public void Initialize() { - _typeToAction = new Dictionary(); foreach (var action in _prototypeManager.EnumeratePrototypes()) { if (!_typeToAction.TryAdd(action.ActionType, action)) @@ -30,7 +31,6 @@ namespace Content.Shared.Actions } } - _typeToItemAction = new Dictionary(); foreach (var action in _prototypeManager.EnumeratePrototypes()) { if (!_typeToItemAction.TryAdd(action.ActionType, action)) @@ -53,7 +53,7 @@ namespace Content.Shared.Actions /// Tries to get the action of the indicated type /// /// true if found - public bool TryGet(ActionType actionType, out ActionPrototype action) + public bool TryGet(ActionType actionType, [NotNullWhen(true)] out ActionPrototype? action) { return _typeToAction.TryGetValue(actionType, out action); } @@ -62,7 +62,7 @@ namespace Content.Shared.Actions /// Tries to get the item action of the indicated type /// /// true if found - public bool TryGet(ItemActionType actionType, out ItemActionPrototype action) + public bool TryGet(ItemActionType actionType, [NotNullWhen(true)] out ItemActionPrototype? action) { return _typeToItemAction.TryGetValue(actionType, out action); } diff --git a/Content.Shared/Actions/ActionPrototype.cs b/Content.Shared/Actions/ActionPrototype.cs index c5f5d7a0bc..b0b02669d4 100644 --- a/Content.Shared/Actions/ActionPrototype.cs +++ b/Content.Shared/Actions/ActionPrototype.cs @@ -1,4 +1,5 @@ -using Content.Shared.Interfaces; +#nullable enable +using Content.Shared.Interfaces; using Robust.Shared.IoC; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -24,28 +25,28 @@ namespace Content.Shared.Actions /// action. Null if this is not an Instant ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public IInstantAction InstantAction { get; private set; } + public IInstantAction InstantAction { get; private set; } = default!; /// /// The IToggleAction that should be invoked when performing this /// action. Null if this is not a Toggle ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public IToggleAction ToggleAction { get; private set; } + public IToggleAction ToggleAction { get; private set; } = default!; /// /// The ITargetEntityAction that should be invoked when performing this /// action. Null if this is not a TargetEntity ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public ITargetEntityAction TargetEntityAction { get; private set; } + public ITargetEntityAction TargetEntityAction { get; private set; } = default!; /// /// The ITargetPointAction that should be invoked when performing this /// action. Null if this is not a TargetPoint ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public ITargetPointAction TargetPointAction { get; private set; } + public ITargetPointAction TargetPointAction { get; private set; } = default!; public override void LoadFrom(YamlMappingNode mapping) { @@ -61,7 +62,7 @@ namespace Content.Shared.Actions // TODO: Split this class into server/client after RobustToolbox#1405 if (IoCManager.Resolve().IsClientModule) return; - IActionBehavior behavior = null; + IActionBehavior? behavior = null; serializer.DataField(ref behavior, "behavior", null); switch (behavior) { diff --git a/Content.Shared/Actions/ActionType.cs b/Content.Shared/Actions/ActionType.cs index db95f165ee..78fb858c8d 100644 --- a/Content.Shared/Actions/ActionType.cs +++ b/Content.Shared/Actions/ActionType.cs @@ -1,4 +1,5 @@ -namespace Content.Shared.Actions +#nullable enable +namespace Content.Shared.Actions { /// /// Every possible action. Corresponds to actionType in action prototypes. diff --git a/Content.Shared/Actions/BaseActionPrototype.cs b/Content.Shared/Actions/BaseActionPrototype.cs index 3279258d49..b39319c989 100644 --- a/Content.Shared/Actions/BaseActionPrototype.cs +++ b/Content.Shared/Actions/BaseActionPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using System.Linq; @@ -15,41 +16,41 @@ namespace Content.Shared.Actions /// public abstract class BaseActionPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// Icon representing this action in the UI. /// [ViewVariables] - public SpriteSpecifier Icon { get; private set; } + public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid; /// /// For toggle actions only, icon to show when toggled on. If omitted, /// the action will simply be highlighted when turned on. /// [ViewVariables] - public SpriteSpecifier IconOn { get; private set; } + public SpriteSpecifier IconOn { get; private set; } = SpriteSpecifier.Invalid; /// /// Name to show in UI. Accepts formatting. /// - public FormattedMessage Name { get; private set; } + public FormattedMessage Name { get; private set; } = new(); /// /// Description to show in UI. Accepts formatting. /// - public FormattedMessage Description { get; private set; } + public FormattedMessage Description { get; private set; } = new(); /// /// Requirements message to show in UI. Accepts formatting, but generally should be avoided /// so the requirements message isn't too prominent in the tooltip. /// - public string Requires { get; private set; } + public string Requires { get; private set; } = string.Empty; /// /// The type of behavior this action has. This is valid clientside and serverside. /// - public BehaviorType BehaviorType { get; protected set; } + public BehaviorType BehaviorType { get; protected set; } = BehaviorType.None; /// /// For targetpoint or targetentity actions, if this is true the action will remain @@ -73,12 +74,12 @@ namespace Content.Shared.Actions /// /// Filters that can be used to filter this item in action menu. /// - public IEnumerable Filters { get; private set; } + public IEnumerable Filters { get; private set; } = new List(); /// /// Keywords that can be used to search this item in action menu. /// - public IEnumerable Keywords { get; private set; } + public IEnumerable Keywords { get; private set; } = new List(); /// /// True if this is an action that requires selecting a target @@ -99,7 +100,7 @@ namespace Content.Shared.Actions serializer.DataReadFunction("description", string.Empty, s => Description = FormattedMessage.FromMarkup(s)); - serializer.DataField(this, x => x.Requires,"requires", null); + serializer.DataField(this, x => x.Requires,"requires", string.Empty); serializer.DataField(this, x => x.Icon,"icon", SpriteSpecifier.Invalid); serializer.DataField(this, x => x.IconOn,"iconOn", SpriteSpecifier.Invalid); diff --git a/Content.Shared/Actions/IActionBehavior.cs b/Content.Shared/Actions/IActionBehavior.cs index 60dec460ae..674186620c 100644 --- a/Content.Shared/Actions/IActionBehavior.cs +++ b/Content.Shared/Actions/IActionBehavior.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Mobs; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -27,7 +28,7 @@ namespace Content.Shared.Actions /// /// Actions component of the performer. /// - public readonly SharedActionsComponent PerformerActions; + public readonly SharedActionsComponent? PerformerActions; public ActionEventArgs(IEntity performer, ActionType actionType) { diff --git a/Content.Shared/Actions/IInstantAction.cs b/Content.Shared/Actions/IInstantAction.cs index b71e066569..fb8304a4c0 100644 --- a/Content.Shared/Actions/IInstantAction.cs +++ b/Content.Shared/Actions/IInstantAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/IInstantItemAction.cs b/Content.Shared/Actions/IInstantItemAction.cs index 8b7dd62d39..616695fdf1 100644 --- a/Content.Shared/Actions/IInstantItemAction.cs +++ b/Content.Shared/Actions/IInstantItemAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/IItemActionBehavior.cs b/Content.Shared/Actions/IItemActionBehavior.cs index 3056f682e6..844ad604bd 100644 --- a/Content.Shared/Actions/IItemActionBehavior.cs +++ b/Content.Shared/Actions/IItemActionBehavior.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Mobs; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -34,7 +35,7 @@ namespace Content.Shared.Actions /// /// Item actions component of the item. /// - public readonly ItemActionsComponent ItemActions; + public readonly ItemActionsComponent? ItemActions; public ItemActionEventArgs(IEntity performer, IEntity item, ItemActionType actionType) { diff --git a/Content.Shared/Actions/ITargetEntityAction.cs b/Content.Shared/Actions/ITargetEntityAction.cs index 538da92843..728ad143c2 100644 --- a/Content.Shared/Actions/ITargetEntityAction.cs +++ b/Content.Shared/Actions/ITargetEntityAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/ITargetEntityItemAction.cs b/Content.Shared/Actions/ITargetEntityItemAction.cs index b12c0f81ef..079f863bca 100644 --- a/Content.Shared/Actions/ITargetEntityItemAction.cs +++ b/Content.Shared/Actions/ITargetEntityItemAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/ITargetPointAction.cs b/Content.Shared/Actions/ITargetPointAction.cs index d4a566438c..8d36f30f74 100644 --- a/Content.Shared/Actions/ITargetPointAction.cs +++ b/Content.Shared/Actions/ITargetPointAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Map; namespace Content.Shared.Actions diff --git a/Content.Shared/Actions/ITargetPointItemAction.cs b/Content.Shared/Actions/ITargetPointItemAction.cs index a1d4ec6b24..34e302434f 100644 --- a/Content.Shared/Actions/ITargetPointItemAction.cs +++ b/Content.Shared/Actions/ITargetPointItemAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Map; namespace Content.Shared.Actions diff --git a/Content.Shared/Actions/IToggleAction.cs b/Content.Shared/Actions/IToggleAction.cs index 8d5b4b76ac..89966990ce 100644 --- a/Content.Shared/Actions/IToggleAction.cs +++ b/Content.Shared/Actions/IToggleAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/IToggleItemAction.cs b/Content.Shared/Actions/IToggleItemAction.cs index aaded89c2c..dbbd6b509f 100644 --- a/Content.Shared/Actions/IToggleItemAction.cs +++ b/Content.Shared/Actions/IToggleItemAction.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Actions { diff --git a/Content.Shared/Actions/ItemActionPrototype.cs b/Content.Shared/Actions/ItemActionPrototype.cs index 25de3910c7..4abe9b628f 100644 --- a/Content.Shared/Actions/ItemActionPrototype.cs +++ b/Content.Shared/Actions/ItemActionPrototype.cs @@ -1,4 +1,5 @@ -using Content.Shared.Interfaces; +#nullable enable +using Content.Shared.Interfaces; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Prototypes; @@ -26,28 +27,28 @@ namespace Content.Shared.Actions /// action. Null if this is not an Instant ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public IInstantItemAction InstantAction { get; private set; } + public IInstantItemAction InstantAction { get; private set; } = default!; /// /// The IToggleItemAction that should be invoked when performing this /// action. Null if this is not a Toggle ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public IToggleItemAction ToggleAction { get; private set; } + public IToggleItemAction ToggleAction { get; private set; } = default!; /// /// The ITargetEntityItemAction that should be invoked when performing this /// action. Null if this is not a TargetEntity ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public ITargetEntityItemAction TargetEntityAction { get; private set; } + public ITargetEntityItemAction TargetEntityAction { get; private set; } = default!; /// /// The ITargetPointItemAction that should be invoked when performing this /// action. Null if this is not a TargetPoint ActionBehaviorType. /// Will be null on client side if the behavior is not in Content.Client. /// - public ITargetPointItemAction TargetPointAction { get; private set; } + public ITargetPointItemAction TargetPointAction { get; private set; } = default!; public override void LoadFrom(YamlMappingNode mapping) { @@ -65,7 +66,7 @@ namespace Content.Shared.Actions // TODO: Split this class into server/client after RobustToolbox#1405 if (IoCManager.Resolve().IsClientModule) return; - IItemActionBehavior behavior = null; + IItemActionBehavior? behavior = null; serializer.DataField(ref behavior, "behavior", null); switch (behavior) { diff --git a/Content.Shared/Administration/AdminAddReagentEuiState.cs b/Content.Shared/Administration/AdminAddReagentEuiState.cs index 25bf03e17c..b148819df2 100644 --- a/Content.Shared/Administration/AdminAddReagentEuiState.cs +++ b/Content.Shared/Administration/AdminAddReagentEuiState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Chemistry; using Content.Shared.Eui; using Robust.Shared.Serialization; @@ -25,7 +26,7 @@ namespace Content.Shared.Administration { public bool CloseAfter; public ReagentUnit Amount; - public string ReagentId; + public string ReagentId = string.Empty; } } } diff --git a/Content.Shared/Administration/AdminFlags.cs b/Content.Shared/Administration/AdminFlags.cs index b458f7a06b..91f69c4384 100644 --- a/Content.Shared/Administration/AdminFlags.cs +++ b/Content.Shared/Administration/AdminFlags.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; namespace Content.Shared.Administration { diff --git a/Content.Shared/Administration/AdminFlagsHelper.cs b/Content.Shared/Administration/AdminFlagsHelper.cs index 5a72d5f65e..7a33c04cfd 100644 --- a/Content.Shared/Administration/AdminFlagsHelper.cs +++ b/Content.Shared/Administration/AdminFlagsHelper.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Linq; using System.Numerics; diff --git a/Content.Shared/Administration/AdminMenu/AdminMenuPlayerListRequest.cs b/Content.Shared/Administration/AdminMenu/AdminMenuPlayerListRequest.cs index f99eb62d91..4669d3ba3e 100644 --- a/Content.Shared/Administration/AdminMenu/AdminMenuPlayerListRequest.cs +++ b/Content.Shared/Administration/AdminMenu/AdminMenuPlayerListRequest.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Administration.AdminMenu diff --git a/Content.Shared/Administration/PermissionsEuiState.cs b/Content.Shared/Administration/PermissionsEuiState.cs index f49778ab60..cf342aa6fe 100644 --- a/Content.Shared/Administration/PermissionsEuiState.cs +++ b/Content.Shared/Administration/PermissionsEuiState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Eui; using Robust.Shared.Network; @@ -11,15 +12,15 @@ namespace Content.Shared.Administration { public bool IsLoading; - public AdminData[] Admins; - public Dictionary AdminRanks; + public AdminData[] Admins = Array.Empty(); + public Dictionary AdminRanks = new(); [Serializable, NetSerializable] public struct AdminData { public NetUserId UserId; - public string UserName; - public string Title; + public string? UserName; + public string? Title; public AdminFlags PosFlags; public AdminFlags NegFlags; public int? RankId; @@ -43,8 +44,8 @@ namespace Content.Shared.Administration [Serializable, NetSerializable] public sealed class AddAdmin : EuiMessageBase { - public string UserNameOrId; - public string Title; + public string UserNameOrId = string.Empty; + public string? Title; public AdminFlags PosFlags; public AdminFlags NegFlags; public int? RankId; @@ -60,7 +61,7 @@ namespace Content.Shared.Administration public sealed class UpdateAdmin : EuiMessageBase { public NetUserId UserId; - public string Title; + public string? Title; public AdminFlags PosFlags; public AdminFlags NegFlags; public int? RankId; @@ -70,7 +71,7 @@ namespace Content.Shared.Administration [Serializable, NetSerializable] public sealed class AddAdminRank : EuiMessageBase { - public string Name; + public string Name = string.Empty; public AdminFlags Flags; } @@ -85,7 +86,7 @@ namespace Content.Shared.Administration { public int Id; - public string Name; + public string Name = string.Empty; public AdminFlags Flags; } } diff --git a/Content.Shared/Administration/SetOutfitEuiState.cs b/Content.Shared/Administration/SetOutfitEuiState.cs index d16d55bb24..92685b54b7 100644 --- a/Content.Shared/Administration/SetOutfitEuiState.cs +++ b/Content.Shared/Administration/SetOutfitEuiState.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.Eui; using Robust.Shared.Serialization; using System; diff --git a/Content.Shared/Alert/AlertManager.cs b/Content.Shared/Alert/AlertManager.cs index 64afd7a998..dbea636ce1 100644 --- a/Content.Shared/Alert/AlertManager.cs +++ b/Content.Shared/Alert/AlertManager.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using Robust.Shared.IoC; using Robust.Shared.Log; using Robust.Shared.Prototypes; @@ -13,12 +15,10 @@ namespace Content.Shared.Alert [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - private Dictionary _typeToAlert; + private readonly Dictionary _typeToAlert = new(); public void Initialize() { - _typeToAlert = new Dictionary(); - foreach (var alert in _prototypeManager.EnumeratePrototypes()) { if (!_typeToAlert.TryAdd(alert.AlertType, alert)) @@ -34,7 +34,7 @@ namespace Content.Shared.Alert /// Tries to get the alert of the indicated type /// /// true if found - public bool TryGet(AlertType alertType, out AlertPrototype alert) + public bool TryGet(AlertType alertType, [NotNullWhen(true)] out AlertPrototype? alert) { return _typeToAlert.TryGetValue(alertType, out alert); } diff --git a/Content.Shared/Alert/AlertOrderPrototype.cs b/Content.Shared/Alert/AlertOrderPrototype.cs index 7e2393efe9..f0ab7022b7 100644 --- a/Content.Shared/Alert/AlertOrderPrototype.cs +++ b/Content.Shared/Alert/AlertOrderPrototype.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -12,7 +13,7 @@ namespace Content.Shared.Alert [Prototype("alertOrder")] public class AlertOrderPrototype : IPrototype, IComparer { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; private readonly Dictionary _typeToIdx = new(); private readonly Dictionary _categoryToIdx = new(); @@ -23,7 +24,7 @@ namespace Content.Shared.Alert serializer.DataField(this, x => x.ID, "id", string.Empty); - if (!mapping.TryGetNode("order", out YamlSequenceNode orderMapping)) return; + if (!mapping.TryGetNode("order", out YamlSequenceNode? orderMapping)) return; var i = 0; foreach (var entryYaml in orderMapping) @@ -56,7 +57,7 @@ namespace Content.Shared.Alert return -1; } - public int Compare(AlertPrototype x, AlertPrototype y) + public int Compare(AlertPrototype? x, AlertPrototype? y) { if ((x == null) && (y == null)) return 0; if (x == null) return 1; diff --git a/Content.Shared/Alert/AlertPrototype.cs b/Content.Shared/Alert/AlertPrototype.cs index 465f1c5d92..c722a65ea3 100644 --- a/Content.Shared/Alert/AlertPrototype.cs +++ b/Content.Shared/Alert/AlertPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Globalization; using Content.Shared.Interfaces; using Robust.Shared.IoC; @@ -17,7 +18,7 @@ namespace Content.Shared.Alert [Prototype("alert")] public class AlertPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// Type of alert, no 2 alert prototypes should have the same one. @@ -31,17 +32,17 @@ namespace Content.Shared.Alert /// to get the correct icon path for a particular severity level. /// [ViewVariables] - public SpriteSpecifier Icon { get; private set; } + public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid; /// /// Name to show in tooltip window. Accepts formatting. /// - public FormattedMessage Name { get; private set; } + public FormattedMessage Name { get; private set; } = new(); /// /// Description to show in tooltip window. Accepts formatting. /// - public FormattedMessage Description { get; private set; } + public FormattedMessage Description { get; private set; } = new(); /// /// Category the alert belongs to. Only one alert of a given category @@ -85,7 +86,7 @@ namespace Content.Shared.Alert /// Defines what to do when the alert is clicked. /// This will always be null on clientside. /// - public IAlertClick OnClick { get; private set; } + public IAlertClick? OnClick { get; private set; } public void LoadFrom(YamlMappingNode mapping) { @@ -198,7 +199,7 @@ namespace Content.Shared.Alert return AlertType == other.AlertType && AlertCategory == other.AlertCategory; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { return obj is AlertKey other && Equals(other); } diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index a4962a1d36..c2c37a8537 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -1,4 +1,5 @@ -namespace Content.Shared.Alert +#nullable enable +namespace Content.Shared.Alert { /// /// Every category of alert. Corresponds to category field in alert prototypes defined in YML diff --git a/Content.Shared/Alert/IAlertClick.cs b/Content.Shared/Alert/IAlertClick.cs index 2629385b4c..516da5df11 100644 --- a/Content.Shared/Alert/IAlertClick.cs +++ b/Content.Shared/Alert/IAlertClick.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/Arcade/BlockGameBlock.cs b/Content.Shared/Arcade/BlockGameBlock.cs index 1f32db1b33..75e248fbf1 100644 --- a/Content.Shared/Arcade/BlockGameBlock.cs +++ b/Content.Shared/Arcade/BlockGameBlock.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Maths; using Robust.Shared.Serialization; diff --git a/Content.Shared/Arcade/BlockGamePlayerAction.cs b/Content.Shared/Arcade/BlockGamePlayerAction.cs index f88b213a56..3b40ab638f 100644 --- a/Content.Shared/Arcade/BlockGamePlayerAction.cs +++ b/Content.Shared/Arcade/BlockGamePlayerAction.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.Arcade diff --git a/Content.Shared/Arcade/BlockGameUiKey.cs b/Content.Shared/Arcade/BlockGameUiKey.cs index 6ffb216668..c2d6880b69 100644 --- a/Content.Shared/Arcade/BlockGameUiKey.cs +++ b/Content.Shared/Arcade/BlockGameUiKey.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.Arcade diff --git a/Content.Shared/Atmos/AtmosDirection.cs b/Content.Shared/Atmos/AtmosDirection.cs index eae089962f..d649247366 100644 --- a/Content.Shared/Atmos/AtmosDirection.cs +++ b/Content.Shared/Atmos/AtmosDirection.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Runtime.CompilerServices; using Robust.Shared.Maths; using Robust.Shared.Serialization; diff --git a/Content.Shared/Atmos/Atmospherics.cs b/Content.Shared/Atmos/Atmospherics.cs index 15661334ad..98310dc8b3 100644 --- a/Content.Shared/Atmos/Atmospherics.cs +++ b/Content.Shared/Atmos/Atmospherics.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Maths; using Robust.Shared.Serialization; using System; diff --git a/Content.Shared/Atmos/GasPrototype.cs b/Content.Shared/Atmos/GasPrototype.cs index 421d6a115b..57ee6dbcf8 100644 --- a/Content.Shared/Atmos/GasPrototype.cs +++ b/Content.Shared/Atmos/GasPrototype.cs @@ -1,4 +1,6 @@ -using Robust.Shared.Prototypes; +#nullable enable +using System; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using YamlDotNet.RepresentationModel; @@ -7,12 +9,12 @@ namespace Content.Shared.Atmos [Prototype("gas")] public class GasPrototype : IPrototype { - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; // TODO: Control gas amount necessary for overlay to appear // TODO: Add interfaces for gas behaviours e.g. breathing, burning - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// Specific heat for gas. @@ -43,25 +45,25 @@ namespace Content.Shared.Atmos /// /// If this reagent is in gas form, this is the path to the overlay that will be used to make the gas visible. /// - public string GasOverlayTexture { get; private set; } + public string GasOverlayTexture { get; private set; } = string.Empty; /// /// If this reagent is in gas form, this will be the path to the RSI sprite that will be used to make the gas visible. /// - public string GasOverlayState { get; set; } + public string GasOverlayState { get; set; } = string.Empty; /// /// State for the gas RSI overlay. /// - public string GasOverlaySprite { get; set; } + public string GasOverlaySprite { get; set; } = string.Empty; /// /// Path to the tile overlay used when this gas appears visible. /// - public string OverlayPath { get; private set; } + public string OverlayPath { get; private set; } = string.Empty; - public string Color { get; private set; } + public string Color { get; private set; } = string.Empty; public void LoadFrom(YamlMappingNode mapping) { diff --git a/Content.Shared/Audio/AudioHelpers.cs b/Content.Shared/Audio/AudioHelpers.cs index a8a47fbdf5..887f3ac1fb 100644 --- a/Content.Shared/Audio/AudioHelpers.cs +++ b/Content.Shared/Audio/AudioHelpers.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Audio; using Robust.Shared.IoC; diff --git a/Content.Shared/Audio/SoundCollectionPrototype.cs b/Content.Shared/Audio/SoundCollectionPrototype.cs index a742ca1fbf..f8e5ea9388 100644 --- a/Content.Shared/Audio/SoundCollectionPrototype.cs +++ b/Content.Shared/Audio/SoundCollectionPrototype.cs @@ -1,4 +1,6 @@ +#nullable enable using System.Collections.Generic; +using System.Data; using Robust.Shared.Prototypes; using Robust.Shared.Utility; using YamlDotNet.RepresentationModel; @@ -8,21 +10,20 @@ namespace Content.Shared.Audio [Prototype("soundCollection")] public sealed class SoundCollectionPrototype : IPrototype { - public string ID { get; private set; } - public IReadOnlyList PickFiles { get; private set; } + public string ID { get; private set; } = string.Empty; + public List PickFiles { get; private set; } = new(); public void LoadFrom(YamlMappingNode mapping) { ID = mapping.GetNode("id").AsString(); - var pickFiles = new List(); + // In the unlikely case the method gets called twice + PickFiles.Clear(); foreach (var file in mapping.GetNode("files")) { - pickFiles.Add(file.AsString()); + PickFiles.Add(file.AsString()); } - - PickFiles = pickFiles; } } } diff --git a/Content.Shared/CCVars.cs b/Content.Shared/CCVars.cs index 8d23542ca8..4ba36ccc3c 100644 --- a/Content.Shared/CCVars.cs +++ b/Content.Shared/CCVars.cs @@ -1,4 +1,4 @@ - +#nullable enable using Robust.Shared; using Robust.Shared.Configuration; diff --git a/Content.Shared/Chat/ChatChannel.cs b/Content.Shared/Chat/ChatChannel.cs index 4b63a75b11..cb159bc8c9 100644 --- a/Content.Shared/Chat/ChatChannel.cs +++ b/Content.Shared/Chat/ChatChannel.cs @@ -1,3 +1,4 @@ +#nullable enable using System; namespace Content.Shared.Chat diff --git a/Content.Shared/Chat/ChatMaxMsgLengthMessage.cs b/Content.Shared/Chat/ChatMaxMsgLengthMessage.cs index 88ebf85e2f..825f3b694d 100644 --- a/Content.Shared/Chat/ChatMaxMsgLengthMessage.cs +++ b/Content.Shared/Chat/ChatMaxMsgLengthMessage.cs @@ -1,3 +1,4 @@ +#nullable enable using Lidgren.Network; using Robust.Shared.Network; diff --git a/Content.Shared/Chat/MsgChatMessage.cs b/Content.Shared/Chat/MsgChatMessage.cs index 2452438bbd..8f9ea632eb 100644 --- a/Content.Shared/Chat/MsgChatMessage.cs +++ b/Content.Shared/Chat/MsgChatMessage.cs @@ -1,3 +1,4 @@ +#nullable enable using JetBrains.Annotations; using Lidgren.Network; using Robust.Shared.GameObjects; @@ -28,12 +29,12 @@ namespace Content.Shared.Chat /// /// The actual message contents. /// - public string Message { get; set; } + public string Message { get; set; } = string.Empty; /// /// What to "wrap" the message contents with. Example is stuff like 'Joe says: "{0}"' /// - public string MessageWrap { get; set; } + public string MessageWrap { get; set; } = string.Empty; /// /// The sending entity. diff --git a/Content.Shared/Chemistry/DefaultMetabolizable.cs b/Content.Shared/Chemistry/DefaultMetabolizable.cs index 0d33b258cb..bab24a5a20 100644 --- a/Content.Shared/Chemistry/DefaultMetabolizable.cs +++ b/Content.Shared/Chemistry/DefaultMetabolizable.cs @@ -1,4 +1,5 @@ -using Content.Shared.Interfaces.Chemistry; +#nullable enable +using Content.Shared.Interfaces.Chemistry; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/Chemistry/ReagentUnit.cs b/Content.Shared/Chemistry/ReagentUnit.cs index 9cbe0db9b0..a8af2d1cdf 100644 --- a/Content.Shared/Chemistry/ReagentUnit.cs +++ b/Content.Shared/Chemistry/ReagentUnit.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Globalization; using System.Linq; @@ -204,7 +205,7 @@ namespace Content.Shared.Chemistry return reagent < min ? min : reagent > max ? max : reagent; } - public override readonly bool Equals(object obj) + public override readonly bool Equals(object? obj) { return obj is ReagentUnit unit && _value == unit._value; diff --git a/Content.Shared/Chemistry/Solution.cs b/Content.Shared/Chemistry/Solution.cs index 6623adea11..2afd5db7ef 100644 --- a/Content.Shared/Chemistry/Solution.cs +++ b/Content.Shared/Chemistry/Solution.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections; using System.Collections.Generic; @@ -278,12 +279,13 @@ namespace Content.Shared.Chemistry Color mixColor = default; var runningTotalQuantity = ReagentUnit.New(0); + var protoManager = IoCManager.Resolve(); foreach (var reagent in Contents) { runningTotalQuantity += reagent.Quantity; - if (!IoCManager.Resolve().TryIndex(reagent.ReagentId, out ReagentPrototype proto)) + if (!protoManager.TryIndex(reagent.ReagentId, out ReagentPrototype? proto)) { continue; } @@ -322,7 +324,7 @@ namespace Content.Shared.Chemistry foreach (var (reagentId, quantity) in _contents.ToArray()) { - if (!proto.TryIndex(reagentId, out ReagentPrototype reagent)) + if (!proto.TryIndex(reagentId, out ReagentPrototype? reagent)) continue; var removedAmount = reagent.ReactionEntity(entity, method, quantity); diff --git a/Content.Shared/Chemistry/SolutionContainerCaps.cs b/Content.Shared/Chemistry/SolutionContainerCaps.cs index 47d8a76371..6e6472b168 100644 --- a/Content.Shared/Chemistry/SolutionContainerCaps.cs +++ b/Content.Shared/Chemistry/SolutionContainerCaps.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.GameObjects.Components.Chemistry; using Robust.Shared.Serialization; diff --git a/Content.Shared/Construction/ArbitraryInsertConstructionGraphStep.cs b/Content.Shared/Construction/ArbitraryInsertConstructionGraphStep.cs index b02e391019..48ad9b7ce6 100644 --- a/Content.Shared/Construction/ArbitraryInsertConstructionGraphStep.cs +++ b/Content.Shared/Construction/ArbitraryInsertConstructionGraphStep.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -6,8 +7,8 @@ namespace Content.Shared.Construction { public abstract class ArbitraryInsertConstructionGraphStep : EntityInsertConstructionGraphStep { - public string Name { get; private set; } - public SpriteSpecifier Icon { get; private set; } + public string Name { get; private set; } = string.Empty; + public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/Construction/ComponentConstructionGraphStep.cs b/Content.Shared/Construction/ComponentConstructionGraphStep.cs index ab5e554e7e..44e487e52c 100644 --- a/Content.Shared/Construction/ComponentConstructionGraphStep.cs +++ b/Content.Shared/Construction/ComponentConstructionGraphStep.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Serialization; @@ -7,7 +8,7 @@ namespace Content.Shared.Construction { public class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep { - public string Component { get; private set; } + public string Component { get; private set; } = string.Empty; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/Construction/ConstructionConditions/LowWallInTile.cs b/Content.Shared/Construction/ConstructionConditions/LowWallInTile.cs index c20bb66cbd..83b2ea3bed 100644 --- a/Content.Shared/Construction/ConstructionConditions/LowWallInTile.cs +++ b/Content.Shared/Construction/ConstructionConditions/LowWallInTile.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components; +#nullable enable +using Content.Shared.GameObjects.Components; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Construction/ConstructionConditions/NoWindowsInTile.cs b/Content.Shared/Construction/ConstructionConditions/NoWindowsInTile.cs index 6a980e2c0c..9722d7e8b1 100644 --- a/Content.Shared/Construction/ConstructionConditions/NoWindowsInTile.cs +++ b/Content.Shared/Construction/ConstructionConditions/NoWindowsInTile.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components; +#nullable enable +using Content.Shared.GameObjects.Components; using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Construction/ConstructionConditions/TileNotBlocked.cs b/Content.Shared/Construction/ConstructionConditions/TileNotBlocked.cs index 1c908be097..ff9bfdf080 100644 --- a/Content.Shared/Construction/ConstructionConditions/TileNotBlocked.cs +++ b/Content.Shared/Construction/ConstructionConditions/TileNotBlocked.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Construction/ConstructionConditions/TileType.cs b/Content.Shared/Construction/ConstructionConditions/TileType.cs index 7978eceb78..a2018cbcdc 100644 --- a/Content.Shared/Construction/ConstructionConditions/TileType.cs +++ b/Content.Shared/Construction/ConstructionConditions/TileType.cs @@ -1,4 +1,5 @@ -using Content.Shared.Maps; +#nullable enable +using Content.Shared.Maps; using JetBrains.Annotations; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -12,11 +13,11 @@ namespace Content.Shared.Construction.ConstructionConditions public class TileType : IConstructionCondition { - public List TargetTiles { get; private set; } + public List TargetTiles { get; private set; } = new(); void IExposeData.ExposeData(ObjectSerializer serializer) { - serializer.DataField(this, x => x.TargetTiles, "targets", null); + serializer.DataField(this, x => x.TargetTiles, "targets", new List()); } public bool Condition(IEntity user, EntityCoordinates location, Direction direction) diff --git a/Content.Shared/Construction/ConstructionGraphEdge.cs b/Content.Shared/Construction/ConstructionGraphEdge.cs index c4fdbf28ef..b1b5004656 100644 --- a/Content.Shared/Construction/ConstructionGraphEdge.cs +++ b/Content.Shared/Construction/ConstructionGraphEdge.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Interfaces; using Robust.Shared.IoC; @@ -13,11 +14,11 @@ namespace Content.Shared.Construction public class ConstructionGraphEdge : IExposeData { private List _steps = new(); - private List _conditions; - private List _completed; + private List _conditions = new(); + private List _completed = new(); [ViewVariables] - public string Target { get; private set; } + public string Target { get; private set; } = string.Empty; [ViewVariables] public IReadOnlyList Conditions => _conditions; @@ -48,7 +49,7 @@ namespace Content.Shared.Construction var serializer = YamlObjectSerializer.NewReader(mapping); InternalExposeData(serializer); - if (!mapping.TryGetNode("steps", out YamlSequenceNode stepsMapping)) return; + if (!mapping.TryGetNode("steps", out YamlSequenceNode? stepsMapping)) return; foreach (var yamlNode in stepsMapping) { diff --git a/Content.Shared/Construction/ConstructionGraphStep.cs b/Content.Shared/Construction/ConstructionGraphStep.cs index 45cd240009..7d00d147c0 100644 --- a/Content.Shared/Construction/ConstructionGraphStep.cs +++ b/Content.Shared/Construction/ConstructionGraphStep.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Interfaces; using Robust.Shared.IoC; @@ -10,7 +11,7 @@ namespace Content.Shared.Construction [Serializable] public abstract class ConstructionGraphStep : IExposeData { - private List _completed; + private List _completed = new(); public float DoAfter { get; private set; } public IReadOnlyList Completed => _completed; diff --git a/Content.Shared/Construction/ConstructionPrototype.cs b/Content.Shared/Construction/ConstructionPrototype.cs index 542c4adfbc..88bb63e84c 100644 --- a/Content.Shared/Construction/ConstructionPrototype.cs +++ b/Content.Shared/Construction/ConstructionPrototype.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -9,50 +10,50 @@ namespace Content.Shared.Construction [Prototype("construction")] public class ConstructionPrototype : IPrototype { - private List _conditions; + private List _conditions = new(); /// /// Friendly name displayed in the construction GUI. /// - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; /// /// "Useful" description displayed in the construction GUI. /// - public string Description { get; private set; } + public string Description { get; private set; } = string.Empty; /// /// The this construction will be using. /// - public string Graph { get; private set; } + public string Graph { get; private set; } = string.Empty; /// /// The target this construction will guide the user to. /// - public string TargetNode { get; private set; } + public string TargetNode { get; private set; } = string.Empty; /// /// The starting this construction will start at. /// - public string StartNode { get; private set; } + public string StartNode { get; private set; } = string.Empty; /// /// Texture path inside the construction GUI. /// - public SpriteSpecifier Icon { get; private set; } + public SpriteSpecifier Icon { get; private set; } = SpriteSpecifier.Invalid; /// /// If you can start building or complete steps on impassable terrain. /// public bool CanBuildInImpassable { get; private set; } - public string Category { get; private set; } + public string Category { get; private set; } = string.Empty; - public ConstructionType Type { get; private set; } + public ConstructionType Type { get; private set; } = ConstructionType.Structure; - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; - public string PlacementMode { get; private set; } + public string PlacementMode { get; private set; } = "PlaceFree"; /// /// Whether this construction can be constructed rotated or not. diff --git a/Content.Shared/Construction/EntityInsertConstructionGraphStep.cs b/Content.Shared/Construction/EntityInsertConstructionGraphStep.cs index 2c21efb2fc..00da4c757b 100644 --- a/Content.Shared/Construction/EntityInsertConstructionGraphStep.cs +++ b/Content.Shared/Construction/EntityInsertConstructionGraphStep.cs @@ -1,11 +1,12 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.Construction { public abstract class EntityInsertConstructionGraphStep : ConstructionGraphStep { - public string Store { get; private set; } + public string Store { get; private set; } = string.Empty; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/Construction/IEdgeCondition.cs b/Content.Shared/Construction/IEdgeCondition.cs index 524f409280..8eb04370c1 100644 --- a/Content.Shared/Construction/IEdgeCondition.cs +++ b/Content.Shared/Construction/IEdgeCondition.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +#nullable enable +using System.Threading.Tasks; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.Utility; diff --git a/Content.Shared/Construction/NestedConstructionGraphStep.cs b/Content.Shared/Construction/NestedConstructionGraphStep.cs index 6e077b5f8e..25f8b14c33 100644 --- a/Content.Shared/Construction/NestedConstructionGraphStep.cs +++ b/Content.Shared/Construction/NestedConstructionGraphStep.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using System.IO; using Robust.Shared.Utility; using YamlDotNet.RepresentationModel; @@ -11,7 +12,7 @@ namespace Content.Shared.Construction public void LoadFrom(YamlMappingNode mapping) { - if (!mapping.TryGetNode("steps", out YamlSequenceNode steps)) return; + if (!mapping.TryGetNode("steps", out YamlSequenceNode? steps)) return; foreach (var node in steps) { diff --git a/Content.Shared/Construction/PrototypeConstructionGraphStep.cs b/Content.Shared/Construction/PrototypeConstructionGraphStep.cs index 93d004dd5f..fcd713936e 100644 --- a/Content.Shared/Construction/PrototypeConstructionGraphStep.cs +++ b/Content.Shared/Construction/PrototypeConstructionGraphStep.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Localization; using Robust.Shared.Serialization; @@ -7,7 +8,7 @@ namespace Content.Shared.Construction { public class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep { - public string Prototype { get; private set; } + public string Prototype { get; private set; } = string.Empty; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/Construction/ToolConstructionGraphStep.cs b/Content.Shared/Construction/ToolConstructionGraphStep.cs index 1bdca19dfe..e513b6931b 100644 --- a/Content.Shared/Construction/ToolConstructionGraphStep.cs +++ b/Content.Shared/Construction/ToolConstructionGraphStep.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Interactable; +#nullable enable +using Content.Shared.GameObjects.Components.Interactable; using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.Utility; @@ -9,7 +10,7 @@ namespace Content.Shared.Construction { public ToolQuality Tool { get; private set; } public float Fuel { get; private set; } - public string ExamineOverride { get; private set; } + public string ExamineOverride { get; private set; } = string.Empty; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/Damage/DamageClass.cs b/Content.Shared/Damage/DamageClass.cs index 3463b1c430..6b4f0f7f3d 100644 --- a/Content.Shared/Damage/DamageClass.cs +++ b/Content.Shared/Damage/DamageClass.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -24,7 +25,7 @@ namespace Content.Shared.Damage return DamageSystem.ClassToType[@class]; } - public static Dictionary ToNewDictionary() + public static Dictionary ToNewDictionary() where T : struct { return Enum.GetValues(typeof(DamageClass)) .Cast() diff --git a/Content.Shared/Damage/DamageContainer/DamageContainerPrototype.cs b/Content.Shared/Damage/DamageContainer/DamageContainerPrototype.cs index abc3069266..6c58ec2bf9 100644 --- a/Content.Shared/Damage/DamageContainer/DamageContainerPrototype.cs +++ b/Content.Shared/Damage/DamageContainer/DamageContainerPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -15,9 +16,9 @@ namespace Content.Shared.Damage.DamageContainer public class DamageContainerPrototype : IPrototype { private bool _supportAll; - private HashSet _supportedClasses; - private HashSet _supportedTypes; - private string _id; + private HashSet _supportedClasses = new(); + private HashSet _supportedTypes = new(); + private string _id = string.Empty; // TODO NET 5 IReadOnlySet [ViewVariables] public IReadOnlyCollection SupportedClasses => _supportedClasses; diff --git a/Content.Shared/Damage/DamageType.cs b/Content.Shared/Damage/DamageType.cs index 930d3abd8c..c0ebb1b252 100644 --- a/Content.Shared/Damage/DamageType.cs +++ b/Content.Shared/Damage/DamageType.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Linq; using Content.Shared.GameObjects.EntitySystems; @@ -29,7 +30,7 @@ namespace Content.Shared.Damage return DamageSystem.TypeToClass[type]; } - public static Dictionary ToNewDictionary() + public static Dictionary ToNewDictionary() where T : struct { return Enum.GetValues(typeof(DamageType)) .Cast() diff --git a/Content.Shared/Damage/ResistanceSet/ResistanceSet.cs b/Content.Shared/Damage/ResistanceSet/ResistanceSet.cs index 8f2b345c4d..3e625dcc75 100644 --- a/Content.Shared/Damage/ResistanceSet/ResistanceSet.cs +++ b/Content.Shared/Damage/ResistanceSet/ResistanceSet.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -32,7 +33,7 @@ namespace Content.Shared.Damage.ResistanceSet _resistances = data.Resistances; } - public string ID { get; } + public string ID { get; } = string.Empty; /// /// Adjusts input damage with the resistance set values. diff --git a/Content.Shared/Damage/ResistanceSet/ResistanceSetPrototype.cs b/Content.Shared/Damage/ResistanceSet/ResistanceSetPrototype.cs index 108b45e4a1..24cbf524d4 100644 --- a/Content.Shared/Damage/ResistanceSet/ResistanceSetPrototype.cs +++ b/Content.Shared/Damage/ResistanceSet/ResistanceSetPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -14,15 +15,15 @@ namespace Content.Shared.Damage.ResistanceSet [Serializable, NetSerializable] public class ResistanceSetPrototype : IPrototype { - private Dictionary _coefficients; - private Dictionary _flatReductions; - private string _id; + private Dictionary _coefficients = new(); + private Dictionary _flatReductions = new(); + private string _id = string.Empty; [ViewVariables] public Dictionary Coefficients => _coefficients; [ViewVariables] public Dictionary FlatReductions => _flatReductions; - [ViewVariables] public Dictionary Resistances { get; private set; } + [ViewVariables] public Dictionary Resistances { get; private set; } = new(); [ViewVariables] public string ID => _id; @@ -31,8 +32,8 @@ namespace Content.Shared.Damage.ResistanceSet var serializer = YamlObjectSerializer.NewReader(mapping); serializer.DataField(ref _id, "id", string.Empty); - serializer.DataField(ref _coefficients, "coefficients", null); - serializer.DataField(ref _flatReductions, "flatReductions", null); + serializer.DataField(ref _coefficients, "coefficients", new Dictionary()); + serializer.DataField(ref _flatReductions, "flatReductions", new Dictionary()); Resistances = new Dictionary(); foreach (var damageType in (DamageType[]) Enum.GetValues(typeof(DamageType))) diff --git a/Content.Shared/EntryPoint.cs b/Content.Shared/EntryPoint.cs index 8c30888807..42250b1c2c 100644 --- a/Content.Shared/EntryPoint.cs +++ b/Content.Shared/EntryPoint.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Content.Shared.Chemistry; diff --git a/Content.Shared/Eui/EuiMessageBase.cs b/Content.Shared/Eui/EuiMessageBase.cs index 5a252572d5..1d2052ff5a 100644 --- a/Content.Shared/Eui/EuiMessageBase.cs +++ b/Content.Shared/Eui/EuiMessageBase.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; namespace Content.Shared.Eui { diff --git a/Content.Shared/Eui/EuiStateBase.cs b/Content.Shared/Eui/EuiStateBase.cs index c1fe469c35..461a1f1b4b 100644 --- a/Content.Shared/Eui/EuiStateBase.cs +++ b/Content.Shared/Eui/EuiStateBase.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.Eui diff --git a/Content.Shared/GameObjects/Components/Access/SharedIdCardConsoleComponent.cs b/Content.Shared/GameObjects/Components/Access/SharedIdCardConsoleComponent.cs index 2209321fe9..271b39e46f 100644 --- a/Content.Shared/GameObjects/Components/Access/SharedIdCardConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Access/SharedIdCardConsoleComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.GameObjects; @@ -49,16 +50,16 @@ namespace Content.Shared.GameObjects.Components.Access public readonly bool IsPrivilegedIdAuthorized; public readonly bool IsTargetIdPresent; public readonly string TargetIdName; - public readonly string TargetIdFullName; - public readonly string TargetIdJobTitle; - public readonly string[] TargetIdAccessList; + public readonly string? TargetIdFullName; + public readonly string? TargetIdJobTitle; + public readonly string[]? TargetIdAccessList; public IdCardConsoleBoundUserInterfaceState(bool isPrivilegedIdPresent, bool isPrivilegedIdAuthorized, bool isTargetIdPresent, - string targetIdFullName, - string targetIdJobTitle, - string[] targetIdAccessList, string privilegedIdName, string targetIdName) + string? targetIdFullName, + string? targetIdJobTitle, + string[]? targetIdAccessList, string privilegedIdName, string targetIdName) { IsPrivilegedIdPresent = isPrivilegedIdPresent; IsPrivilegedIdAuthorized = isPrivilegedIdAuthorized; diff --git a/Content.Shared/GameObjects/Components/ActionBlocking/SharedHandcuffComponent.cs b/Content.Shared/GameObjects/Components/ActionBlocking/SharedHandcuffComponent.cs index e55211987a..d30fa3f0fc 100644 --- a/Content.Shared/GameObjects/Components/ActionBlocking/SharedHandcuffComponent.cs +++ b/Content.Shared/GameObjects/Components/ActionBlocking/SharedHandcuffComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -12,9 +13,9 @@ namespace Content.Shared.GameObjects.Components.ActionBlocking [Serializable, NetSerializable] protected sealed class HandcuffedComponentState : ComponentState { - public string IconState { get; } + public string? IconState { get; } - public HandcuffedComponentState(string iconState) : base(ContentNetIDs.HANDCUFFS) + public HandcuffedComponentState(string? iconState) : base(ContentNetIDs.HANDCUFFS) { IconState = iconState; } diff --git a/Content.Shared/GameObjects/Components/Actor/SharedCharacterInfoComponent.cs b/Content.Shared/GameObjects/Components/Actor/SharedCharacterInfoComponent.cs index 9e20f4f86e..acdf02d345 100644 --- a/Content.Shared/GameObjects/Components/Actor/SharedCharacterInfoComponent.cs +++ b/Content.Shared/GameObjects/Components/Actor/SharedCharacterInfoComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Objectives; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Arcade/SharedSpaceVillainArcadeComponent.cs b/Content.Shared/GameObjects/Components/Arcade/SharedSpaceVillainArcadeComponent.cs index b62f6972ed..6b1b186284 100644 --- a/Content.Shared/GameObjects/Components/Arcade/SharedSpaceVillainArcadeComponent.cs +++ b/Content.Shared/GameObjects/Components/Arcade/SharedSpaceVillainArcadeComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankBoundUserInterfaceState.cs b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankBoundUserInterfaceState.cs index c6da80bd11..a99905bf39 100644 --- a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankBoundUserInterfaceState.cs +++ b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankBoundUserInterfaceState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankSetPressureMessage.cs b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankSetPressureMessage.cs index bf3a786e8c..c3255ab6c8 100644 --- a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankSetPressureMessage.cs +++ b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankSetPressureMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankToggleInternalsMessage.cs b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankToggleInternalsMessage.cs index f65e47dfbb..c89b47b94a 100644 --- a/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankToggleInternalsMessage.cs +++ b/Content.Shared/GameObjects/Components/Atmos/GasTank/GasTankToggleInternalsMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankComponent.cs b/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankComponent.cs index 541d1ecbc2..8e8c8f07c6 100644 --- a/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Atmos.GasTank { diff --git a/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankUiKey.cs b/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankUiKey.cs index 246aad545d..ce1492d694 100644 --- a/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankUiKey.cs +++ b/Content.Shared/GameObjects/Components/Atmos/GasTank/SharedGasTankUiKey.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Atmos.GasTank diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedFlammableComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedFlammableComponent.cs index 8eac377717..72df65b885 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedFlammableComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedFlammableComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedGasAnalyzerComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedGasAnalyzerComponent.cs index 7b43d646c6..aeee8ee92f 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedGasAnalyzerComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedGasAnalyzerComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Serialization; +#nullable enable +using Robust.Shared.Serialization; using System; namespace Content.Shared.GameObjects.Components.Atmos diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedGasCanisterComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedGasCanisterComponent.cs index 679b6542d9..fa5b18484b 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedGasCanisterComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedGasCanisterComponent.cs @@ -1,4 +1,4 @@ -#nullable enable annotations +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedPipeComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedPipeComponent.cs index 141a8fa6cf..0ffdebb454 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedPipeComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedPipeComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Maths; using Robust.Shared.Serialization; using System; diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedPumpComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedPumpComponent.cs index d57b7dfc1e..fc17e37918 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedPumpComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedPumpComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedSiphonComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedSiphonComponent.cs index 169e887c0b..f2f900c90d 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedSiphonComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedSiphonComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Atmos diff --git a/Content.Shared/GameObjects/Components/Atmos/SharedVentComponent.cs b/Content.Shared/GameObjects/Components/Atmos/SharedVentComponent.cs index fdd4616aa9..83dfd90131 100644 --- a/Content.Shared/GameObjects/Components/Atmos/SharedVentComponent.cs +++ b/Content.Shared/GameObjects/Components/Atmos/SharedVentComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Atmos diff --git a/Content.Shared/GameObjects/Components/Body/Networks/SharedBloodstreamComponent.cs b/Content.Shared/GameObjects/Components/Body/Networks/SharedBloodstreamComponent.cs index a9b3c0492f..82a6416c1e 100644 --- a/Content.Shared/GameObjects/Components/Body/Networks/SharedBloodstreamComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Networks/SharedBloodstreamComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry; +#nullable enable +using Content.Shared.Chemistry; using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Body.Networks diff --git a/Content.Shared/GameObjects/Components/Body/Part/BodyPartCompatibility.cs b/Content.Shared/GameObjects/Components/Body/Part/BodyPartCompatibility.cs index e65afd29bf..15ef7a73fa 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/BodyPartCompatibility.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/BodyPartCompatibility.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part diff --git a/Content.Shared/GameObjects/Components/Body/Part/BodyPartSymmetry.cs b/Content.Shared/GameObjects/Components/Body/Part/BodyPartSymmetry.cs index 9a3b0d778e..9bd24f3bf3 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/BodyPartSymmetry.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/BodyPartSymmetry.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part diff --git a/Content.Shared/GameObjects/Components/Body/Part/BodyPartType.cs b/Content.Shared/GameObjects/Components/Body/Part/BodyPartType.cs index 403400d63f..34716661fd 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/BodyPartType.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/BodyPartType.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part diff --git a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartAdded.cs b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartAdded.cs index 0ca26a9a14..ff9f983891 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartAdded.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartAdded.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Body.Part diff --git a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartContainer.cs b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartContainer.cs index e9892a0451..2cd129c4a8 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartContainer.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartContainer.cs @@ -1,4 +1,6 @@ -namespace Content.Shared.GameObjects.Components.Body.Part +#nullable enable + +namespace Content.Shared.GameObjects.Components.Body.Part { /// /// Defines a component as being capable of containing parts. diff --git a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartRemoved.cs b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartRemoved.cs index e40bdcc49b..c6350dcb0f 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/IBodyPartRemoved.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/IBodyPartRemoved.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; namespace Content.Shared.GameObjects.Components.Body.Part { diff --git a/Content.Shared/GameObjects/Components/Body/Part/Property/BodyPartPropertyComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/Property/BodyPartPropertyComponent.cs index 7c3804e823..1de5d0a53f 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/Property/BodyPartPropertyComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/Property/BodyPartPropertyComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part.Property diff --git a/Content.Shared/GameObjects/Components/Body/Part/Property/ExtensionComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/Property/ExtensionComponent.cs index c0d5cd8c5b..bacd273839 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/Property/ExtensionComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/Property/ExtensionComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part.Property diff --git a/Content.Shared/GameObjects/Components/Body/Part/Property/GraspComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/Property/GraspComponent.cs index 798d334e0a..9bc5d233a4 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/Property/GraspComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/Property/GraspComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Body.Part.Property { diff --git a/Content.Shared/GameObjects/Components/Body/Part/Property/IBodyPartProperty.cs b/Content.Shared/GameObjects/Components/Body/Part/Property/IBodyPartProperty.cs index d8683f2e58..5f073dd091 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/Property/IBodyPartProperty.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/Property/IBodyPartProperty.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Body.Part.Property { diff --git a/Content.Shared/GameObjects/Components/Body/Part/Property/LegComponent.cs b/Content.Shared/GameObjects/Components/Body/Part/Property/LegComponent.cs index fb1ebfcf55..f94b84fe74 100644 --- a/Content.Shared/GameObjects/Components/Body/Part/Property/LegComponent.cs +++ b/Content.Shared/GameObjects/Components/Body/Part/Property/LegComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Part.Property diff --git a/Content.Shared/GameObjects/Components/Body/Preset/BodyPresetPrototype.cs b/Content.Shared/GameObjects/Components/Body/Preset/BodyPresetPrototype.cs index 29e623e521..da410318db 100644 --- a/Content.Shared/GameObjects/Components/Body/Preset/BodyPresetPrototype.cs +++ b/Content.Shared/GameObjects/Components/Body/Preset/BodyPresetPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.GameObjects.Components.Body.Part; using Robust.Shared.Prototypes; @@ -15,9 +16,9 @@ namespace Content.Shared.GameObjects.Components.Body.Preset [Serializable, NetSerializable] public class BodyPresetPrototype : IPrototype { - private string _id; - private string _name; - private Dictionary _partIDs; + private string _id = string.Empty; + private string _name = string.Empty; + private Dictionary _partIDs = new(); [ViewVariables] public string ID => _id; diff --git a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryType.cs b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryType.cs index 06f58fcbae..5a5643dde0 100644 --- a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryType.cs +++ b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryType.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Surgery diff --git a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIKey.cs b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIKey.cs index 70fe6f303e..5463ae2055 100644 --- a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIKey.cs +++ b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIKey.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Body.Surgery diff --git a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIMessages.cs b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIMessages.cs index ad18fcbbaa..dea33f3336 100644 --- a/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIMessages.cs +++ b/Content.Shared/GameObjects/Components/Body/Surgery/SurgeryUIMessages.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Body/Template/BodyTemplatePrototype.cs b/Content.Shared/GameObjects/Components/Body/Template/BodyTemplatePrototype.cs index dd661952b7..cdd87846d2 100644 --- a/Content.Shared/GameObjects/Components/Body/Template/BodyTemplatePrototype.cs +++ b/Content.Shared/GameObjects/Components/Body/Template/BodyTemplatePrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Linq; using Content.Shared.GameObjects.Components.Body.Part; @@ -16,13 +17,13 @@ namespace Content.Shared.GameObjects.Components.Body.Template [Serializable, NetSerializable] public class BodyTemplatePrototype : IPrototype { - private string _id; - private string _name; - private string _centerSlot; - private Dictionary _slots; - private Dictionary> _connections; - private Dictionary _layers; - private Dictionary _mechanismLayers; + private string _id = string.Empty; + private string _name = string.Empty; + private string _centerSlot = string.Empty; + private Dictionary _slots = new(); + private Dictionary> _connections = new(); + private Dictionary _layers = new(); + private Dictionary _mechanismLayers = new(); [ViewVariables] public string ID => _id; diff --git a/Content.Shared/GameObjects/Components/Botany/PlantHolderVisuals.cs b/Content.Shared/GameObjects/Components/Botany/PlantHolderVisuals.cs index 336a56e483..368f1b63b1 100644 --- a/Content.Shared/GameObjects/Components/Botany/PlantHolderVisuals.cs +++ b/Content.Shared/GameObjects/Components/Botany/PlantHolderVisuals.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Botany diff --git a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs index 6da93700c7..8d84a62345 100644 --- a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs +++ b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs @@ -44,7 +44,7 @@ namespace Content.Shared.GameObjects.Components.Buckle public bool DontCollide { get; set; } - public abstract bool TryBuckle(IEntity user, IEntity to); + public abstract bool TryBuckle(IEntity? user, IEntity to); bool ICollideSpecial.PreventCollide(IPhysBody collidedwith) { diff --git a/Content.Shared/GameObjects/Components/Cargo/SharedCargoConsoleComponent.cs b/Content.Shared/GameObjects/Components/Cargo/SharedCargoConsoleComponent.cs index 3112c9ee54..1c8f854aa1 100644 --- a/Content.Shared/GameObjects/Components/Cargo/SharedCargoConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Cargo/SharedCargoConsoleComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Prototypes; diff --git a/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs index 78cbe28efd..fa269fe624 100644 --- a/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Prototypes.Cargo; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs b/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs index 45ac21b01b..1b139ad8d3 100644 --- a/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs +++ b/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections; using System.Collections.Generic; using Content.Shared.Prototypes.Cargo; @@ -35,10 +36,10 @@ namespace Content.Shared.GameObjects.Components.Cargo /// Returns a product from the string id; /// /// Product - public CargoProductPrototype GetProduct(string productId) + public CargoProductPrototype? GetProduct(string productId) { var prototypeManager = IoCManager.Resolve(); - if (!prototypeManager.TryIndex(productId, out CargoProductPrototype product) || !_products.Contains(product)) + if (!prototypeManager.TryIndex(productId, out CargoProductPrototype? product) || !_products.Contains(product)) { return null; } @@ -75,7 +76,7 @@ namespace Content.Shared.GameObjects.Components.Cargo _products.Clear(); foreach (var id in products) { - if (!prototypeManager.TryIndex(id, out CargoProductPrototype product)) + if (!prototypeManager.TryIndex(id, out CargoProductPrototype? product)) { continue; } diff --git a/Content.Shared/GameObjects/Components/Chemistry/ISolutionInteractionsComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/ISolutionInteractionsComponent.cs index 0b391be562..4fbddea923 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/ISolutionInteractionsComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/ISolutionInteractionsComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry; +#nullable enable +using Content.Shared.Chemistry; using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Chemistry diff --git a/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserInventoryPrototype.cs b/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserInventoryPrototype.cs index 56f8841269..850c23467e 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserInventoryPrototype.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/ReagentDispenserInventoryPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -15,8 +16,8 @@ namespace Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser [Serializable, NetSerializable, Prototype("reagentDispenserInventory")] public class ReagentDispenserInventoryPrototype : IPrototype { - private string _id; - private List _inventory; + private string _id = string.Empty; + private List _inventory = new(); public string ID => _id; public List Inventory => _inventory; diff --git a/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/SharedReagentDispenserComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/SharedReagentDispenserComponent.cs index 65c576402a..eb9764be5f 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/SharedReagentDispenserComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/ReagentDispenser/SharedReagentDispenserComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Chemistry; using Robust.Shared.GameObjects; @@ -36,12 +37,12 @@ namespace Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser /// /// A list of the reagents and their amounts within the beaker/reagent container, if applicable. /// - public readonly List ContainerReagents; + public readonly List? ContainerReagents; public readonly string DispenserName; public readonly ReagentUnit SelectedDispenseAmount; public ReagentDispenserBoundUserInterfaceState(bool hasPower, bool hasBeaker, ReagentUnit beakerCurrentVolume, ReagentUnit beakerMaxVolume, string containerName, - List inventory, string dispenserName, List containerReagents, ReagentUnit selectedDispenseAmount) + List inventory, string dispenserName, List? containerReagents, ReagentUnit selectedDispenseAmount) { HasPower = hasPower; HasBeaker = hasBeaker; diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedHyposprayComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedHyposprayComponent.cs index 292e7ff36d..2acaae0923 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedHyposprayComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedHyposprayComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Chemistry; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs index d63ea77f6c..4457c0b866 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Chemistry; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs b/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs index a8d267a02b..5e8d257a7e 100644 --- a/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Command/SharedCommunicationsConsoleComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Construction/MachineFrameVisuals.cs b/Content.Shared/GameObjects/Components/Construction/MachineFrameVisuals.cs index fdcc7f7e87..6136889dd3 100644 --- a/Content.Shared/GameObjects/Components/Construction/MachineFrameVisuals.cs +++ b/Content.Shared/GameObjects/Components/Construction/MachineFrameVisuals.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Serialization; +#nullable enable +using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Construction { diff --git a/Content.Shared/GameObjects/Components/Context/HideContextMenuComponent.cs b/Content.Shared/GameObjects/Components/Context/HideContextMenuComponent.cs index e8650c0466..e1adb8fce8 100644 --- a/Content.Shared/GameObjects/Components/Context/HideContextMenuComponent.cs +++ b/Content.Shared/GameObjects/Components/Context/HideContextMenuComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Verbs; +#nullable enable +using Content.Shared.GameObjects.Verbs; using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Context diff --git a/Content.Shared/GameObjects/Components/Conveyor/SharedConveyorComponent.cs b/Content.Shared/GameObjects/Components/Conveyor/SharedConveyorComponent.cs index 56f1ee383c..ceab393ef9 100644 --- a/Content.Shared/GameObjects/Components/Conveyor/SharedConveyorComponent.cs +++ b/Content.Shared/GameObjects/Components/Conveyor/SharedConveyorComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Conveyor diff --git a/Content.Shared/GameObjects/Components/Damage/DamageChangeData.cs b/Content.Shared/GameObjects/Components/Damage/DamageChangeData.cs index 2abf87a92e..5e673db33a 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageChangeData.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageChangeData.cs @@ -1,4 +1,5 @@ -using Content.Shared.Damage; +#nullable enable +using Content.Shared.Damage; namespace Content.Shared.GameObjects.Components.Damage { diff --git a/Content.Shared/GameObjects/Components/Damage/DamageChangeParams.cs b/Content.Shared/GameObjects/Components/Damage/DamageChangeParams.cs index 4c09c8bf28..96aa22528b 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageChangeParams.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageChangeParams.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Body; namespace Content.Shared.GameObjects.Components.Damage diff --git a/Content.Shared/GameObjects/Components/Damage/DamageChangedEventArgs.cs b/Content.Shared/GameObjects/Components/Damage/DamageChangedEventArgs.cs index 65dc0d6b5a..3187dca772 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageChangedEventArgs.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageChangedEventArgs.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Damage; diff --git a/Content.Shared/GameObjects/Components/Damage/DamageChangedMessage.cs b/Content.Shared/GameObjects/Components/Damage/DamageChangedMessage.cs index eda969dca3..17b6261a55 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageChangedMessage.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageChangedMessage.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Content.Shared.Damage; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Damage/DamageFlag.cs b/Content.Shared/GameObjects/Components/Damage/DamageFlag.cs index 537fed2391..bea8a74fdc 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageFlag.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageFlag.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Damage diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs index e44a59d9d0..4cd3f33715 100644 --- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs +++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalMailingUnitComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -37,10 +38,10 @@ namespace Content.Shared.GameObjects.Components.Disposal public readonly bool Engaged; public readonly string Tag; public readonly List Tags; - public readonly string Target; + public readonly string? Target; public DisposalMailingUnitBoundUserInterfaceState(string unitName, string unitState, float pressure, bool powered, - bool engaged, string tag, List tags, string target) + bool engaged, string tag, List tags, string? target) { UnitName = unitName; UnitState = unitState; @@ -57,7 +58,7 @@ namespace Content.Shared.GameObjects.Components.Disposal return new DisposalMailingUnitBoundUserInterfaceState(UnitName, UnitState, Pressure, Powered, Engaged, Tag, (List)Tags.Clone(), Target); } - public bool Equals(DisposalMailingUnitBoundUserInterfaceState other) + public bool Equals(DisposalMailingUnitBoundUserInterfaceState? other) { if (other is null) return false; if (ReferenceEquals(this, other)) return true; @@ -91,9 +92,9 @@ namespace Content.Shared.GameObjects.Components.Disposal [Serializable, NetSerializable] public class UiTargetUpdateMessage : BoundUserInterfaceMessage { - public readonly string Target; + public readonly string? Target; - public UiTargetUpdateMessage(string target) + public UiTargetUpdateMessage(string? target) { Target = target; } diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalRouterComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalRouterComponent.cs index c4b38af48d..d8d96c3ce1 100644 --- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalRouterComponent.cs +++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalRouterComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Text.RegularExpressions; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalTubeComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalTubeComponent.cs index 835b0dc62d..773b8ae3e9 100644 --- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalTubeComponent.cs +++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalTubeComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Disposal diff --git a/Content.Shared/GameObjects/Components/Doors/AirlockWireStatus.cs b/Content.Shared/GameObjects/Components/Doors/AirlockWireStatus.cs index bafe35c625..e9d6a62167 100644 --- a/Content.Shared/GameObjects/Components/Doors/AirlockWireStatus.cs +++ b/Content.Shared/GameObjects/Components/Doors/AirlockWireStatus.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Doors diff --git a/Content.Shared/GameObjects/Components/Explosion/SharedClusterFlashComponent.cs b/Content.Shared/GameObjects/Components/Explosion/SharedClusterFlashComponent.cs index 248c2122d9..9f00d560ba 100644 --- a/Content.Shared/GameObjects/Components/Explosion/SharedClusterFlashComponent.cs +++ b/Content.Shared/GameObjects/Components/Explosion/SharedClusterFlashComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/ExtinguisherCabinet.cs b/Content.Shared/GameObjects/Components/ExtinguisherCabinet.cs index c42e355f1e..f7615bbb86 100644 --- a/Content.Shared/GameObjects/Components/ExtinguisherCabinet.cs +++ b/Content.Shared/GameObjects/Components/ExtinguisherCabinet.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components diff --git a/Content.Shared/GameObjects/Components/Fluids/SharedSprayComponent.cs b/Content.Shared/GameObjects/Components/Fluids/SharedSprayComponent.cs index 6ae862912b..fd291bb6eb 100644 --- a/Content.Shared/GameObjects/Components/Fluids/SharedSprayComponent.cs +++ b/Content.Shared/GameObjects/Components/Fluids/SharedSprayComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs b/Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs index 6e56e3fe31..ae9a97aae9 100644 --- a/Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs +++ b/Content.Shared/GameObjects/Components/GUI/SharedStrippableComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.GameObjects.Components.Items; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; diff --git a/Content.Shared/GameObjects/Components/Gravity/SharedGravityGeneratorComponent.cs b/Content.Shared/GameObjects/Components/Gravity/SharedGravityGeneratorComponent.cs index 7163cb07df..db4e28398b 100644 --- a/Content.Shared/GameObjects/Components/Gravity/SharedGravityGeneratorComponent.cs +++ b/Content.Shared/GameObjects/Components/Gravity/SharedGravityGeneratorComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs index 65f96d9103..4891f7937a 100644 --- a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs +++ b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Audio.Midi; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs b/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs index 0da07e3f50..630d9923bb 100644 --- a/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs +++ b/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Inventory/EquipmentSlotDefinitions.cs b/Content.Shared/GameObjects/Components/Inventory/EquipmentSlotDefinitions.cs index 790176cff7..95fb774244 100644 --- a/Content.Shared/GameObjects/Components/Inventory/EquipmentSlotDefinitions.cs +++ b/Content.Shared/GameObjects/Components/Inventory/EquipmentSlotDefinitions.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using JetBrains.Annotations; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Inventory/InventoryTemplates.cs b/Content.Shared/GameObjects/Components/Inventory/InventoryTemplates.cs index 1d5e8a753e..26e52c2271 100644 --- a/Content.Shared/GameObjects/Components/Inventory/InventoryTemplates.cs +++ b/Content.Shared/GameObjects/Components/Inventory/InventoryTemplates.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using JetBrains.Annotations; using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines; diff --git a/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs b/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs index 42994d9193..7af4fca1cf 100644 --- a/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs +++ b/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Items diff --git a/Content.Shared/GameObjects/Components/Items/IItemComponent.cs b/Content.Shared/GameObjects/Components/Items/IItemComponent.cs index 5272e6b40e..686ade5745 100644 --- a/Content.Shared/GameObjects/Components/Items/IItemComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/IItemComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Items diff --git a/Content.Shared/GameObjects/Components/Items/ISharedHandsComponent.cs b/Content.Shared/GameObjects/Components/Items/ISharedHandsComponent.cs index 5af31899dd..eafcec0bd3 100644 --- a/Content.Shared/GameObjects/Components/Items/ISharedHandsComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/ISharedHandsComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Items { diff --git a/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs b/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs index bbcff17cf3..329fa684be 100644 --- a/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs +++ b/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs index 45315b39bb..5365418c74 100644 --- a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Players; using Robust.Shared.Serialization; @@ -61,7 +62,7 @@ namespace Content.Shared.GameObjects.Components.Items }; } - public override void HandleComponentState(ComponentState curState, ComponentState nextState) + public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); diff --git a/Content.Shared/GameObjects/Components/MachineLinking/TwoWayLeverSignal.cs b/Content.Shared/GameObjects/Components/MachineLinking/TwoWayLeverSignal.cs index 86c9704d02..fb054e281a 100644 --- a/Content.Shared/GameObjects/Components/MachineLinking/TwoWayLeverSignal.cs +++ b/Content.Shared/GameObjects/Components/MachineLinking/TwoWayLeverSignal.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.MachineLinking diff --git a/Content.Shared/GameObjects/Components/Markers/SharedSpawnPointComponent.cs b/Content.Shared/GameObjects/Components/Markers/SharedSpawnPointComponent.cs index 52dbe0653d..4227667f7c 100644 --- a/Content.Shared/GameObjects/Components/Markers/SharedSpawnPointComponent.cs +++ b/Content.Shared/GameObjects/Components/Markers/SharedSpawnPointComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Markers diff --git a/Content.Shared/GameObjects/Components/Medical/SharedCloningPodComponent.cs b/Content.Shared/GameObjects/Components/Medical/SharedCloningPodComponent.cs index d2f24a79cd..db621e951b 100644 --- a/Content.Shared/GameObjects/Components/Medical/SharedCloningPodComponent.cs +++ b/Content.Shared/GameObjects/Components/Medical/SharedCloningPodComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Medical/SharedMedicalScannerComponent.cs b/Content.Shared/GameObjects/Components/Medical/SharedMedicalScannerComponent.cs index 7147740d52..542a2a3abe 100644 --- a/Content.Shared/GameObjects/Components/Medical/SharedMedicalScannerComponent.cs +++ b/Content.Shared/GameObjects/Components/Medical/SharedMedicalScannerComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Content.Shared.Damage; diff --git a/Content.Shared/GameObjects/Components/Mobs/DamageStateHelpers.cs b/Content.Shared/GameObjects/Components/Mobs/DamageStateHelpers.cs index 4592576bd8..ca0bfb3cd4 100644 --- a/Content.Shared/GameObjects/Components/Mobs/DamageStateHelpers.cs +++ b/Content.Shared/GameObjects/Components/Mobs/DamageStateHelpers.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; namespace Content.Shared.GameObjects.Components.Mobs diff --git a/Content.Shared/GameObjects/Components/Mobs/DamageStateVisuals.cs b/Content.Shared/GameObjects/Components/Mobs/DamageStateVisuals.cs index d48467bb65..fcd96dc466 100644 --- a/Content.Shared/GameObjects/Components/Mobs/DamageStateVisuals.cs +++ b/Content.Shared/GameObjects/Components/Mobs/DamageStateVisuals.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Mobs/ExaminerComponent.cs b/Content.Shared/GameObjects/Components/Mobs/ExaminerComponent.cs index 9d3f01becf..06afffaa54 100644 --- a/Content.Shared/GameObjects/Components/Mobs/ExaminerComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/ExaminerComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; diff --git a/Content.Shared/GameObjects/Components/Mobs/IActionAttempt.cs b/Content.Shared/GameObjects/Components/Mobs/IActionAttempt.cs index 1f4fd820f5..73301862b3 100644 --- a/Content.Shared/GameObjects/Components/Mobs/IActionAttempt.cs +++ b/Content.Shared/GameObjects/Components/Mobs/IActionAttempt.cs @@ -1,5 +1,4 @@ #nullable enable - using Content.Shared.Actions; using Robust.Shared.GameObjects; using Robust.Shared.Input.Binding; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedAlertsComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedAlertsComponent.cs index 1609266843..295dbd0ce4 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedAlertsComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedAlertsComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Content.Shared.Alert; using Robust.Shared.GameObjects; @@ -24,7 +25,7 @@ namespace Content.Shared.GameObjects.Components.Mobs [ViewVariables] private Dictionary _alerts = new(); - public override void HandleComponentState(ComponentState curState, ComponentState nextState) + public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedCameraRecoilComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedCameraRecoilComponent.cs index e3adaff1a8..f00ee816de 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedCameraRecoilComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedCameraRecoilComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs index f491b9ba57..a40b5f315b 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Players; @@ -36,7 +37,7 @@ namespace Content.Shared.GameObjects.Components.Mobs } } - public override void HandleComponentState(ComponentState curState, ComponentState nextState) + public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedHairComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedHairComponent.cs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs index 47754a3661..1285b3fa5f 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.Preferences; using Robust.Shared.Enums; @@ -10,7 +11,7 @@ namespace Content.Shared.GameObjects.Components.Mobs { public abstract class SharedHumanoidAppearanceComponent : Component { - private HumanoidCharacterAppearance _appearance; + private HumanoidCharacterAppearance _appearance = default!; private Sex _sex; private Gender _gender; @@ -55,7 +56,7 @@ namespace Content.Shared.GameObjects.Components.Mobs return new HumanoidAppearanceComponentState(Appearance, Sex, Gender); } - public override void HandleComponentState(ComponentState curState, ComponentState nextState) + public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedStunnableComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedStunnableComponent.cs index 034ee2387d..5948ff0513 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedStunnableComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedStunnableComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Threading; using Content.Shared.Alert; @@ -40,7 +41,7 @@ namespace Content.Shared.GameObjects.Components.Mobs protected float KnockdownTimer; protected float SlowdownTimer; - private string _stunAlertId; + private string _stunAlertId = string.Empty; protected CancellationTokenSource StatusRemoveCancellation = new(); @@ -182,7 +183,7 @@ namespace Content.Shared.GameObjects.Components.Mobs SlowdownTimer = seconds; LastStun = _gameTiming.CurTime; - if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement)) + if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement)) movement.RefreshMovementSpeedModifiers(); SetAlert(); @@ -191,7 +192,7 @@ namespace Content.Shared.GameObjects.Components.Mobs private void SetAlert() { - if (!Owner.TryGetComponent(out SharedAlertsComponent status)) + if (!Owner.TryGetComponent(out SharedAlertsComponent? status)) { return; } diff --git a/Content.Shared/GameObjects/Components/Mobs/Speech/SharedEmotingComponent.cs b/Content.Shared/GameObjects/Components/Mobs/Speech/SharedEmotingComponent.cs index edf003a196..ec239db413 100644 --- a/Content.Shared/GameObjects/Components/Mobs/Speech/SharedEmotingComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/Speech/SharedEmotingComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Mobs/Speech/SharedSpeechComponent.cs b/Content.Shared/GameObjects/Components/Mobs/Speech/SharedSpeechComponent.cs index 12a7a77995..99e3ad8740 100644 --- a/Content.Shared/GameObjects/Components/Mobs/Speech/SharedSpeechComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/Speech/SharedSpeechComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Mobs/State/BaseMobState.cs b/Content.Shared/GameObjects/Components/Mobs/State/BaseMobState.cs index e7e37684b5..ee89d95091 100644 --- a/Content.Shared/GameObjects/Components/Mobs/State/BaseMobState.cs +++ b/Content.Shared/GameObjects/Components/Mobs/State/BaseMobState.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Mobs.State diff --git a/Content.Shared/GameObjects/Components/Mobs/State/IMobState.cs b/Content.Shared/GameObjects/Components/Mobs/State/IMobState.cs index 3e29555dd4..17c060ad0c 100644 --- a/Content.Shared/GameObjects/Components/Mobs/State/IMobState.cs +++ b/Content.Shared/GameObjects/Components/Mobs/State/IMobState.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.EntitySystems.ActionBlocker; +#nullable enable +using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Mobs/State/SharedCriticalMobState.cs b/Content.Shared/GameObjects/Components/Mobs/State/SharedCriticalMobState.cs index 9382465af6..595c2dff67 100644 --- a/Content.Shared/GameObjects/Components/Mobs/State/SharedCriticalMobState.cs +++ b/Content.Shared/GameObjects/Components/Mobs/State/SharedCriticalMobState.cs @@ -1,4 +1,5 @@ -using Content.Shared.Alert; +#nullable enable +using Content.Shared.Alert; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; @@ -15,7 +16,7 @@ namespace Content.Shared.GameObjects.Components.Mobs.State { base.EnterState(entity); - if (entity.TryGetComponent(out SharedAlertsComponent status)) + if (entity.TryGetComponent(out SharedAlertsComponent? status)) { status.ShowAlert(AlertType.HumanCrit); // TODO: combine humancrit-0 and humancrit-1 into a gif and display it } diff --git a/Content.Shared/GameObjects/Components/Mobs/State/SharedDeadMobState.cs b/Content.Shared/GameObjects/Components/Mobs/State/SharedDeadMobState.cs index 49d7e7227a..dd16b6d2e7 100644 --- a/Content.Shared/GameObjects/Components/Mobs/State/SharedDeadMobState.cs +++ b/Content.Shared/GameObjects/Components/Mobs/State/SharedDeadMobState.cs @@ -1,4 +1,5 @@ -namespace Content.Shared.GameObjects.Components.Mobs.State +#nullable enable +namespace Content.Shared.GameObjects.Components.Mobs.State { public abstract class SharedDeadMobState : BaseMobState { diff --git a/Content.Shared/GameObjects/Components/Mobs/State/SharedNormalMobState.cs b/Content.Shared/GameObjects/Components/Mobs/State/SharedNormalMobState.cs index 08fbc9f044..d8fb838250 100644 --- a/Content.Shared/GameObjects/Components/Mobs/State/SharedNormalMobState.cs +++ b/Content.Shared/GameObjects/Components/Mobs/State/SharedNormalMobState.cs @@ -1,4 +1,6 @@ -namespace Content.Shared.GameObjects.Components.Mobs.State +#nullable enable + +namespace Content.Shared.GameObjects.Components.Mobs.State { /// /// The standard state an entity is in; no negative effects. diff --git a/Content.Shared/GameObjects/Components/Mobs/TargetingZone.cs b/Content.Shared/GameObjects/Components/Mobs/TargetingZone.cs index 307c36b97c..0294dc1a46 100644 --- a/Content.Shared/GameObjects/Components/Mobs/TargetingZone.cs +++ b/Content.Shared/GameObjects/Components/Mobs/TargetingZone.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Movement/IMoverComponent.cs b/Content.Shared/GameObjects/Components/Movement/IMoverComponent.cs index 8b87033b58..620a176899 100644 --- a/Content.Shared/GameObjects/Components/Movement/IMoverComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/IMoverComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/Movement/IRelayMoveInput.cs b/Content.Shared/GameObjects/Components/Movement/IRelayMoveInput.cs index 433102afd4..586b4b3641 100644 --- a/Content.Shared/GameObjects/Components/Movement/IRelayMoveInput.cs +++ b/Content.Shared/GameObjects/Components/Movement/IRelayMoveInput.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Players; namespace Content.Shared.GameObjects.Components.Movement diff --git a/Content.Shared/GameObjects/Components/Movement/MovementSpeedModifierComponent.cs b/Content.Shared/GameObjects/Components/Movement/MovementSpeedModifierComponent.cs index 663bfb5b62..dfdb8ba440 100644 --- a/Content.Shared/GameObjects/Components/Movement/MovementSpeedModifierComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/MovementSpeedModifierComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Containers; +#nullable enable +using Robust.Shared.Containers; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -58,7 +59,7 @@ namespace Content.Shared.GameObjects.Components.Movement public static void RefreshItemModifiers(IEntity item) { if (item.TryGetContainer(out var container) && - container.Owner.TryGetComponent(out MovementSpeedModifierComponent mod)) + container.Owner.TryGetComponent(out MovementSpeedModifierComponent? mod)) { mod.RefreshMovementSpeedModifiers(); } diff --git a/Content.Shared/GameObjects/Components/Movement/SharedClimbableComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedClimbableComponent.cs index 5aec1e46df..09071f5b04 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedClimbableComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedClimbableComponent.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.EntitySystems; +#nullable enable +using Content.Shared.GameObjects.EntitySystems; using Content.Shared.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs index c1c0c5a17f..626449b0ec 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedClimbingComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Content.Shared.Physics; using Robust.Shared.GameObjects; @@ -12,14 +13,14 @@ namespace Content.Shared.GameObjects.Components.Movement public sealed override string Name => "Climbing"; public sealed override uint? NetID => ContentNetIDs.CLIMBING; - protected IPhysicsComponent Body; - protected bool IsOnClimbableThisFrame = false; + protected IPhysicsComponent? Body; + protected bool IsOnClimbableThisFrame; protected bool OwnerIsTransitioning { get { - if (Body.TryGetController(out var controller)) + if (Body != null && Body.TryGetController(out var controller)) { return controller.IsActive; } diff --git a/Content.Shared/GameObjects/Components/Movement/SharedDummyInputMoverComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedDummyInputMoverComponent.cs index 07a5804b4a..91e82a958d 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedDummyInputMoverComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedDummyInputMoverComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs index 6614e22770..d8faed5fa3 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Linq; using Content.Shared.GameObjects.Components.Mobs; @@ -57,9 +58,9 @@ namespace Content.Shared.GameObjects.Components.Movement if (!Slippery || Owner.IsInContainer() || _slipped.Contains(entity.Uid) - || !entity.TryGetComponent(out SharedStunnableComponent stun) - || !entity.TryGetComponent(out IPhysicsComponent otherBody) - || !Owner.TryGetComponent(out IPhysicsComponent body)) + || !entity.TryGetComponent(out SharedStunnableComponent? stun) + || !entity.TryGetComponent(out IPhysicsComponent? otherBody) + || !Owner.TryGetComponent(out IPhysicsComponent? body)) { return false; } @@ -81,7 +82,7 @@ namespace Content.Shared.GameObjects.Components.Movement return false; } - if (entity.TryGetComponent(out IPhysicsComponent physics)) + if (entity.TryGetComponent(out IPhysicsComponent? physics)) { var controller = physics.EnsureController(); controller.LinearVelocity = physics.LinearVelocity * LaunchForwardsMultiplier; diff --git a/Content.Shared/GameObjects/Components/Nutrition/SharedCreamPiedComponent.cs b/Content.Shared/GameObjects/Components/Nutrition/SharedCreamPiedComponent.cs index 9a427f6366..ae69dcf4c0 100644 --- a/Content.Shared/GameObjects/Components/Nutrition/SharedCreamPiedComponent.cs +++ b/Content.Shared/GameObjects/Components/Nutrition/SharedCreamPiedComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Nutrition/SharedDrinkFoodContainerComponent.cs b/Content.Shared/GameObjects/Components/Nutrition/SharedDrinkFoodContainerComponent.cs index 5148a5769d..5b57dbea79 100644 --- a/Content.Shared/GameObjects/Components/Nutrition/SharedDrinkFoodContainerComponent.cs +++ b/Content.Shared/GameObjects/Components/Nutrition/SharedDrinkFoodContainerComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Nutrition/SharedFoodComponent.cs b/Content.Shared/GameObjects/Components/Nutrition/SharedFoodComponent.cs index 087df8423e..10d1394f07 100644 --- a/Content.Shared/GameObjects/Components/Nutrition/SharedFoodComponent.cs +++ b/Content.Shared/GameObjects/Components/Nutrition/SharedFoodComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Nutrition/SharedHungerComponent.cs b/Content.Shared/GameObjects/Components/Nutrition/SharedHungerComponent.cs index 451e49b2b5..136dda302c 100644 --- a/Content.Shared/GameObjects/Components/Nutrition/SharedHungerComponent.cs +++ b/Content.Shared/GameObjects/Components/Nutrition/SharedHungerComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.GameObjects.Components.Movement; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Nutrition/SharedThirstComponent.cs b/Content.Shared/GameObjects/Components/Nutrition/SharedThirstComponent.cs index 404586d76e..40b84da219 100644 --- a/Content.Shared/GameObjects/Components/Nutrition/SharedThirstComponent.cs +++ b/Content.Shared/GameObjects/Components/Nutrition/SharedThirstComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.GameObjects.Components.Movement; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Components/Observer/AcceptCloningEuiMessage.cs b/Content.Shared/GameObjects/Components/Observer/AcceptCloningEuiMessage.cs index 64bedec346..3a8354cb0c 100644 --- a/Content.Shared/GameObjects/Components/Observer/AcceptCloningEuiMessage.cs +++ b/Content.Shared/GameObjects/Components/Observer/AcceptCloningEuiMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Eui; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Observer/GhostRoles/GhostRolesEuiMessages.cs b/Content.Shared/GameObjects/Components/Observer/GhostRoles/GhostRolesEuiMessages.cs index 9c2d10a5f0..485ed15aec 100644 --- a/Content.Shared/GameObjects/Components/Observer/GhostRoles/GhostRolesEuiMessages.cs +++ b/Content.Shared/GameObjects/Components/Observer/GhostRoles/GhostRolesEuiMessages.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.Eui; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleEuiState.cs b/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleEuiState.cs index 21735e3e9f..1e6c1f44ca 100644 --- a/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleEuiState.cs +++ b/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleEuiState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Eui; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleWindowClosedMessage.cs b/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleWindowClosedMessage.cs index b604223dd4..31a606e7ea 100644 --- a/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleWindowClosedMessage.cs +++ b/Content.Shared/GameObjects/Components/Observer/GhostRoles/MakeGhostRoleWindowClosedMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Eui; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Observer/GhostWarpToLocationRequestMessage.cs b/Content.Shared/GameObjects/Components/Observer/GhostWarpToLocationRequestMessage.cs index 43836c3881..55b84542b6 100644 --- a/Content.Shared/GameObjects/Components/Observer/GhostWarpToLocationRequestMessage.cs +++ b/Content.Shared/GameObjects/Components/Observer/GhostWarpToLocationRequestMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs b/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs index 8d56744e13..8020fe2ece 100644 --- a/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs +++ b/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -51,8 +52,8 @@ namespace Content.Shared.GameObjects.Components.PDA public bool FlashlightEnabled; public bool HasPen; public PDAIdInfoText PDAOwnerInfo; - public UplinkAccountData Account; - public UplinkListingData[] Listings; + public UplinkAccountData Account = default!; + public UplinkListingData[] Listings = default!; public PDAUpdateState(bool isFlashlightOn, bool hasPen, PDAIdInfoText ownerInfo) { @@ -107,9 +108,9 @@ namespace Content.Shared.GameObjects.Components.PDA [Serializable, NetSerializable] public struct PDAIdInfoText { - public string ActualOwnerName; - public string IdOwner; - public string JobTitle; + public string? ActualOwnerName; + public string? IdOwner; + public string? JobTitle; } [Serializable, NetSerializable] @@ -127,7 +128,7 @@ namespace Content.Shared.GameObjects.Components.PDA public class UplinkAccount { - public event Action BalanceChanged; + public event Action? BalanceChanged; public EntityUid AccountHolder; private int _balance; [ViewVariables] @@ -148,7 +149,6 @@ namespace Content.Shared.GameObjects.Components.PDA _balance = newBalance; BalanceChanged?.Invoke(this); return true; - } } @@ -185,7 +185,7 @@ namespace Content.Shared.GameObjects.Components.PDA ItemId = itemId; } - public bool Equals(UplinkListingData other) + public bool Equals(UplinkListingData? other) { if (other == null) { diff --git a/Content.Shared/GameObjects/Components/PDA/UplinkCategory.cs b/Content.Shared/GameObjects/Components/PDA/UplinkCategory.cs index a9278bba79..0eb7ed1372 100644 --- a/Content.Shared/GameObjects/Components/PDA/UplinkCategory.cs +++ b/Content.Shared/GameObjects/Components/PDA/UplinkCategory.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.GameObjects.Components.PDA { public enum UplinkCategory diff --git a/Content.Shared/GameObjects/Components/Pointing/SharedPointingArrowComponent.cs b/Content.Shared/GameObjects/Components/Pointing/SharedPointingArrowComponent.cs index 4bca8f7007..f514209e24 100644 --- a/Content.Shared/GameObjects/Components/Pointing/SharedPointingArrowComponent.cs +++ b/Content.Shared/GameObjects/Components/Pointing/SharedPointingArrowComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components.Pointing { diff --git a/Content.Shared/GameObjects/Components/Pointing/SharedRoguePointingArrowComponent.cs b/Content.Shared/GameObjects/Components/Pointing/SharedRoguePointingArrowComponent.cs index a18ec2101a..8bdb0bbfa2 100644 --- a/Content.Shared/GameObjects/Components/Pointing/SharedRoguePointingArrowComponent.cs +++ b/Content.Shared/GameObjects/Components/Pointing/SharedRoguePointingArrowComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs b/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs index 9324abe693..720fef70a4 100644 --- a/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs +++ b/Content.Shared/GameObjects/Components/Portal/SharedPortalComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Portal/SharedTeleporterComponent.cs b/Content.Shared/GameObjects/Components/Portal/SharedTeleporterComponent.cs index b1b71a3492..fc64aa3178 100644 --- a/Content.Shared/GameObjects/Components/Portal/SharedTeleporterComponent.cs +++ b/Content.Shared/GameObjects/Components/Portal/SharedTeleporterComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/GameObjects/Components/Power/AME/SharedAMEControllerComponent.cs b/Content.Shared/GameObjects/Components/Power/AME/SharedAMEControllerComponent.cs index 1a4140f62d..4db2c4d4e0 100644 --- a/Content.Shared/GameObjects/Components/Power/AME/SharedAMEControllerComponent.cs +++ b/Content.Shared/GameObjects/Components/Power/AME/SharedAMEControllerComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/AME/SharedAMEShieldComponent.cs b/Content.Shared/GameObjects/Components/Power/AME/SharedAMEShieldComponent.cs index 307be8f1b3..3920320910 100644 --- a/Content.Shared/GameObjects/Components/Power/AME/SharedAMEShieldComponent.cs +++ b/Content.Shared/GameObjects/Components/Power/AME/SharedAMEShieldComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/SharedApc.cs b/Content.Shared/GameObjects/Components/Power/SharedApc.cs index de4b2af2b8..aa022c791a 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedApc.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedApc.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -46,7 +47,7 @@ namespace Content.Shared.GameObjects.Components.Power [Serializable, NetSerializable] public sealed class ApcToggleMainBreakerMessage : BoundUserInterfaceMessage - { + { } public enum ApcExternalPowerState diff --git a/Content.Shared/GameObjects/Components/Power/SharedLatheComponent.cs b/Content.Shared/GameObjects/Components/Power/SharedLatheComponent.cs index 34a986db75..c3408d212a 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedLatheComponent.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedLatheComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/SharedPower.cs b/Content.Shared/GameObjects/Components/Power/SharedPower.cs index 3ba49bdb58..36387595b4 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedPower.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedPower.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Power diff --git a/Content.Shared/GameObjects/Components/Power/SharedPowerCell.cs b/Content.Shared/GameObjects/Components/Power/SharedPowerCell.cs index d460a8dd3c..9ef4e81afe 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedPowerCell.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedPowerCell.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/SharedPowerDevice.cs b/Content.Shared/GameObjects/Components/Power/SharedPowerDevice.cs index 67ee873851..485b55ec6c 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedPowerDevice.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedPowerDevice.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/SharedPowerItemCharger.cs b/Content.Shared/GameObjects/Components/Power/SharedPowerItemCharger.cs index 8f2675727a..a0a52d1ebd 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedPowerItemCharger.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedPowerItemCharger.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Power/SharedSmesComponent.cs b/Content.Shared/GameObjects/Components/Power/SharedSmesComponent.cs index 4dd4e5358b..85b12c6159 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedSmesComponent.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedSmesComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Power diff --git a/Content.Shared/GameObjects/Components/Power/SharedSolarControlConsoleComponent.cs b/Content.Shared/GameObjects/Components/Power/SharedSolarControlConsoleComponent.cs index c21dea2e56..9dcf47d5ec 100644 --- a/Content.Shared/GameObjects/Components/Power/SharedSolarControlConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Power/SharedSolarControlConsoleComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs b/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs index 78746e0f8e..6804f756b6 100644 --- a/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs +++ b/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Physics; diff --git a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs index d5e7526370..2574cea788 100644 --- a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs +++ b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs @@ -53,7 +53,7 @@ namespace Content.Shared.GameObjects.Components.Pulling Dirty(); _pullerPhysics = null; - if (_physics != null) + if (_physics != null && oldPullerPhysics != null) { var message = new PullStoppedMessage(oldPullerPhysics, _physics); diff --git a/Content.Shared/GameObjects/Components/Recycling/SharedRecyclerComponent.cs b/Content.Shared/GameObjects/Components/Recycling/SharedRecyclerComponent.cs index 3920dbc327..85043ae55f 100644 --- a/Content.Shared/GameObjects/Components/Recycling/SharedRecyclerComponent.cs +++ b/Content.Shared/GameObjects/Components/Recycling/SharedRecyclerComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Recycling diff --git a/Content.Shared/GameObjects/Components/ReinforcedWallVisuals.cs b/Content.Shared/GameObjects/Components/ReinforcedWallVisuals.cs index 5265f76d7c..55031ca418 100644 --- a/Content.Shared/GameObjects/Components/ReinforcedWallVisuals.cs +++ b/Content.Shared/GameObjects/Components/ReinforcedWallVisuals.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components diff --git a/Content.Shared/GameObjects/Components/Research/SharedLatheComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedLatheComponent.cs index 91f0fa8959..254d2702a1 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedLatheComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedLatheComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Content.Shared.Research; @@ -17,8 +18,8 @@ namespace Content.Shared.GameObjects.Components.Research public bool CanProduce(LatheRecipePrototype recipe, int quantity = 1) { - if (!Owner.TryGetComponent(out SharedMaterialStorageComponent storage) - || !Owner.TryGetComponent(out SharedLatheDatabaseComponent database)) return false; + if (!Owner.TryGetComponent(out SharedMaterialStorageComponent? storage) + || !Owner.TryGetComponent(out SharedLatheDatabaseComponent? database)) return false; if (!database.Contains(recipe)) return false; @@ -32,7 +33,7 @@ namespace Content.Shared.GameObjects.Components.Research public bool CanProduce(string ID, int quantity = 1) { - return PrototypeManager.TryIndex(ID, out LatheRecipePrototype recipe) && CanProduce(recipe, quantity); + return PrototypeManager.TryIndex(ID, out LatheRecipePrototype? recipe) && CanProduce(recipe, quantity); } /// diff --git a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs index f77fe025e6..659df1669b 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections; using System.Collections.Generic; @@ -83,7 +84,7 @@ namespace Content.Shared.GameObjects.Components.Research foreach (var id in recipes) { - if (prototypeManager.TryIndex(id, out LatheRecipePrototype recipe)) + if (prototypeManager.TryIndex(id, out LatheRecipePrototype? recipe)) { _recipes.Add(recipe); } diff --git a/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs index 5ded848a25..7f92f2e414 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs @@ -1,7 +1,7 @@ +#nullable enable using System; using System.Collections; using System.Collections.Generic; -using Content.Shared.Materials; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -11,7 +11,7 @@ namespace Content.Shared.GameObjects.Components.Research public class SharedMaterialStorageComponent : Component, IEnumerable> { [ViewVariables] - protected virtual Dictionary Storage { get; set; } + protected virtual Dictionary Storage { get; set; } = new(); public override string Name => "MaterialStorage"; public sealed override uint? NetID => ContentNetIDs.MATERIAL_STORAGE; @@ -25,17 +25,6 @@ namespace Content.Shared.GameObjects.Components.Research } } - public int this[Material material] - { - get - { - var ID = material.ID; - if (!Storage.ContainsKey(ID)) - return 0; - return Storage[ID]; - } - } - /// /// The total volume of material stored currently. /// diff --git a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs index b30e5ed759..221f9416ac 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Content.Shared.Research; @@ -35,7 +36,7 @@ namespace Content.Shared.GameObjects.Components.Research foreach (var id in recipes) { - if (prototypeManager.TryIndex(id, out LatheRecipePrototype recipe)) + if (prototypeManager.TryIndex(id, out LatheRecipePrototype? recipe)) { _protolatheRecipes.Add(recipe); } diff --git a/Content.Shared/GameObjects/Components/Research/SharedResearchClientComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedResearchClientComponent.cs index 592eaa1ac7..bd95026ec7 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedResearchClientComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedResearchClientComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Research/SharedResearchConsoleComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedResearchConsoleComponent.cs index 36aa36fad5..427d57a942 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedResearchConsoleComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedResearchConsoleComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs index b4ebcd6f79..24a77c3330 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections; using System.Collections.Generic; @@ -69,7 +70,7 @@ namespace Content.Shared.GameObjects.Components.Research var protoMan = IoCManager.Resolve(); foreach (var technologyId in technology.RequiredTechnologies) { - protoMan.TryIndex(technologyId, out TechnologyPrototype requiredTechnology); + protoMan.TryIndex(technologyId, out TechnologyPrototype? requiredTechnology); if (requiredTechnology == null) return false; @@ -92,7 +93,7 @@ namespace Content.Shared.GameObjects.Components.Research foreach (var id in techs) { - if (prototypeManager.TryIndex(id, out TechnologyPrototype tech)) + if (prototypeManager.TryIndex(id, out TechnologyPrototype? tech)) { _technologies.Add(tech); } diff --git a/Content.Shared/GameObjects/Components/Rotation/SharedRotationComponent.cs b/Content.Shared/GameObjects/Components/Rotation/SharedRotationComponent.cs index acdb33b7db..d21f30603f 100644 --- a/Content.Shared/GameObjects/Components/Rotation/SharedRotationComponent.cs +++ b/Content.Shared/GameObjects/Components/Rotation/SharedRotationComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Rotation diff --git a/Content.Shared/GameObjects/Components/SharedBurningStates.cs b/Content.Shared/GameObjects/Components/SharedBurningStates.cs index d371943d62..150d6cb517 100644 --- a/Content.Shared/GameObjects/Components/SharedBurningStates.cs +++ b/Content.Shared/GameObjects/Components/SharedBurningStates.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components diff --git a/Content.Shared/GameObjects/Components/SharedCanBuildWindowOnTopComponent.cs b/Content.Shared/GameObjects/Components/SharedCanBuildWindowOnTopComponent.cs index 6cc59062e5..073ee1d091 100644 --- a/Content.Shared/GameObjects/Components/SharedCanBuildWindowOnTopComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedCanBuildWindowOnTopComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components { diff --git a/Content.Shared/GameObjects/Components/SharedComputerComponent.cs b/Content.Shared/GameObjects/Components/SharedComputerComponent.cs index a3e5162893..f469c46a0b 100644 --- a/Content.Shared/GameObjects/Components/SharedComputerComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedComputerComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedConfigurationComponent.cs b/Content.Shared/GameObjects/Components/SharedConfigurationComponent.cs index b88dc252ca..12a9786b71 100644 --- a/Content.Shared/GameObjects/Components/SharedConfigurationComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedConfigurationComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using System; using System.Collections.Generic; diff --git a/Content.Shared/GameObjects/Components/SharedCrayonComponent.cs b/Content.Shared/GameObjects/Components/SharedCrayonComponent.cs index 17c44fdfc5..593181efb7 100644 --- a/Content.Shared/GameObjects/Components/SharedCrayonComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedCrayonComponent.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Maths; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -13,8 +14,8 @@ namespace Content.Shared.GameObjects.Components public override string Name => "Crayon"; public override uint? NetID => ContentNetIDs.CRAYONS; - public string SelectedState { get; set; } - protected string _color; + public string SelectedState { get; set; } = string.Empty; + protected string _color = "white"; [Serializable, NetSerializable] public enum CrayonUiKey @@ -73,12 +74,12 @@ namespace Content.Shared.GameObjects.Components [Serializable, NetSerializable, Prototype("crayonDecal")] public class CrayonDecalPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; - private string _spritePath; + private string _spritePath = string.Empty; public string SpritePath => _spritePath; - private List _decals; + private List _decals = new(); public List Decals => _decals; public void LoadFrom(YamlMappingNode mapping) @@ -86,7 +87,7 @@ namespace Content.Shared.GameObjects.Components var serializer = YamlObjectSerializer.NewReader(mapping); serializer.DataField(this, x => x.ID, "id", string.Empty); - serializer.DataField(ref _spritePath, "spritePath", ""); + serializer.DataField(ref _spritePath, "spritePath", string.Empty); serializer.DataField(ref _decals, "decals", new List()); } } diff --git a/Content.Shared/GameObjects/Components/SharedDoAfterComponent.cs b/Content.Shared/GameObjects/Components/SharedDoAfterComponent.cs index 9e04ef0dd4..ceac559c62 100644 --- a/Content.Shared/GameObjects/Components/SharedDoAfterComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedDoAfterComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/GameObjects/Components/SharedExpendableLightComponent.cs b/Content.Shared/GameObjects/Components/SharedExpendableLightComponent.cs index 64ad517b91..99d07aa7f7 100644 --- a/Content.Shared/GameObjects/Components/SharedExpendableLightComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedExpendableLightComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; using Robust.Shared.ViewVariables; @@ -28,10 +29,10 @@ namespace Content.Shared.GameObjects.Components protected ExpendableLightState CurrentState { get; set; } [ViewVariables] - protected string TurnOnBehaviourID { get; set; } + protected string TurnOnBehaviourID { get; set; } = string.Empty; [ViewVariables] - protected string FadeOutBehaviourID { get; set; } + protected string FadeOutBehaviourID { get; set; } = string.Empty; [ViewVariables] protected float GlowDuration { get; set; } @@ -40,25 +41,25 @@ namespace Content.Shared.GameObjects.Components protected float FadeOutDuration { get; set; } [ViewVariables] - protected string SpentDesc { get; set; } + protected string SpentDesc { get; set; } = string.Empty; [ViewVariables] - protected string SpentName { get; set; } + protected string SpentName { get; set; } = string.Empty; [ViewVariables] - protected string IconStateSpent { get; set; } + protected string IconStateSpent { get; set; } = string.Empty; [ViewVariables] - protected string IconStateLit { get; set; } + protected string IconStateLit { get; set; } = string.Empty; [ViewVariables] - protected string LitSound { get; set; } + protected string LitSound { get; set; } = string.Empty; [ViewVariables] - protected string LoopedSound { get; set; } + protected string LoopedSound { get; set; } = string.Empty; [ViewVariables] - protected string DieSound { get; set; } + protected string DieSound { get; set; } = string.Empty; public override void ExposeData(ObjectSerializer serializer) { diff --git a/Content.Shared/GameObjects/Components/SharedGasAnalyzerComponent.cs b/Content.Shared/GameObjects/Components/SharedGasAnalyzerComponent.cs index 5d9e5fa01a..4c98bed0cd 100644 --- a/Content.Shared/GameObjects/Components/SharedGasAnalyzerComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedGasAnalyzerComponent.cs @@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.Components public float Pressure; public float Temperature; public GasEntry[] Gases; - public string Error; + public string Error = string.Empty; public GasAnalyzerBoundUserInterfaceState(float pressure, float temperature, GasEntry[] gases, string error = null) { diff --git a/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs b/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs index 085d6ca06c..00074a837f 100644 --- a/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedLightBehaviourComponent.cs b/Content.Shared/GameObjects/Components/SharedLightBehaviourComponent.cs index 9965cced26..92fd719cc1 100644 --- a/Content.Shared/GameObjects/Components/SharedLightBehaviourComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedLightBehaviourComponent.cs @@ -1,4 +1,4 @@ - +#nullable enable using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Components @@ -6,7 +6,7 @@ namespace Content.Shared.GameObjects.Components /// /// A component which applies a specific behaviour to a PointLightComponent on its owner. /// - public class SharedLightBehaviourComponent : Component + public class SharedLightBehaviourComponent : Component { public override string Name => "LightBehaviour"; } diff --git a/Content.Shared/GameObjects/Components/SharedMagbootsComponent.cs b/Content.Shared/GameObjects/Components/SharedMagbootsComponent.cs index 02f19e4350..ac28dd363f 100644 --- a/Content.Shared/GameObjects/Components/SharedMagbootsComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedMagbootsComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Movement; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedMagicMirrorComponent.cs b/Content.Shared/GameObjects/Components/SharedMagicMirrorComponent.cs index 54f50c44fa..ad29deb50c 100644 --- a/Content.Shared/GameObjects/Components/SharedMagicMirrorComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedMagicMirrorComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/SharedPaperComponent.cs b/Content.Shared/GameObjects/Components/SharedPaperComponent.cs index f3baf5c57b..91a90754c1 100644 --- a/Content.Shared/GameObjects/Components/SharedPaperComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedPaperComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs b/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs index ef84393789..9bffabf4a7 100644 --- a/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedPlaceableSurfaceComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs b/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs index 1e2fd11d43..c2dcb33444 100644 --- a/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs +++ b/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedVaporComponent.cs b/Content.Shared/GameObjects/Components/SharedVaporComponent.cs index 682eaef39c..6923617ffc 100644 --- a/Content.Shared/GameObjects/Components/SharedVaporComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedVaporComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedWindowComponent.cs b/Content.Shared/GameObjects/Components/SharedWindowComponent.cs index ed62f9cf57..522bfb5f99 100644 --- a/Content.Shared/GameObjects/Components/SharedWindowComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedWindowComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/SharedWiresComponent.cs b/Content.Shared/GameObjects/Components/SharedWiresComponent.cs index db319fd9d1..9bdf24a5a1 100644 --- a/Content.Shared/GameObjects/Components/SharedWiresComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedWiresComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Diagnostics.CodeAnalysis; using JetBrains.Annotations; @@ -115,12 +116,12 @@ namespace Content.Shared.GameObjects.Components public class WiresBoundUserInterfaceState : BoundUserInterfaceState { public string BoardName { get; } - public string SerialNumber { get; } + public string? SerialNumber { get; } public ClientWire[] WiresList { get; } public StatusEntry[] Statuses { get; } public int WireSeed { get; } - public WiresBoundUserInterfaceState(ClientWire[] wiresList, StatusEntry[] statuses, string boardName, string serialNumber, int wireSeed) + public WiresBoundUserInterfaceState(ClientWire[] wiresList, StatusEntry[] statuses, string boardName, string? serialNumber, int wireSeed) { BoardName = boardName; SerialNumber = serialNumber; diff --git a/Content.Shared/GameObjects/Components/Singularity/SharedEmitterComponent.cs b/Content.Shared/GameObjects/Components/Singularity/SharedEmitterComponent.cs index 7844f3f215..013451f462 100644 --- a/Content.Shared/GameObjects/Components/Singularity/SharedEmitterComponent.cs +++ b/Content.Shared/GameObjects/Components/Singularity/SharedEmitterComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Singularity diff --git a/Content.Shared/GameObjects/Components/Singularity/SharedParticleAcceleratorComponent.cs b/Content.Shared/GameObjects/Components/Singularity/SharedParticleAcceleratorComponent.cs index e39082c3c1..00c33f0cef 100644 --- a/Content.Shared/GameObjects/Components/Singularity/SharedParticleAcceleratorComponent.cs +++ b/Content.Shared/GameObjects/Components/Singularity/SharedParticleAcceleratorComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Singularity/SharedRadiationCollectorComponent.cs b/Content.Shared/GameObjects/Components/Singularity/SharedRadiationCollectorComponent.cs index f2bc67424f..492cd7ee01 100644 --- a/Content.Shared/GameObjects/Components/Singularity/SharedRadiationCollectorComponent.cs +++ b/Content.Shared/GameObjects/Components/Singularity/SharedRadiationCollectorComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Singularity diff --git a/Content.Shared/GameObjects/Components/SmokingVisuals.cs b/Content.Shared/GameObjects/Components/SmokingVisuals.cs index 851a510d6d..cdc2516bd8 100644 --- a/Content.Shared/GameObjects/Components/SmokingVisuals.cs +++ b/Content.Shared/GameObjects/Components/SmokingVisuals.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components diff --git a/Content.Shared/GameObjects/Components/Sound/SharedLoopingSoundComponent.cs b/Content.Shared/GameObjects/Components/Sound/SharedLoopingSoundComponent.cs index 63c1b9d907..bdf5247517 100644 --- a/Content.Shared/GameObjects/Components/Sound/SharedLoopingSoundComponent.cs +++ b/Content.Shared/GameObjects/Components/Sound/SharedLoopingSoundComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Audio; using Robust.Shared.GameObjects; @@ -45,7 +46,7 @@ namespace Content.Shared.GameObjects.Components.Sound [NetSerializable, Serializable] public class ScheduledSoundMessage : ComponentMessage { - public ScheduledSound Schedule; + public ScheduledSound Schedule = new(); public ScheduledSoundMessage() { Directed = true; @@ -55,7 +56,7 @@ namespace Content.Shared.GameObjects.Components.Sound [NetSerializable, Serializable] public class StopSoundScheduleMessage : ComponentMessage { - public string Filename; + public string Filename = string.Empty; public StopSoundScheduleMessage() { Directed = true; diff --git a/Content.Shared/GameObjects/Components/Storage/SharedMorgue.cs b/Content.Shared/GameObjects/Components/Storage/SharedMorgue.cs index 09699d8c89..23bf44f188 100644 --- a/Content.Shared/GameObjects/Components/Storage/SharedMorgue.cs +++ b/Content.Shared/GameObjects/Components/Storage/SharedMorgue.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Morgue diff --git a/Content.Shared/GameObjects/Components/Storage/SharedStorableComponent.cs b/Content.Shared/GameObjects/Components/Storage/SharedStorableComponent.cs index 26544b32b9..652431c00f 100644 --- a/Content.Shared/GameObjects/Components/Storage/SharedStorableComponent.cs +++ b/Content.Shared/GameObjects/Components/Storage/SharedStorableComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Strap/SharedStrapComponent.cs b/Content.Shared/GameObjects/Components/Strap/SharedStrapComponent.cs index 58872c82e5..e8354badd5 100644 --- a/Content.Shared/GameObjects/Components/Strap/SharedStrapComponent.cs +++ b/Content.Shared/GameObjects/Components/Strap/SharedStrapComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Buckle; using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Utility; @@ -33,7 +34,7 @@ namespace Content.Shared.GameObjects.Components.Strap bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs) { - if (!eventArgs.Dragged.TryGetComponent(out SharedBuckleComponent buckleComponent)) return false; + if (!eventArgs.Dragged.TryGetComponent(out SharedBuckleComponent? buckleComponent)) return false; bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target; return eventArgs.Target.InRangeUnobstructed(eventArgs.Dragged, buckleComponent.Range, predicate: Ignored); diff --git a/Content.Shared/GameObjects/Components/Trigger/TriggerVisuals.cs b/Content.Shared/GameObjects/Components/Trigger/TriggerVisuals.cs index d64a3bcdaa..4952fafc2a 100644 --- a/Content.Shared/GameObjects/Components/Trigger/TriggerVisuals.cs +++ b/Content.Shared/GameObjects/Components/Trigger/TriggerVisuals.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.GameObjects.Components.Trigger diff --git a/Content.Shared/GameObjects/Components/VendingMachines/SharedVendingMachineComponent.cs b/Content.Shared/GameObjects/Components/VendingMachines/SharedVendingMachineComponent.cs index 49f33ae9e8..37c47a4ec6 100644 --- a/Content.Shared/GameObjects/Components/VendingMachines/SharedVendingMachineComponent.cs +++ b/Content.Shared/GameObjects/Components/VendingMachines/SharedVendingMachineComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Weapons/Melee/MeleeWeaponAnimationPrototype.cs b/Content.Shared/GameObjects/Components/Weapons/Melee/MeleeWeaponAnimationPrototype.cs index dec76db0df..1fb24206c2 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Melee/MeleeWeaponAnimationPrototype.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Melee/MeleeWeaponAnimationPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Maths; using Robust.Shared.Prototypes; @@ -10,9 +11,9 @@ namespace Content.Shared.GameObjects.Components.Weapons.Melee [Prototype("MeleeWeaponAnimation")] public sealed class MeleeWeaponAnimationPrototype : IPrototype { - private string _prototype; - private string _state; - private string _id; + private string _prototype = "WeaponArc"; + private string _state = string.Empty; + private string _id = string.Empty; private Vector4 _colorDelta; private Vector4 _color; private TimeSpan _length; @@ -35,8 +36,8 @@ namespace Content.Shared.GameObjects.Components.Weapons.Melee var serializer = YamlObjectSerializer.NewReader(mapping); serializer.DataField(ref _prototype, "prototype", "WeaponArc"); - serializer.DataField(ref _state, "state", null); - serializer.DataField(ref _id, "id", null); + serializer.DataField(ref _state, "state", string.Empty); + serializer.DataField(ref _id, "id", string.Empty); serializer.DataField(ref _colorDelta, "colorDelta", Vector4.Zero); serializer.DataField(ref _color, "color", new Vector4(1, 1, 1, 1)); if (serializer.TryReadDataField("length", out float length)) diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBatteryBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBatteryBarrelComponent.cs index d5f53122b1..06590a92a8 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBatteryBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBatteryBarrelComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBoltActionBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBoltActionBarrelComponent.cs index 04c1b27e71..0e61684769 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBoltActionBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedBoltActionBarrelComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedMagazineBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedMagazineBarrelComponent.cs index 319327f5d5..e317db57ee 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedMagazineBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedMagazineBarrelComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -31,12 +32,12 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels public FireRateSelector FireRateSelector { get; } public (int count, int max)? Magazine { get; } public string SoundGunshot { get; } - + public MagazineBarrelComponentState( - bool chambered, - FireRateSelector fireRateSelector, + bool chambered, + FireRateSelector fireRateSelector, (int count, int max)? magazine, - string soundGunshot) : + string soundGunshot) : base(ContentNetIDs.MAGAZINE_BARREL) { Chambered = chambered; @@ -45,4 +46,4 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels SoundGunshot = soundGunshot; } } -} \ No newline at end of file +} diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedPumpBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedPumpBarrelComponent.cs index b4e457ea5c..30ce26a2ea 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedPumpBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedPumpBarrelComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedRevolverBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedRevolverBarrelComponent.cs index 99c5103af3..a26e0250da 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedRevolverBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/Barrels/SharedRevolverBarrelComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/MagazineAutoEjectMessage.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/MagazineAutoEjectMessage.cs index fe8f2e183c..bebda8dfb4 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/MagazineAutoEjectMessage.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/MagazineAutoEjectMessage.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -9,4 +10,4 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged /// [Serializable, NetSerializable] public sealed class MagazineAutoEjectMessage : ComponentMessage {} -} \ No newline at end of file +} diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedBarrelComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedBarrelComponent.cs index d0562410a2..dbb3010b10 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedBarrelComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedBarrelComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.ViewVariables; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedWeaponComponent.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedWeaponComponent.cs index 882ae4beee..a727e59910 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedWeaponComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/SharedRangedWeaponComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -18,7 +19,7 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged public sealed class RangedWeaponComponentState : ComponentState { public FireRateSelector FireRateSelector { get; } - + public RangedWeaponComponentState( FireRateSelector fireRateSelector ) : base(ContentNetIDs.RANGED_WEAPON) diff --git a/Content.Shared/GameObjects/Components/Weapons/SharedFlashableComponent.cs b/Content.Shared/GameObjects/Components/Weapons/SharedFlashableComponent.cs index 6143825eb4..ccc2480d3f 100644 --- a/Content.Shared/GameObjects/Components/Weapons/SharedFlashableComponent.cs +++ b/Content.Shared/GameObjects/Components/Weapons/SharedFlashableComponent.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/ContentNetIDs.cs b/Content.Shared/GameObjects/ContentNetIDs.cs index 727b6a4f12..122f688364 100644 --- a/Content.Shared/GameObjects/ContentNetIDs.cs +++ b/Content.Shared/GameObjects/ContentNetIDs.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.GameObjects { // Starting from 1000 to avoid crossover with engine. diff --git a/Content.Shared/GameObjects/DrawDepth.cs b/Content.Shared/GameObjects/DrawDepth.cs index 22771f551f..5062fd87df 100644 --- a/Content.Shared/GameObjects/DrawDepth.cs +++ b/Content.Shared/GameObjects/DrawDepth.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Serialization; using DrawDepthTag = Robust.Shared.GameObjects.DrawDepth; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/CombatModeSystemMessages.cs b/Content.Shared/GameObjects/EntitySystemMessages/CombatModeSystemMessages.cs index 814d844c22..d36ff7add7 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/CombatModeSystemMessages.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/CombatModeSystemMessages.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.GameObjects.Components.Mobs; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs b/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs index 8812af2294..693a16b325 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/DragDropMessage.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/ExamineSystemMessages.cs b/Content.Shared/GameObjects/EntitySystemMessages/ExamineSystemMessages.cs index e95ca5c632..e494748897 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/ExamineSystemMessages.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/ExamineSystemMessages.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/Gravity/GravityChangedMessage.cs b/Content.Shared/GameObjects/EntitySystemMessages/Gravity/GravityChangedMessage.cs index 5b54d058fd..64df4866d1 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/Gravity/GravityChangedMessage.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/Gravity/GravityChangedMessage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Map; namespace Content.Shared.GameObjects.EntitySystemMessages.Gravity diff --git a/Content.Shared/GameObjects/EntitySystemMessages/MeleeWeaponSystemMessages.cs b/Content.Shared/GameObjects/EntitySystemMessages/MeleeWeaponSystemMessages.cs index d949c33c76..840ac9bd4f 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/MeleeWeaponSystemMessages.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/MeleeWeaponSystemMessages.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/PlayerContainerVisibilityMessage.cs b/Content.Shared/GameObjects/EntitySystemMessages/PlayerContainerVisibilityMessage.cs index 3795e5a14b..c65ff08b3b 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/PlayerContainerVisibilityMessage.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/PlayerContainerVisibilityMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/SingularitySoundMessage.cs b/Content.Shared/GameObjects/EntitySystemMessages/SingularitySoundMessage.cs index 66392f6c43..5aa379ea65 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/SingularitySoundMessage.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/SingularitySoundMessage.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/SuspicionMessages.cs b/Content.Shared/GameObjects/EntitySystemMessages/SuspicionMessages.cs index c540b0a4a5..12af729e15 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/SuspicionMessages.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/SuspicionMessages.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/EntitySystemMessages/VerbSystemMessages.cs b/Content.Shared/GameObjects/EntitySystemMessages/VerbSystemMessages.cs index 89e53b7db5..c843939518 100644 --- a/Content.Shared/GameObjects/EntitySystemMessages/VerbSystemMessages.cs +++ b/Content.Shared/GameObjects/EntitySystemMessages/VerbSystemMessages.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Content.Shared.GameObjects.Verbs; using Robust.Shared.GameObjects; @@ -38,7 +39,7 @@ namespace Content.Shared.GameObjects.EntitySystemMessages public readonly string Key; public readonly string Category; public readonly SpriteSpecifier Icon; - public readonly SpriteSpecifier CategoryIcon; + public readonly SpriteSpecifier? CategoryIcon; public readonly bool Available; public NetVerbData(VerbData data, string key) diff --git a/Content.Shared/GameObjects/EntitySystems/ActSystem.cs b/Content.Shared/GameObjects/EntitySystems/ActSystem.cs index 3489b7883a..0634aaeae6 100644 --- a/Content.Shared/GameObjects/EntitySystems/ActSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/ActSystem.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Linq; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -19,12 +20,12 @@ namespace Content.Shared.GameObjects.EntitySystems public class DestructionEventArgs : EventArgs { - public IEntity Owner { get; set; } + public IEntity Owner { get; set; } = default!; } public class BreakageEventArgs : EventArgs { - public IEntity Owner { get; set; } + public IEntity Owner { get; set; } = default!; } public interface IBreakAct @@ -46,7 +47,7 @@ namespace Content.Shared.GameObjects.EntitySystems public class ExplosionEventArgs : EventArgs { public EntityCoordinates Source { get; set; } - public IEntity Target { get; set; } + public IEntity Target { get; set; } = default!; public ExplosionSeverity Severity { get; set; } } diff --git a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerExtensions.cs b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerExtensions.cs index c631d5395f..830309b21e 100644 --- a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerExtensions.cs +++ b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerExtensions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker { diff --git a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerSystem.cs b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerSystem.cs index ac739e2984..e94a71c7e7 100644 --- a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/ActionBlockerSystem.cs @@ -1,4 +1,6 @@ -using Content.Shared.GameObjects.Components.Mobs.Speech; +#nullable enable +using System.Diagnostics.CodeAnalysis; +using Content.Shared.GameObjects.Components.Mobs.Speech; using Content.Shared.GameObjects.EntitySystems.EffectBlocker; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -24,8 +26,13 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker return canMove; } - public static bool CanInteract(IEntity entity) + public static bool CanInteract([NotNullWhen(true)] IEntity? entity) { + if (entity == null) + { + return false; + } + var canInteract = true; foreach (var blocker in entity.GetAllComponents()) @@ -36,8 +43,13 @@ namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker return canInteract; } - public static bool CanUse(IEntity entity) + public static bool CanUse([NotNullWhen(true)] IEntity? entity) { + if (entity == null) + { + return false; + } + var canUse = true; foreach (var blocker in entity.GetAllComponents()) diff --git a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/IActionBlocker.cs b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/IActionBlocker.cs index 8d23ceea0d..99c227a7ae 100644 --- a/Content.Shared/GameObjects/EntitySystems/ActionBlocker/IActionBlocker.cs +++ b/Content.Shared/GameObjects/EntitySystems/ActionBlocker/IActionBlocker.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.EntitySystems.EffectBlocker; +#nullable enable +using Content.Shared.GameObjects.EntitySystems.EffectBlocker; namespace Content.Shared.GameObjects.EntitySystems.ActionBlocker { diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs index aab8b95d51..8fdd208c6f 100644 --- a/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs +++ b/Content.Shared/GameObjects/EntitySystems/Atmos/GasOverlayChunk.cs @@ -1,3 +1,4 @@ +#nullable enable using System.Collections.Generic; using Robust.Shared.Map; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs index 1d340b5c46..72fd2e87ee 100644 --- a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosDebugOverlaySystem.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Serialization; diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosphereSystem.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosphereSystem.cs index 0841811a2e..68abfbde8c 100644 --- a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosphereSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedAtmosphereSystem.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Content.Shared.Atmos; using Robust.Shared.GameObjects; using Robust.Shared.IoC; diff --git a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs index f99f869c69..1112c5f241 100644 --- a/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/Atmos/SharedGasTileOverlaySystem.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/GameObjects/EntitySystems/ChemistrySystem.cs b/Content.Shared/GameObjects/EntitySystems/ChemistrySystem.cs index 513e09d1de..92e48b8608 100644 --- a/Content.Shared/GameObjects/EntitySystems/ChemistrySystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/ChemistrySystem.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Linq; using JetBrains.Annotations; @@ -18,7 +19,7 @@ namespace Content.Shared.GameObjects.EntitySystems public class SolutionChangeEventArgs : EventArgs { - public IEntity Owner { get; set; } + public IEntity Owner { get; set; } = default!; } [UsedImplicitly] diff --git a/Content.Shared/GameObjects/EntitySystems/DamageSystem.cs b/Content.Shared/GameObjects/EntitySystems/DamageSystem.cs index 48fd41e696..9c65d0d3d3 100644 --- a/Content.Shared/GameObjects/EntitySystems/DamageSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/DamageSystem.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using System.Collections.Immutable; using Content.Shared.Damage; using JetBrains.Annotations; diff --git a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerExtensions.cs b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerExtensions.cs index 96c0e68d2d..cb0574c188 100644 --- a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerExtensions.cs +++ b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerExtensions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.EntitySystems.EffectBlocker { diff --git a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerSystem.cs b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerSystem.cs index d76449bb6f..2ad77e5785 100644 --- a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/EffectBlockerSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.EntitySystems.ActionBlocker; +#nullable enable +using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/IEffectBlocker.cs b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/IEffectBlocker.cs index 5cce28829d..55110c2341 100644 --- a/Content.Shared/GameObjects/EntitySystems/EffectBlocker/IEffectBlocker.cs +++ b/Content.Shared/GameObjects/EntitySystems/EffectBlocker/IEffectBlocker.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.EntitySystems.ActionBlocker; +#nullable enable +using Content.Shared.GameObjects.EntitySystems.ActionBlocker; namespace Content.Shared.GameObjects.EntitySystems.EffectBlocker { diff --git a/Content.Shared/GameObjects/EntitySystems/MechanismSystem.cs b/Content.Shared/GameObjects/EntitySystems/MechanismSystem.cs index 8f7356cc7c..0959196eed 100644 --- a/Content.Shared/GameObjects/EntitySystems/MechanismSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/MechanismSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Body.Mechanism; +#nullable enable +using Content.Shared.GameObjects.Components.Body.Mechanism; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystems/SharedActionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedActionSystem.cs index 12ce595d4f..5b66043695 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedActionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedActionSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Mobs; +#nullable enable +using Content.Shared.GameObjects.Components.Mobs; using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.EntitySystems diff --git a/Content.Shared/GameObjects/EntitySystems/SharedChemicalReactionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedChemicalReactionSystem.cs index 7e6e836141..89e0e38870 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedChemicalReactionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedChemicalReactionSystem.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.Chemistry; using Robust.Shared.IoC; using Robust.Shared.Log; @@ -9,7 +10,7 @@ namespace Content.Shared.GameObjects.EntitySystems { public abstract class SharedChemicalReactionSystem : EntitySystem { - private IEnumerable _reactions; + private IEnumerable _reactions = default!; private const int MaxReactionIterations = 20; @@ -139,7 +140,7 @@ namespace Content.Shared.GameObjects.EntitySystems return; var totalVolume = solution.TotalVolume + products.TotalVolume; - var excessVolume = totalVolume - maxVolume; + var excessVolume = totalVolume - maxVolume; if (excessVolume > 0) { diff --git a/Content.Shared/GameObjects/EntitySystems/SharedCombatModeSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedCombatModeSystem.cs index 0c7b3ab25c..737db48b4d 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedCombatModeSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedCombatModeSystem.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.GameObjects.EntitySystemMessages; using Robust.Shared.GameObjects; @@ -18,7 +19,7 @@ namespace Content.Shared.GameObjects.EntitySystems { var entity = eventArgs.SenderSession?.AttachedEntity; - if (entity == null || !entity.TryGetComponent(out SharedCombatModeComponent combatModeComponent)) + if (entity == null || !entity.TryGetComponent(out SharedCombatModeComponent? combatModeComponent)) { return; } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs index cbb904261c..cd45b87d5a 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedConstructionSystem.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.Map; using Robust.Shared.Maths; diff --git a/Content.Shared/GameObjects/EntitySystems/SharedDisposalUnitSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedDisposalUnitSystem.cs index 25413a4cff..fd77f0ca7c 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedDisposalUnitSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedDisposalUnitSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Disposal; +#nullable enable +using Content.Shared.GameObjects.Components.Disposal; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystems/SharedGhostRoleSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedGhostRoleSystem.cs index 2cc466794c..8416884705 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedGhostRoleSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedGhostRoleSystem.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; @@ -12,8 +13,8 @@ namespace Content.Shared.GameObjects.EntitySystems [Serializable, NetSerializable] public class GhostRole { - public string Name { get; set; } - public string Description { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; public EntityUid Id; } } diff --git a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs index 6dbb0cabc3..4bb523b0a1 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedMoverSystem.cs @@ -152,7 +152,7 @@ namespace Content.Shared.GameObjects.EntitySystems var owner = session?.AttachedEntity; - if (owner != null) + if (owner != null && session != null) { foreach (var comp in owner.GetAllComponents()) { diff --git a/Content.Shared/GameObjects/EntitySystems/SharedStandingStateSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedStandingStateSystem.cs index 646c8a36e4..dfd24a4321 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedStandingStateSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedStandingStateSystem.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.GameObjects.EntitySystems.EffectBlocker; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs b/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs index e10d23d0b1..367835df15 100644 --- a/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Movement; +#nullable enable +using Content.Shared.GameObjects.Components.Movement; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Verbs/GlobalVerb.cs b/Content.Shared/GameObjects/Verbs/GlobalVerb.cs index f405df236f..40bcecc424 100644 --- a/Content.Shared/GameObjects/Verbs/GlobalVerb.cs +++ b/Content.Shared/GameObjects/Verbs/GlobalVerb.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Verbs/IShowContextMenu.cs b/Content.Shared/GameObjects/Verbs/IShowContextMenu.cs index b34bcdc19e..fb2cd48d85 100644 --- a/Content.Shared/GameObjects/Verbs/IShowContextMenu.cs +++ b/Content.Shared/GameObjects/Verbs/IShowContextMenu.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.GameObjects.Verbs { diff --git a/Content.Shared/GameObjects/Verbs/Verb.cs b/Content.Shared/GameObjects/Verbs/Verb.cs index 610e3adbf6..2b4560cc2d 100644 --- a/Content.Shared/GameObjects/Verbs/Verb.cs +++ b/Content.Shared/GameObjects/Verbs/Verb.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.GameObjects; diff --git a/Content.Shared/GameObjects/Verbs/VerbBase.cs b/Content.Shared/GameObjects/Verbs/VerbBase.cs index a1b6c21cd3..f409e5db98 100644 --- a/Content.Shared/GameObjects/Verbs/VerbBase.cs +++ b/Content.Shared/GameObjects/Verbs/VerbBase.cs @@ -1,4 +1,6 @@ -namespace Content.Shared.GameObjects.Verbs +#nullable enable + +namespace Content.Shared.GameObjects.Verbs { public abstract class VerbBase { diff --git a/Content.Shared/GameObjects/Verbs/VerbCategories.cs b/Content.Shared/GameObjects/Verbs/VerbCategories.cs index 824b22e295..80a7c131c1 100644 --- a/Content.Shared/GameObjects/Verbs/VerbCategories.cs +++ b/Content.Shared/GameObjects/Verbs/VerbCategories.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.GameObjects.Verbs { /// diff --git a/Content.Shared/GameObjects/Verbs/VerbCategoryData.cs b/Content.Shared/GameObjects/Verbs/VerbCategoryData.cs index 4bf8fc22e6..7b72edb9cf 100644 --- a/Content.Shared/GameObjects/Verbs/VerbCategoryData.cs +++ b/Content.Shared/GameObjects/Verbs/VerbCategoryData.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Utility; namespace Content.Shared.GameObjects.Verbs @@ -7,18 +8,25 @@ namespace Content.Shared.GameObjects.Verbs /// public readonly struct VerbCategoryData { - public VerbCategoryData(string name, SpriteSpecifier icon) + public VerbCategoryData(string name, SpriteSpecifier? icon) { Name = name; Icon = icon; } public string Name { get; } - public SpriteSpecifier Icon { get; } + public SpriteSpecifier? Icon { get; } - public static implicit operator VerbCategoryData((string name, string icon) tuple) + public static implicit operator VerbCategoryData((string name, string? icon) tuple) { - return new(tuple.name, tuple.icon == null ? null : new SpriteSpecifier.Texture(new ResourcePath(tuple.icon))); + var (name, icon) = tuple; + + if (icon == null) + { + return new VerbCategoryData(name, null); + } + + return new VerbCategoryData(name, new SpriteSpecifier.Texture(new ResourcePath(icon))); } } } diff --git a/Content.Shared/GameObjects/Verbs/VerbData.cs b/Content.Shared/GameObjects/Verbs/VerbData.cs index 16487afbbe..8f40a45fdf 100644 --- a/Content.Shared/GameObjects/Verbs/VerbData.cs +++ b/Content.Shared/GameObjects/Verbs/VerbData.cs @@ -1,3 +1,4 @@ +#nullable enable using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.Utility; @@ -16,12 +17,12 @@ namespace Content.Shared.GameObjects.Verbs /// /// The text that the user sees on the verb button. /// - public string Text { get; set; } + public string Text { get; set; } = string.Empty; /// /// Sprite of the icon that the user sees on the verb button. /// - public SpriteSpecifier Icon { get; set; } + public SpriteSpecifier Icon { get; set; } = SpriteSpecifier.Invalid; /// /// Name of the category this button is under. @@ -31,7 +32,7 @@ namespace Content.Shared.GameObjects.Verbs /// /// Sprite of the icon that the user sees on the verb button. /// - public SpriteSpecifier CategoryIcon { get; set; } + public SpriteSpecifier? CategoryIcon { get; set; } = SpriteSpecifier.Invalid; /// /// Whether this verb is visible, disabled (greyed out) or hidden. diff --git a/Content.Shared/GameObjects/Verbs/VerbUtility.cs b/Content.Shared/GameObjects/Verbs/VerbUtility.cs index 2e43c2280a..4b0670d7ba 100644 --- a/Content.Shared/GameObjects/Verbs/VerbUtility.cs +++ b/Content.Shared/GameObjects/Verbs/VerbUtility.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using System.Reflection; using Robust.Shared.Containers; diff --git a/Content.Shared/GameObjects/Verbs/VerbVisibility.cs b/Content.Shared/GameObjects/Verbs/VerbVisibility.cs index dde0621f78..51e7c3480f 100644 --- a/Content.Shared/GameObjects/Verbs/VerbVisibility.cs +++ b/Content.Shared/GameObjects/Verbs/VerbVisibility.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.GameObjects.Verbs { /// diff --git a/Content.Shared/GameTicking/IResettingEntitySystem.cs b/Content.Shared/GameTicking/IResettingEntitySystem.cs index d71d4e0416..f5daa7e1c1 100644 --- a/Content.Shared/GameTicking/IResettingEntitySystem.cs +++ b/Content.Shared/GameTicking/IResettingEntitySystem.cs @@ -1,4 +1,6 @@ -namespace Content.Shared.GameTicking +#nullable enable + +namespace Content.Shared.GameTicking { public interface IResettingEntitySystem { diff --git a/Content.Shared/GameTicking/SharedGameTicker.cs b/Content.Shared/GameTicking/SharedGameTicker.cs index fb49c7cd12..b3e2b95dc8 100644 --- a/Content.Shared/GameTicking/SharedGameTicker.cs +++ b/Content.Shared/GameTicking/SharedGameTicker.cs @@ -1,4 +1,6 @@ -using System; +#nullable enable + +using System; using System.Collections.Generic; using System.IO; using Lidgren.Network; @@ -133,7 +135,7 @@ namespace Content.Shared.GameTicking #endregion - public string TextBlob { get; set; } + public string TextBlob { get; set; } = string.Empty; public override void ReadFromBuffer(NetIncomingMessage buffer) { @@ -192,7 +194,7 @@ namespace Content.Shared.GameTicking /// /// The Status of the Player in the lobby (ready, observer, ...) /// - public Dictionary PlayerStatus { get; set; } + public Dictionary PlayerStatus { get; set; } = new(); public override void ReadFromBuffer(NetIncomingMessage buffer) { @@ -287,14 +289,14 @@ namespace Content.Shared.GameTicking #endregion - public string GamemodeTitle; - public string RoundEndText; + public string GamemodeTitle = string.Empty; + public string RoundEndText = string.Empty; public TimeSpan RoundDuration; public int PlayerCount; - public List AllPlayersEndInfo; + public List AllPlayersEndInfo = new(); public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Input/ContentKeyFunctions.cs b/Content.Shared/Input/ContentKeyFunctions.cs index 73f260da6a..1d583d05da 100644 --- a/Content.Shared/Input/ContentKeyFunctions.cs +++ b/Content.Shared/Input/ContentKeyFunctions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Input; +#nullable enable +using Robust.Shared.Input; namespace Content.Shared.Input { diff --git a/Content.Shared/Interfaces/Chemistry/IMetabolizable.cs b/Content.Shared/Interfaces/Chemistry/IMetabolizable.cs index 2d0891c936..382d17a330 100644 --- a/Content.Shared/Interfaces/Chemistry/IMetabolizable.cs +++ b/Content.Shared/Interfaces/Chemistry/IMetabolizable.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry; +#nullable enable +using Content.Shared.Chemistry; using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/Interfaces/Chemistry/IPlantMetabolizable.cs b/Content.Shared/Interfaces/Chemistry/IPlantMetabolizable.cs index 5edf1bdc74..42e7a932ed 100644 --- a/Content.Shared/Interfaces/Chemistry/IPlantMetabolizable.cs +++ b/Content.Shared/Interfaces/Chemistry/IPlantMetabolizable.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; using Robust.Shared.Serialization; namespace Content.Shared.Interfaces.Chemistry diff --git a/Content.Shared/Interfaces/Chemistry/IReactionEffect.cs b/Content.Shared/Interfaces/Chemistry/IReactionEffect.cs index c924f43cea..a3f98a2bb9 100644 --- a/Content.Shared/Interfaces/Chemistry/IReactionEffect.cs +++ b/Content.Shared/Interfaces/Chemistry/IReactionEffect.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/Interfaces/Chemistry/ITileReaction.cs b/Content.Shared/Interfaces/Chemistry/ITileReaction.cs index 38a132203f..65760a06ef 100644 --- a/Content.Shared/Interfaces/Chemistry/ITileReaction.cs +++ b/Content.Shared/Interfaces/Chemistry/ITileReaction.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry; +#nullable enable +using Content.Shared.Chemistry; using Robust.Shared.Map; using Robust.Shared.Serialization; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs index d9e6646977..b9db986601 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IAfterInteract.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Threading.Tasks; using JetBrains.Annotations; using Robust.Shared.Analyzers; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs index 87bb099286..be9250aeff 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDragDropOn.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Analyzers; namespace Content.Shared.Interfaces.GameObjects.Components diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDraggable.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDraggable.cs index ffbe070a94..58145bd934 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDraggable.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDraggable.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDropped.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDropped.cs index 29dbad1753..1fd2e0d5b2 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDropped.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IDropped.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquipped.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquipped.cs index b9056f7894..7a6bac3d2f 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquipped.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquipped.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Inventory; using JetBrains.Annotations; using Robust.Shared.Analyzers; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquippedHand.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquippedHand.cs index 52021dddf2..0f668f7542 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquippedHand.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IEquippedHand.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Items; +#nullable enable +using Content.Shared.GameObjects.Components.Items; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs index 42cc352b23..3e36aa503b 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandDeselected.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs index fcd079919c..fb966b4936 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHandSelected.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHotItem.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHotItem.cs index 874eefc518..7bbbcb2a80 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHotItem.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IHotItem.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Analyzers; +#nullable enable +using Robust.Shared.Analyzers; namespace Content.Shared.Interfaces.GameObjects.Components { diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/ILand.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/ILand.cs index c2d5f22f3b..6ae20fbc2c 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/ILand.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/ILand.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs index 5804c58752..ee44989bbe 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components; +#nullable enable +using Content.Shared.GameObjects.Components; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IReagentReaction.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IReagentReaction.cs index 2e26853e0c..c2cefdcf72 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IReagentReaction.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IReagentReaction.cs @@ -1,4 +1,5 @@ -using Content.Shared.Chemistry; +#nullable enable +using Content.Shared.Chemistry; using Robust.Shared.Analyzers; namespace Content.Shared.Interfaces.GameObjects.Components diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs index d05c149490..d19b854a30 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/ITargetedInteractEventArgs.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Interfaces.GameObjects.Components { diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrowCollide.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrowCollide.cs index cb29056740..d2392384e6 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrowCollide.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrowCollide.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrown.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrown.cs index a788d867a6..d0f76d572d 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrown.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IThrown.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs index e45a1c8379..41fca20ea3 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequipped.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Inventory; +#nullable enable +using Content.Shared.GameObjects.Components.Inventory; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequippedHand.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequippedHand.cs index e846b5af17..8a3ba843f1 100644 --- a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequippedHand.cs +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IUnequippedHand.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Items; +#nullable enable +using Content.Shared.GameObjects.Components.Items; using JetBrains.Annotations; using Robust.Shared.Analyzers; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Interfaces/IModuleManager.cs b/Content.Shared/Interfaces/IModuleManager.cs index 420c15dde0..a0724e9d07 100644 --- a/Content.Shared/Interfaces/IModuleManager.cs +++ b/Content.Shared/Interfaces/IModuleManager.cs @@ -1,4 +1,5 @@ -namespace Content.Shared.Interfaces +#nullable enable +namespace Content.Shared.Interfaces { /// /// Provides a simple way to check whether calling code is being run by diff --git a/Content.Shared/Kitchen/RecipeManager.cs b/Content.Shared/Kitchen/RecipeManager.cs index 08c30cb646..babd320669 100644 --- a/Content.Shared/Kitchen/RecipeManager.cs +++ b/Content.Shared/Kitchen/RecipeManager.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Content.Shared.Prototypes.Kitchen; using Robust.Shared.IoC; using Robust.Shared.Prototypes; @@ -9,7 +10,7 @@ namespace Content.Shared.Kitchen { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - public List Recipes { get; private set; } + public List Recipes { get; private set; } = new(); public void Initialize() { @@ -41,7 +42,7 @@ namespace Content.Shared.Kitchen private class RecipeComparer : Comparer { - public override int Compare(FoodRecipePrototype x, FoodRecipePrototype y) + public override int Compare(FoodRecipePrototype? x, FoodRecipePrototype? y) { if (x == null || y == null) { diff --git a/Content.Shared/Kitchen/SharedMicrowaveComponent.cs b/Content.Shared/Kitchen/SharedMicrowaveComponent.cs index d83bebf7d8..0388bad9d4 100644 --- a/Content.Shared/Kitchen/SharedMicrowaveComponent.cs +++ b/Content.Shared/Kitchen/SharedMicrowaveComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Chemistry; using Content.Shared.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Shared/Kitchen/SharedReagentGrinderComponent.cs b/Content.Shared/Kitchen/SharedReagentGrinderComponent.cs index c1b0c51f63..0cc595f767 100644 --- a/Content.Shared/Kitchen/SharedReagentGrinderComponent.cs +++ b/Content.Shared/Kitchen/SharedReagentGrinderComponent.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.Chemistry; using Content.Shared.GameObjects; using Robust.Shared.GameObjects; @@ -110,8 +111,8 @@ namespace Content.Shared.Kitchen public bool CanJuice; public bool CanGrind; public EntityUid[] ChamberContents; - public Solution.ReagentQuantity[] ReagentQuantities; - public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, EntityUid[] chamberContents, Solution.ReagentQuantity[] heldBeakerContents) + public Solution.ReagentQuantity[]? ReagentQuantities; + public ReagentGrinderInterfaceState(bool isBusy, bool hasBeaker, bool powered, bool canJuice, bool canGrind, EntityUid[] chamberContents, Solution.ReagentQuantity[]? heldBeakerContents) { IsBusy = isBusy; HasBeakerIn = hasBeaker; diff --git a/Content.Shared/Maps/ContentTileDefinition.cs b/Content.Shared/Maps/ContentTileDefinition.cs index 959fe20082..54938bc6c4 100644 --- a/Content.Shared/Maps/ContentTileDefinition.cs +++ b/Content.Shared/Maps/ContentTileDefinition.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using Robust.Shared.Map; @@ -14,17 +15,17 @@ namespace Content.Shared.Maps { string IPrototype.ID => Name; - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; public ushort TileId { get; private set; } - public string DisplayName { get; private set; } - public string SpriteName { get; private set; } + public string DisplayName { get; private set; } = string.Empty; + public string SpriteName { get; private set; } = string.Empty; public bool IsSubFloor { get; private set; } - public List BaseTurfs { get; private set; } + public List BaseTurfs { get; private set; } = new(); public bool CanCrowbar { get; private set; } - public string FootstepSounds { get; private set; } + public string FootstepSounds { get; private set; } = string.Empty; public float Friction { get; set; } public float ThermalConductivity { get; set; } - public string ItemDropPrototypeName { get; private set; } + public string ItemDropPrototypeName { get; private set; } = string.Empty; public bool IsSpace { get; private set; } public void AssignTileId(ushort id) @@ -43,7 +44,7 @@ namespace Content.Shared.Maps IsSubFloor = node.AsBool(); } - if (mapping.TryGetNode("base_turfs", out YamlSequenceNode baseTurfNode)) + if (mapping.TryGetNode("base_turfs", out YamlSequenceNode? baseTurfNode)) BaseTurfs = baseTurfNode.Select(i => i.ToString()).ToList(); else BaseTurfs = new List(); diff --git a/Content.Shared/Materials/Material.cs b/Content.Shared/Materials/Material.cs index f5ec67062f..b330fd614a 100644 --- a/Content.Shared/Materials/Material.cs +++ b/Content.Shared/Materials/Material.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Prototypes; @@ -78,7 +79,7 @@ namespace Content.Shared.Materials public SpriteSpecifier Icon => _icon; private SpriteSpecifier _icon = SpriteSpecifier.Invalid; - public string ID + public string? ID { get { @@ -114,9 +115,9 @@ namespace Content.Shared.Materials [Prototype("material")] public class MaterialPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; - public Material Material { get; private set; } + public Material Material { get; private set; } = new(); public void LoadFrom(YamlMappingNode mapping) { diff --git a/Content.Shared/Maths/PhysicalConstants.cs b/Content.Shared/Maths/PhysicalConstants.cs index 301861a0eb..7f6d9254c7 100644 --- a/Content.Shared/Maths/PhysicalConstants.cs +++ b/Content.Shared/Maths/PhysicalConstants.cs @@ -1,3 +1,4 @@ +#nullable enable namespace Content.Shared.Maths { /// diff --git a/Content.Shared/Network/NetMessages/MsgDeleteCharacter.cs b/Content.Shared/Network/NetMessages/MsgDeleteCharacter.cs index 9cfca1ed16..d798eb6291 100644 --- a/Content.Shared/Network/NetMessages/MsgDeleteCharacter.cs +++ b/Content.Shared/Network/NetMessages/MsgDeleteCharacter.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages diff --git a/Content.Shared/Network/NetMessages/MsgEuiCtl.cs b/Content.Shared/Network/NetMessages/MsgEuiCtl.cs index 07acdf1aeb..45748db7e4 100644 --- a/Content.Shared/Network/NetMessages/MsgEuiCtl.cs +++ b/Content.Shared/Network/NetMessages/MsgEuiCtl.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages @@ -18,7 +19,7 @@ namespace Content.Shared.Network.NetMessages #endregion public CtlType Type; - public string OpenType; + public string OpenType = string.Empty; public uint Id; public override void ReadFromBuffer(NetIncomingMessage buffer) diff --git a/Content.Shared/Network/NetMessages/MsgEuiMessage.cs b/Content.Shared/Network/NetMessages/MsgEuiMessage.cs index b4d829a002..043bec86ff 100644 --- a/Content.Shared/Network/NetMessages/MsgEuiMessage.cs +++ b/Content.Shared/Network/NetMessages/MsgEuiMessage.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.IO; using Content.Shared.Eui; using Lidgren.Network; @@ -20,7 +21,7 @@ namespace Content.Shared.Network.NetMessages #endregion public uint Id; - public EuiMessageBase Message; + public EuiMessageBase Message = default!; public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Network/NetMessages/MsgEuiState.cs b/Content.Shared/Network/NetMessages/MsgEuiState.cs index ae7ba19453..794d3d52a8 100644 --- a/Content.Shared/Network/NetMessages/MsgEuiState.cs +++ b/Content.Shared/Network/NetMessages/MsgEuiState.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.IO; using Content.Shared.Eui; using Lidgren.Network; @@ -20,7 +21,7 @@ namespace Content.Shared.Network.NetMessages #endregion public uint Id; - public EuiStateBase State; + public EuiStateBase State = default!; public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Network/NetMessages/MsgPreferencesAndSettings.cs b/Content.Shared/Network/NetMessages/MsgPreferencesAndSettings.cs index b453a8af21..9238b79af3 100644 --- a/Content.Shared/Network/NetMessages/MsgPreferencesAndSettings.cs +++ b/Content.Shared/Network/NetMessages/MsgPreferencesAndSettings.cs @@ -1,4 +1,5 @@ -using System.IO; +#nullable enable +using System.IO; using Content.Shared.Preferences; using Lidgren.Network; using Robust.Shared.IoC; @@ -21,8 +22,8 @@ namespace Content.Shared.Network.NetMessages #endregion - public PlayerPreferences Preferences; - public GameSettings Settings; + public PlayerPreferences Preferences = default!; + public GameSettings Settings = default!; public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Network/NetMessages/MsgRequestStationEvents.cs b/Content.Shared/Network/NetMessages/MsgRequestStationEvents.cs index 31d7fdd2c6..100db9ce85 100644 --- a/Content.Shared/Network/NetMessages/MsgRequestStationEvents.cs +++ b/Content.Shared/Network/NetMessages/MsgRequestStationEvents.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages diff --git a/Content.Shared/Network/NetMessages/MsgRequestWindowAttention.cs b/Content.Shared/Network/NetMessages/MsgRequestWindowAttention.cs index fe27599f4a..8ff4df1f74 100644 --- a/Content.Shared/Network/NetMessages/MsgRequestWindowAttention.cs +++ b/Content.Shared/Network/NetMessages/MsgRequestWindowAttention.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages diff --git a/Content.Shared/Network/NetMessages/MsgSelectCharacter.cs b/Content.Shared/Network/NetMessages/MsgSelectCharacter.cs index a9afe5440d..63763c43ff 100644 --- a/Content.Shared/Network/NetMessages/MsgSelectCharacter.cs +++ b/Content.Shared/Network/NetMessages/MsgSelectCharacter.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages diff --git a/Content.Shared/Network/NetMessages/MsgStationEvents.cs b/Content.Shared/Network/NetMessages/MsgStationEvents.cs index 3ee27d01f9..1011de1969 100644 --- a/Content.Shared/Network/NetMessages/MsgStationEvents.cs +++ b/Content.Shared/Network/NetMessages/MsgStationEvents.cs @@ -1,4 +1,6 @@ -using System.IO; +#nullable enable +using System; +using System.IO; using Lidgren.Network; using Robust.Shared.IoC; using Robust.Shared.Network; @@ -16,7 +18,7 @@ namespace Content.Shared.Network.NetMessages #endregion - public string[] Events; + public string[] Events = Array.Empty(); public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Network/NetMessages/MsgUpdateAdminStatus.cs b/Content.Shared/Network/NetMessages/MsgUpdateAdminStatus.cs index 647c267db9..45f860a70e 100644 --- a/Content.Shared/Network/NetMessages/MsgUpdateAdminStatus.cs +++ b/Content.Shared/Network/NetMessages/MsgUpdateAdminStatus.cs @@ -1,4 +1,6 @@ -using Content.Shared.Administration; +#nullable enable +using System; +using Content.Shared.Administration; using Lidgren.Network; using Robust.Shared.Network; @@ -15,8 +17,8 @@ namespace Content.Shared.Network.NetMessages #endregion - public AdminData Admin; - public string[] AvailableCommands; + public AdminData? Admin; + public string[] AvailableCommands = Array.Empty(); public override void ReadFromBuffer(NetIncomingMessage buffer) { @@ -55,16 +57,14 @@ namespace Content.Shared.Network.NetMessages buffer.Write(cmd); } - var isAdmin = Admin != null; - buffer.Write(isAdmin); + buffer.Write(Admin != null); - if (isAdmin) - { - buffer.Write(Admin.Active); - buffer.WritePadBits(); - buffer.Write((uint) Admin.Flags); - buffer.Write(Admin.Title); - } + if (Admin == null) return; + + buffer.Write(Admin.Active); + buffer.WritePadBits(); + buffer.Write((uint) Admin.Flags); + buffer.Write(Admin.Title); } public override NetDeliveryMethod DeliveryMethod => NetDeliveryMethod.ReliableOrdered; diff --git a/Content.Shared/Network/NetMessages/MsgUpdateCharacter.cs b/Content.Shared/Network/NetMessages/MsgUpdateCharacter.cs index 88dd0ae22f..f4e2279cc1 100644 --- a/Content.Shared/Network/NetMessages/MsgUpdateCharacter.cs +++ b/Content.Shared/Network/NetMessages/MsgUpdateCharacter.cs @@ -1,4 +1,5 @@ -using System.IO; +#nullable enable +using System.IO; using Content.Shared.Preferences; using Lidgren.Network; using Robust.Shared.IoC; @@ -22,7 +23,7 @@ namespace Content.Shared.Network.NetMessages #endregion public int Slot; - public ICharacterProfile Profile; + public ICharacterProfile Profile = default!; public override void ReadFromBuffer(NetIncomingMessage buffer) { diff --git a/Content.Shared/Network/NetMessages/MsgVoteCanCall.cs b/Content.Shared/Network/NetMessages/MsgVoteCanCall.cs index 6620be6f3a..a6303c176a 100644 --- a/Content.Shared/Network/NetMessages/MsgVoteCanCall.cs +++ b/Content.Shared/Network/NetMessages/MsgVoteCanCall.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Network.NetMessages diff --git a/Content.Shared/Network/NetMessages/MsgVoteData.cs b/Content.Shared/Network/NetMessages/MsgVoteData.cs index 79866e0b90..526ccf0624 100644 --- a/Content.Shared/Network/NetMessages/MsgVoteData.cs +++ b/Content.Shared/Network/NetMessages/MsgVoteData.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Lidgren.Network; using Robust.Shared.Network; @@ -17,11 +18,11 @@ namespace Content.Shared.Network.NetMessages public int VoteId; public bool VoteActive; - public string VoteTitle; - public string VoteInitiator; + public string VoteTitle = string.Empty; + public string VoteInitiator = string.Empty; public TimeSpan StartTime; // Server RealTime. public TimeSpan EndTime; // Server RealTime. - public (ushort votes, string name)[] Options; + public (ushort votes, string name)[] Options = default!; public bool IsYourVoteDirty; public byte? YourVote; diff --git a/Content.Shared/Objectives/ConditionInfo.cs b/Content.Shared/Objectives/ConditionInfo.cs index de0e7f934b..152c3fd27b 100644 --- a/Content.Shared/Objectives/ConditionInfo.cs +++ b/Content.Shared/Objectives/ConditionInfo.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; using Robust.Shared.Utility; diff --git a/Content.Shared/Physics/ContainmentFieldCollisionController.cs b/Content.Shared/Physics/ContainmentFieldCollisionController.cs index c2e56646d2..a9de254beb 100644 --- a/Content.Shared/Physics/ContainmentFieldCollisionController.cs +++ b/Content.Shared/Physics/ContainmentFieldCollisionController.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Physics; +#nullable enable +using Robust.Shared.Physics; namespace Content.Shared.Physics { diff --git a/Content.Shared/Physics/ContainmentFieldRepellController.cs b/Content.Shared/Physics/ContainmentFieldRepellController.cs index 843a5a289f..c878bf6f53 100644 --- a/Content.Shared/Physics/ContainmentFieldRepellController.cs +++ b/Content.Shared/Physics/ContainmentFieldRepellController.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Maths; +#nullable enable +using Robust.Shared.Maths; namespace Content.Shared.Physics { diff --git a/Content.Shared/Physics/FrictionController.cs b/Content.Shared/Physics/FrictionController.cs index 9438b51e4d..f4fd3c2964 100644 --- a/Content.Shared/Physics/FrictionController.cs +++ b/Content.Shared/Physics/FrictionController.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.IoC; using Robust.Shared.Physics; diff --git a/Content.Shared/Physics/Pull/PullAttemptMessage.cs b/Content.Shared/Physics/Pull/PullAttemptMessage.cs index 778b21173f..bc8870044f 100644 --- a/Content.Shared/Physics/Pull/PullAttemptMessage.cs +++ b/Content.Shared/Physics/Pull/PullAttemptMessage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Physics.Pull { diff --git a/Content.Shared/Physics/Pull/PullMessage.cs b/Content.Shared/Physics/Pull/PullMessage.cs index 9df78ea424..a65957bc84 100644 --- a/Content.Shared/Physics/Pull/PullMessage.cs +++ b/Content.Shared/Physics/Pull/PullMessage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Physics.Pull { diff --git a/Content.Shared/Physics/Pull/PullStartedMessage.cs b/Content.Shared/Physics/Pull/PullStartedMessage.cs index 36d20fb0be..2dd84a84fd 100644 --- a/Content.Shared/Physics/Pull/PullStartedMessage.cs +++ b/Content.Shared/Physics/Pull/PullStartedMessage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Physics.Pull { diff --git a/Content.Shared/Physics/Pull/PullStoppedMessage.cs b/Content.Shared/Physics/Pull/PullStoppedMessage.cs index 36c4524cdc..215dae4aee 100644 --- a/Content.Shared/Physics/Pull/PullStoppedMessage.cs +++ b/Content.Shared/Physics/Pull/PullStoppedMessage.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Physics.Pull { diff --git a/Content.Shared/Physics/SlipController.cs b/Content.Shared/Physics/SlipController.cs index 55710b4a3e..bc64449a09 100644 --- a/Content.Shared/Physics/SlipController.cs +++ b/Content.Shared/Physics/SlipController.cs @@ -1,4 +1,5 @@ -using Robust.Shared.IoC; +#nullable enable +using Robust.Shared.IoC; using Robust.Shared.Maths; using Robust.Shared.Physics; diff --git a/Content.Shared/Physics/ThrowKnockbackController.cs b/Content.Shared/Physics/ThrowKnockbackController.cs index 296d6782a7..6a7dc2ecb1 100644 --- a/Content.Shared/Physics/ThrowKnockbackController.cs +++ b/Content.Shared/Physics/ThrowKnockbackController.cs @@ -1,4 +1,5 @@ -using Content.Shared.GameObjects.Components.Movement; +#nullable enable +using Content.Shared.GameObjects.Components.Movement; using Content.Shared.GameObjects.EntitySystems.ActionBlocker; using Robust.Shared.IoC; using Robust.Shared.Maths; diff --git a/Content.Shared/Physics/VaporController.cs b/Content.Shared/Physics/VaporController.cs index 55a2f9d827..b2cfa5c774 100644 --- a/Content.Shared/Physics/VaporController.cs +++ b/Content.Shared/Physics/VaporController.cs @@ -1,4 +1,5 @@ -using Robust.Shared.Maths; +#nullable enable +using Robust.Shared.Maths; using Robust.Shared.Physics; namespace Content.Shared.Physics diff --git a/Content.Shared/Preferences/Appearance/HairStyles.cs b/Content.Shared/Preferences/Appearance/HairStyles.cs index 2ff05166fc..15f00f1f6c 100644 --- a/Content.Shared/Preferences/Appearance/HairStyles.cs +++ b/Content.Shared/Preferences/Appearance/HairStyles.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/Content.Shared/Preferences/Appearance/HumanoidCharacterAppearance.cs b/Content.Shared/Preferences/Appearance/HumanoidCharacterAppearance.cs index ce61bfc392..9f44f915cb 100644 --- a/Content.Shared/Preferences/Appearance/HumanoidCharacterAppearance.cs +++ b/Content.Shared/Preferences/Appearance/HumanoidCharacterAppearance.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Content.Shared.GameObjects.Components.Body.Part; using Robust.Shared.Serialization; diff --git a/Content.Shared/Preferences/BackpackPreference.cs b/Content.Shared/Preferences/BackpackPreference.cs index da2c4b8fe8..cb6e6e072b 100644 --- a/Content.Shared/Preferences/BackpackPreference.cs +++ b/Content.Shared/Preferences/BackpackPreference.cs @@ -1,3 +1,4 @@ +#nullable enable namespace Content.Shared.Preferences { /// diff --git a/Content.Shared/Preferences/ClothingPreference.cs b/Content.Shared/Preferences/ClothingPreference.cs index 24a4b206c7..f660b2ecce 100644 --- a/Content.Shared/Preferences/ClothingPreference.cs +++ b/Content.Shared/Preferences/ClothingPreference.cs @@ -1,3 +1,4 @@ +#nullable enable namespace Content.Shared.Preferences { /// diff --git a/Content.Shared/Preferences/GameSettings.cs b/Content.Shared/Preferences/GameSettings.cs index f41811bc36..bf25d8a14a 100644 --- a/Content.Shared/Preferences/GameSettings.cs +++ b/Content.Shared/Preferences/GameSettings.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.Serialization; diff --git a/Content.Shared/Preferences/HumanoidCharacterAppearance.cs b/Content.Shared/Preferences/HumanoidCharacterAppearance.cs index a7617a6036..2f11b65b1e 100644 --- a/Content.Shared/Preferences/HumanoidCharacterAppearance.cs +++ b/Content.Shared/Preferences/HumanoidCharacterAppearance.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Linq; using Content.Shared.Preferences.Appearance; diff --git a/Content.Shared/Preferences/ICharacterAppearance.cs b/Content.Shared/Preferences/ICharacterAppearance.cs index 41526bca8a..4e75c49d29 100644 --- a/Content.Shared/Preferences/ICharacterAppearance.cs +++ b/Content.Shared/Preferences/ICharacterAppearance.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.Preferences { public interface ICharacterAppearance diff --git a/Content.Shared/Preferences/ICharacterProfile.cs b/Content.Shared/Preferences/ICharacterProfile.cs index ab0b7c49b6..eab98e941b 100644 --- a/Content.Shared/Preferences/ICharacterProfile.cs +++ b/Content.Shared/Preferences/ICharacterProfile.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.Preferences { public interface ICharacterProfile diff --git a/Content.Shared/Preferences/JobPriority.cs b/Content.Shared/Preferences/JobPriority.cs index bf0bbf6aad..8d70d51bb4 100644 --- a/Content.Shared/Preferences/JobPriority.cs +++ b/Content.Shared/Preferences/JobPriority.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.Preferences { public enum JobPriority diff --git a/Content.Shared/Preferences/PlayerPreferences.cs b/Content.Shared/Preferences/PlayerPreferences.cs index 4fedad6e8b..afd90e4211 100644 --- a/Content.Shared/Preferences/PlayerPreferences.cs +++ b/Content.Shared/Preferences/PlayerPreferences.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.Maths; @@ -45,12 +46,6 @@ namespace Content.Shared.Preferences public Color AdminOOCColor { get; set; } - public int FirstEmptySlot() - { - var firstEmpty = IndexOfCharacter(null); - return firstEmpty == -1 ? _characters.Count : firstEmpty; - } - public int IndexOfCharacter(ICharacterProfile profile) { return _characters.FirstOrNull(p => p.Value == profile)?.Key ?? -1; diff --git a/Content.Shared/Preferences/PreferenceUnavailableMode.cs b/Content.Shared/Preferences/PreferenceUnavailableMode.cs index 4c00ec4148..2b06f80f4f 100644 --- a/Content.Shared/Preferences/PreferenceUnavailableMode.cs +++ b/Content.Shared/Preferences/PreferenceUnavailableMode.cs @@ -1,3 +1,5 @@ +#nullable enable + namespace Content.Shared.Preferences { /// diff --git a/Content.Shared/Prototypes/Cargo/CargoOrderData.cs b/Content.Shared/Prototypes/Cargo/CargoOrderData.cs index 171ec99bd4..b25f75718d 100644 --- a/Content.Shared/Prototypes/Cargo/CargoOrderData.cs +++ b/Content.Shared/Prototypes/Cargo/CargoOrderData.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.Serialization; namespace Content.Shared.Prototypes.Cargo diff --git a/Content.Shared/Prototypes/Cargo/CargoProductPrototype.cs b/Content.Shared/Prototypes/Cargo/CargoProductPrototype.cs index d3c98cc623..7f71e96bc5 100644 --- a/Content.Shared/Prototypes/Cargo/CargoProductPrototype.cs +++ b/Content.Shared/Prototypes/Cargo/CargoProductPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.IoC; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -11,14 +12,14 @@ namespace Content.Shared.Prototypes.Cargo [NetSerializable, Serializable, Prototype("cargoProduct")] public class CargoProductPrototype : IPrototype { - private string _id; - private string _name; - private string _description; - private SpriteSpecifier _icon; - private string _product; + private string _id = string.Empty; + private string _name = string.Empty; + private string _description = string.Empty; + private SpriteSpecifier _icon = SpriteSpecifier.Invalid; + private string _product = string.Empty; private int _pointCost; - private string _category; - private string _group; + private string _category = string.Empty; + private string _group = string.Empty; [ViewVariables] public string ID => _id; @@ -33,10 +34,12 @@ namespace Content.Shared.Prototypes.Cargo { if (_name.Trim().Length != 0) return _name; - EntityPrototype prototype = null; - IoCManager.Resolve()?.TryIndex(_product, out prototype); - if (prototype?.Name != null) + + if (IoCManager.Resolve().TryIndex(_product, out EntityPrototype? prototype)) + { _name = prototype.Name; + } + return _name; } } @@ -51,10 +54,12 @@ namespace Content.Shared.Prototypes.Cargo { if (_description.Trim().Length != 0) return _description; - EntityPrototype prototype = null; - IoCManager.Resolve()?.TryIndex(_product, out prototype); - if (prototype?.Description != null) + + if (IoCManager.Resolve().TryIndex(_product, out EntityPrototype? prototype)) + { _description = prototype.Description; + } + return _description; } } @@ -102,7 +107,7 @@ namespace Content.Shared.Prototypes.Cargo serializer.DataField(ref _id, "id", string.Empty); serializer.DataField(ref _description, "description", string.Empty); serializer.DataField(ref _icon, "icon", SpriteSpecifier.Invalid); - serializer.DataField(ref _product, "product", null); + serializer.DataField(ref _product, "product", string.Empty); serializer.DataField(ref _pointCost, "cost", 0); serializer.DataField(ref _category, "category", string.Empty); serializer.DataField(ref _group, "group", string.Empty); diff --git a/Content.Shared/Prototypes/DatasetPrototype.cs b/Content.Shared/Prototypes/DatasetPrototype.cs index 0da4e4c236..9f7e260daa 100644 --- a/Content.Shared/Prototypes/DatasetPrototype.cs +++ b/Content.Shared/Prototypes/DatasetPrototype.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using YamlDotNet.RepresentationModel; @@ -8,17 +9,17 @@ namespace Content.Shared.Prototypes [Prototype("dataset")] public class DatasetPrototype : IPrototype { - private string _id; + private string _id = string.Empty; public string ID => _id; - private List _values; + private List _values = new(); public IReadOnlyList Values => _values; public void LoadFrom(YamlMappingNode mapping) { var ser = YamlObjectSerializer.NewReader(mapping); - ser.DataField(ref _id, "id", ""); + ser.DataField(ref _id, "id", string.Empty); ser.DataField(ref _values, "values", new List()); } } diff --git a/Content.Shared/Prototypes/Kitchen/MicrowaveMealRecipePrototype.cs b/Content.Shared/Prototypes/Kitchen/MicrowaveMealRecipePrototype.cs index 94748203d0..9ee2ee992f 100644 --- a/Content.Shared/Prototypes/Kitchen/MicrowaveMealRecipePrototype.cs +++ b/Content.Shared/Prototypes/Kitchen/MicrowaveMealRecipePrototype.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -12,13 +13,13 @@ namespace Content.Shared.Prototypes.Kitchen [Prototype("microwaveMealRecipe")] public class FoodRecipePrototype : IPrototype { - private string _id; - private string _name; - private string _result; + private string _id = string.Empty; + private string _name = string.Empty; + private string _result = string.Empty; private int _cookTime; - private Dictionary _ingsReagents; - private Dictionary _ingsSolids; + private Dictionary _ingsReagents = new(); + private Dictionary _ingsSolids = new(); public string Name => Loc.GetString(_name); public string ID => _id; diff --git a/Content.Shared/Prototypes/PDA/UplinkStoreListingPrototype.cs b/Content.Shared/Prototypes/PDA/UplinkStoreListingPrototype.cs index 52e54482ed..ed80b2b303 100644 --- a/Content.Shared/Prototypes/PDA/UplinkStoreListingPrototype.cs +++ b/Content.Shared/Prototypes/PDA/UplinkStoreListingPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.GameObjects.Components.PDA; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -8,12 +9,12 @@ namespace Content.Shared.Prototypes.PDA [Prototype("uplinkListing")] public class UplinkStoreListingPrototype : IPrototype { - private string _id; - private string _itemId; + private string _id = string.Empty; + private string _itemId = string.Empty; private int _price; private UplinkCategory _category; - private string _desc; - private string _name; + private string _desc = string.Empty; + private string _name = string.Empty; public string ID => _id; diff --git a/Content.Shared/Research/LatheRecipePrototype.cs b/Content.Shared/Research/LatheRecipePrototype.cs index f36b4fa025..31756aa614 100644 --- a/Content.Shared/Research/LatheRecipePrototype.cs +++ b/Content.Shared/Research/LatheRecipePrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.IoC; @@ -12,13 +13,13 @@ namespace Content.Shared.Research [NetSerializable, Serializable, Prototype("latheRecipe")] public class LatheRecipePrototype : IPrototype { - private string _name; - private string _id; - private SpriteSpecifier _icon; - private string _description; - private string _result; + private string _name = string.Empty; + private string _id = string.Empty; + private SpriteSpecifier _icon = SpriteSpecifier.Invalid; + private string _description = string.Empty; + private string _result = string.Empty; private int _completeTime; - private Dictionary _requiredMaterials; + private Dictionary _requiredMaterials = new(); [ViewVariables] public string ID => _id; @@ -34,7 +35,7 @@ namespace Content.Shared.Research if (_name.Trim().Length != 0) return _name; var protoMan = IoCManager.Resolve(); if (protoMan == null) return _description; - protoMan.TryIndex(_result, out EntityPrototype prototype); + protoMan.TryIndex(_result, out EntityPrototype? prototype); if (prototype?.Name != null) _name = prototype.Name; return _name; @@ -52,7 +53,7 @@ namespace Content.Shared.Research if (_description.Trim().Length != 0) return _description; var protoMan = IoCManager.Resolve(); if (protoMan == null) return _description; - protoMan.TryIndex(_result, out EntityPrototype prototype); + protoMan.TryIndex(_result, out EntityPrototype? prototype); if (prototype?.Description != null) _description = prototype.Description; return _description; @@ -98,7 +99,7 @@ namespace Content.Shared.Research serializer.DataField(ref _id, "id", string.Empty); serializer.DataField(ref _description, "description", string.Empty); serializer.DataField(ref _icon, "icon", SpriteSpecifier.Invalid); - serializer.DataField(ref _result, "result", null); + serializer.DataField(ref _result, "result", string.Empty); serializer.DataField(ref _completeTime, "completetime", 2500); serializer.DataField(ref _requiredMaterials, "materials", new Dictionary()); } diff --git a/Content.Shared/Research/TechnologyPrototype.cs b/Content.Shared/Research/TechnologyPrototype.cs index 4d3b74699a..b4051733ad 100644 --- a/Content.Shared/Research/TechnologyPrototype.cs +++ b/Content.Shared/Research/TechnologyPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -11,13 +12,13 @@ namespace Content.Shared.Research [NetSerializable, Serializable, Prototype("technology")] public class TechnologyPrototype : IPrototype { - private string _name; - private string _id; - private SpriteSpecifier _icon; - private string _description; + private string _name = string.Empty; + private string _id = string.Empty; + private SpriteSpecifier _icon = SpriteSpecifier.Invalid; + private string _description = string.Empty; private int _requiredPoints; - private List _requiredTechnologies; - private List _unlockedRecipes; + private List _requiredTechnologies = new(); + private List _unlockedRecipes = new(); /// /// The ID of this technology prototype. diff --git a/Content.Shared/Roles/AntagPrototype.cs b/Content.Shared/Roles/AntagPrototype.cs index 26f271f144..cfa1e49c20 100644 --- a/Content.Shared/Roles/AntagPrototype.cs +++ b/Content.Shared/Roles/AntagPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.Localization; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -11,17 +12,17 @@ namespace Content.Shared.Roles [Prototype("antag")] public class AntagPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// The name of this antag as displayed to players. /// - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; /// /// The antag's objective, displayed at round-start to the player. /// - public string Objective { get; private set; } + public string Objective { get; private set; } = string.Empty; /// /// Whether or not the antag role is one of the bad guys. diff --git a/Content.Shared/Roles/JobPrototype.cs b/Content.Shared/Roles/JobPrototype.cs index 59331dedbd..b26ca1cfb6 100644 --- a/Content.Shared/Roles/JobPrototype.cs +++ b/Content.Shared/Roles/JobPrototype.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using Robust.Shared.Localization; @@ -13,12 +14,12 @@ namespace Content.Shared.Roles [Prototype("job")] public class JobPrototype : IPrototype { - public string ID { get; private set; } + public string ID { get; private set; } = string.Empty; /// /// The name of this job as displayed to players. /// - public string Name { get; private set; } + public string Name { get; private set; } = string.Empty; /// /// Whether this job is a head. @@ -36,14 +37,14 @@ namespace Content.Shared.Roles /// public int TotalPositions { get; private set; } - public string StartingGear { get; private set; } + public string StartingGear { get; private set; } = string.Empty; - public string Icon { get; private set; } + public string Icon { get; private set; } = string.Empty; - public JobSpecial Special { get; private set; } + public JobSpecial? Special { get; private set; } = null; - public IReadOnlyCollection Departments { get; private set; } - public IReadOnlyCollection Access { get; private set; } + public IReadOnlyCollection Departments { get; private set; } = Array.Empty(); + public IReadOnlyCollection Access { get; private set; } = Array.Empty(); public void LoadFrom(YamlMappingNode mapping) { @@ -57,7 +58,7 @@ namespace Content.Shared.Roles srz.DataField(this, p => p.SpawnPositions, "spawnPositions", TotalPositions); srz.DataField(this, p => p.IsHead, "head", false); srz.DataField(this, p => p.Access, "access", Array.Empty()); - srz.DataField(this, p => p.Icon, "icon", null); + srz.DataField(this, p => p.Icon, "icon", string.Empty); srz.DataField(this, p => p.Special, "special", null); } } diff --git a/Content.Shared/Roles/JobSpecial.cs b/Content.Shared/Roles/JobSpecial.cs index 09dc5f3870..5706a932f0 100644 --- a/Content.Shared/Roles/JobSpecial.cs +++ b/Content.Shared/Roles/JobSpecial.cs @@ -1,3 +1,4 @@ +#nullable enable using Robust.Shared.GameObjects; using Robust.Shared.Serialization; diff --git a/Content.Shared/Sandbox/SharedSandboxManager.cs b/Content.Shared/Sandbox/SharedSandboxManager.cs index 677b5afe73..89eb1743ea 100644 --- a/Content.Shared/Sandbox/SharedSandboxManager.cs +++ b/Content.Shared/Sandbox/SharedSandboxManager.cs @@ -1,4 +1,5 @@ -using Lidgren.Network; +#nullable enable +using Lidgren.Network; using Robust.Shared.Network; namespace Content.Shared.Sandbox diff --git a/Content.Shared/SharedModuleTestingCallbacks.cs b/Content.Shared/SharedModuleTestingCallbacks.cs index d47b65544c..70027bfc80 100644 --- a/Content.Shared/SharedModuleTestingCallbacks.cs +++ b/Content.Shared/SharedModuleTestingCallbacks.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using Robust.Shared.ContentPack; @@ -5,6 +6,6 @@ namespace Content.Shared { public abstract class SharedModuleTestingCallbacks : ModuleTestingCallbacks { - public Action SharedBeforeIoC { get; set; } + public Action SharedBeforeIoC { get; set; } = default!; } } diff --git a/Content.Shared/SharedNotifyManager.cs b/Content.Shared/SharedNotifyManager.cs index 0d0c3d76a1..e70a01fccf 100644 --- a/Content.Shared/SharedNotifyManager.cs +++ b/Content.Shared/SharedNotifyManager.cs @@ -1,3 +1,4 @@ +#nullable enable using Content.Shared.Interfaces; using Lidgren.Network; using Robust.Shared.GameObjects; @@ -24,7 +25,7 @@ namespace Content.Shared #endregion - public string Message { get; set; } + public string Message { get; set; } = string.Empty; public override void ReadFromBuffer(NetIncomingMessage buffer) { @@ -47,7 +48,7 @@ namespace Content.Shared #endregion - public string Message { get; set; } + public string Message { get; set; } = string.Empty; public EntityCoordinates Coordinates; public override void ReadFromBuffer(NetIncomingMessage buffer) @@ -73,7 +74,7 @@ namespace Content.Shared #endregion - public string Message { get; set; } + public string Message { get; set; } = string.Empty; public EntityUid Entity; public override void ReadFromBuffer(NetIncomingMessage buffer) diff --git a/Content.Shared/Utility/ContentHelpers.cs b/Content.Shared/Utility/ContentHelpers.cs index 772d549288..31b7751c3a 100644 --- a/Content.Shared/Utility/ContentHelpers.cs +++ b/Content.Shared/Utility/ContentHelpers.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; namespace Content.Shared.Utility { diff --git a/Content.Shared/Utility/Cooldowns.cs b/Content.Shared/Utility/Cooldowns.cs index 74d9551d43..2faf89c861 100644 --- a/Content.Shared/Utility/Cooldowns.cs +++ b/Content.Shared/Utility/Cooldowns.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.IoC; using Robust.Shared.Timing; @@ -13,14 +14,14 @@ namespace Content.Shared.Utility /// a cooldown interval starting at GameTiming.Curtime and ending at (offset) from CurTime. /// For example, passing TimeSpan.FromSeconds(5) will create an interval /// from now to 5 seconds from now. - public static (TimeSpan start, TimeSpan end) FromNow(TimeSpan offset, IGameTiming gameTiming = null) + public static (TimeSpan start, TimeSpan end) FromNow(TimeSpan offset, IGameTiming? gameTiming = null) { var now = (gameTiming ?? IoCManager.Resolve()).CurTime; return (now, now + offset); } /// - public static (TimeSpan start, TimeSpan end) SecondsFromNow(double seconds, IGameTiming gameTiming = null) + public static (TimeSpan start, TimeSpan end) SecondsFromNow(double seconds, IGameTiming? gameTiming = null) { return FromNow(TimeSpan.FromSeconds(seconds), gameTiming); } diff --git a/Content.Shared/Utility/SharedDirectionExtensions.cs b/Content.Shared/Utility/SharedDirectionExtensions.cs index 56f784d105..5b6c612fac 100644 --- a/Content.Shared/Utility/SharedDirectionExtensions.cs +++ b/Content.Shared/Utility/SharedDirectionExtensions.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +#nullable enable +using System.Collections.Generic; using Content.Shared.Maps; using Robust.Shared.IoC; using Robust.Shared.Map; diff --git a/Content.Shared/Utility/SharedEntityExtensions.cs b/Content.Shared/Utility/SharedEntityExtensions.cs index 6e1602bbcf..22488af5b9 100644 --- a/Content.Shared/Utility/SharedEntityExtensions.cs +++ b/Content.Shared/Utility/SharedEntityExtensions.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Maths; diff --git a/Content.Shared/Utility/TemperatureHelpers.cs b/Content.Shared/Utility/TemperatureHelpers.cs index 660af760fd..8ec26f78d3 100644 --- a/Content.Shared/Utility/TemperatureHelpers.cs +++ b/Content.Shared/Utility/TemperatureHelpers.cs @@ -1,4 +1,5 @@ -using Content.Shared.Maths; +#nullable enable +using Content.Shared.Maths; namespace Content.Shared.Utility { diff --git a/Content.Shared/Utility/TransformExtensions.cs b/Content.Shared/Utility/TransformExtensions.cs index d8ec0bce64..5990de103c 100644 --- a/Content.Shared/Utility/TransformExtensions.cs +++ b/Content.Shared/Utility/TransformExtensions.cs @@ -1,4 +1,5 @@ -using Robust.Shared.GameObjects; +#nullable enable +using Robust.Shared.GameObjects; namespace Content.Shared.Utility { diff --git a/Content.Shared/VendingMachines/VendingMachineInventoryPrototype.cs b/Content.Shared/VendingMachines/VendingMachineInventoryPrototype.cs index b4274390ec..560d0b77b6 100644 --- a/Content.Shared/VendingMachines/VendingMachineInventoryPrototype.cs +++ b/Content.Shared/VendingMachines/VendingMachineInventoryPrototype.cs @@ -1,4 +1,5 @@ -using System; +#nullable enable +using System; using System.Collections.Generic; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; @@ -9,12 +10,12 @@ namespace Content.Shared.VendingMachines [Serializable, NetSerializable, Prototype("vendingMachineInventory")] public class VendingMachineInventoryPrototype : IPrototype { - private string _id; - private string _name; - private string _description; + private string _id = string.Empty; + private string _name = string.Empty; + private string _description = string.Empty; private double _animationDuration; - private string _spriteName; - private Dictionary _startingInventory; + private string _spriteName = string.Empty; + private Dictionary _startingInventory = new(); public string ID => _id; public string Name => _name;