From ca7960382b56757024b89c138059da50ff059dea Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 4 Jun 2022 19:17:48 +1200 Subject: [PATCH] Missing nullables (#8634) --- Content.Client/Actions/UI/ActionMenuItem.cs | 2 +- Content.Client/Actions/UI/ActionSlot.cs | 2 +- Content.Client/Body/UI/BodyScannerDisplay.cs | 2 +- .../Components/CharacterInfoSystem.cs | 6 +++--- Content.Client/Damage/DamageVisualizer.cs | 6 +++--- Content.Client/Items/Managers/ItemSlotManager.cs | 2 +- .../Visualizers/ExpendableLightVisualizer.cs | 8 ++++---- .../Light/Visualizers/LightBulbVisualizer.cs | 2 +- .../Nutrition/Visualizers/DrinkCanVisualizer.cs | 2 +- .../ParticleAcceleratorPartVisualizer.cs | 4 ++-- .../Pinpointer/PinpointerVisualizer.cs | 2 +- .../PneumaticCannon/PneumaticCannonVisualizer.cs | 4 ++-- Content.Client/Popups/PopupSystem.cs | 2 +- .../Visualizers/RadiationCollectorVisualizer.cs | 6 +++--- Content.Client/Stack/StackVisualizer.cs | 2 +- .../Visualizers/BagOpenCloseVisualizer.cs | 4 ++-- .../Storage/Visualizers/MappedItemVisualizer.cs | 4 ++-- .../UI/SurveillanceCameraMonitorBoundUi.cs | 2 +- .../Administration/Commands/AddReagent.cs | 2 +- .../Commands/SetSolutionCapacity.cs | 2 +- .../Commands/SetSolutionTemperature.cs | 2 +- .../Commands/SetSolutionThermalEnergy.cs | 2 +- .../Logs/Converters/EntityUidConverter.cs | 4 ++-- Content.Server/Alert/Click/StopPulling.cs | 2 +- .../Atmos/EntitySystems/FlammableSystem.cs | 2 +- .../Atmos/Monitor/Systems/AirAlarmModes.cs | 14 +++++++------- .../Atmos/Monitor/Systems/AirAlarmSystem.cs | 16 ++++++++-------- .../Monitor/Systems/AtmosAlarmableSystem.cs | 2 +- .../Monitor/Systems/AtmosMonitoringSystem.cs | 4 ++-- .../Unary/EntitySystems/GasCanisterSystem.cs | 2 +- .../Unary/EntitySystems/GasVentPumpSystem.cs | 4 ++-- .../Unary/EntitySystems/GasVentScrubberSystem.cs | 4 ++-- Content.Server/Body/Systems/BrainSystem.cs | 4 ++-- .../Buckle/Components/BuckleComponent.cs | 2 +- Content.Server/Chat/SuicideSystem.cs | 2 +- .../Components/SolutionTransferComponent.cs | 2 +- .../ReagentEffectConditions/BodyTemperature.cs | 4 ++-- .../ReagentEffectConditions/TotalDamage.cs | 4 ++-- .../ReagentEffects/AdjustTemperature.cs | 4 ++-- Content.Server/CombatMode/CombatModeSystem.cs | 2 +- .../Disease/Cures/DiseaseBodyTemperatureCure.cs | 2 +- Content.Server/Doors/Systems/FirelockSystem.cs | 2 +- .../EntitySystems/ExplosionSystem.Airtight.cs | 2 +- .../Fluids/EntitySystems/PuddleSystem.cs | 2 +- Content.Server/Labels/Label/LabelSystem.cs | 6 +++--- Content.Server/Mind/Commands/RenameCommand.cs | 4 ++-- .../CrematoriumEntityStorageComponent.cs | 2 +- Content.Server/Nuke/NukeSystem.cs | 2 +- .../Nutrition/EntitySystems/FoodSystem.cs | 2 +- .../Nutrition/EntitySystems/UtensilSystem.cs | 2 +- .../Conditions/KillRandomPersonCondition.cs | 4 ++-- .../Power/EntitySystems/PowerReceiverSystem.cs | 4 ++-- .../VendingMachineContrabandWireAction.cs | 6 +++--- .../VendingMachineEjectItemWireAction.cs | 6 +++--- Content.Shared/Alert/AlertsSystem.cs | 14 +++++++------- Content.Shared/Camera/CameraRecoilSystem.cs | 2 +- .../Containers/ItemSlot/ItemSlotsSystem.cs | 2 +- Content.Shared/Examine/ExamineSystemShared.cs | 2 +- Content.Shared/Item/SharedItemComponent.cs | 4 ++-- 59 files changed, 109 insertions(+), 109 deletions(-) diff --git a/Content.Client/Actions/UI/ActionMenuItem.cs b/Content.Client/Actions/UI/ActionMenuItem.cs index 2e5e1311d4..61bfe4ebe3 100644 --- a/Content.Client/Actions/UI/ActionMenuItem.cs +++ b/Content.Client/Actions/UI/ActionMenuItem.cs @@ -149,7 +149,7 @@ namespace Content.Client.Actions.UI private void UpdateItemIcon() { - if (Action?.EntityIcon == null || !IoCManager.Resolve().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent sprite)) + if (Action?.EntityIcon == null || !IoCManager.Resolve().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent? sprite)) { _bigItemSpriteView.Visible = false; _bigItemSpriteView.Sprite = null; diff --git a/Content.Client/Actions/UI/ActionSlot.cs b/Content.Client/Actions/UI/ActionSlot.cs index 05b2ea955a..e620e8e350 100644 --- a/Content.Client/Actions/UI/ActionSlot.cs +++ b/Content.Client/Actions/UI/ActionSlot.cs @@ -436,7 +436,7 @@ namespace Content.Client.Actions.UI return; } - if (Action?.EntityIcon == null || !_entMan.TryGetComponent(Action.EntityIcon.Value, out SpriteComponent sprite)) + if (Action?.EntityIcon == null || !_entMan.TryGetComponent(Action.EntityIcon.Value, out SpriteComponent? sprite)) { _bigItemSpriteView.Visible = false; _bigItemSpriteView.Sprite = null; diff --git a/Content.Client/Body/UI/BodyScannerDisplay.cs b/Content.Client/Body/UI/BodyScannerDisplay.cs index 04880094ec..ecf4cab158 100644 --- a/Content.Client/Body/UI/BodyScannerDisplay.cs +++ b/Content.Client/Body/UI/BodyScannerDisplay.cs @@ -122,7 +122,7 @@ namespace Content.Client.Body.UI public void BodyPartOnItemSelected(ItemListSelectedEventArgs args) { - if (IoCManager.Resolve().TryGetComponent(_currentEntity, out var body)) + if (!IoCManager.Resolve().TryGetComponent(_currentEntity, out var body)) { return; } diff --git a/Content.Client/CharacterInfo/Components/CharacterInfoSystem.cs b/Content.Client/CharacterInfo/Components/CharacterInfoSystem.cs index 7227c16cee..f778383488 100644 --- a/Content.Client/CharacterInfo/Components/CharacterInfoSystem.cs +++ b/Content.Client/CharacterInfo/Components/CharacterInfoSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Shared.CharacterInfo; using Content.Shared.Objectives; using Robust.Client.GameObjects; @@ -32,7 +32,7 @@ public sealed class CharacterInfoSystem : EntitySystem private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args) { - if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent characterInfoComponent)) + if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent? characterInfoComponent)) return; UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives, msg.Briefing); @@ -41,7 +41,7 @@ public sealed class CharacterInfoSystem : EntitySystem characterInfoComponent.Control.SpriteView.Sprite = spriteComponent; } - if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent metadata)) + if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent? metadata)) return; characterInfoComponent.Control.NameLabel.Text = metadata.EntityName; } diff --git a/Content.Client/Damage/DamageVisualizer.cs b/Content.Client/Damage/DamageVisualizer.cs index a04e83a183..6fbabe15ac 100644 --- a/Content.Client/Damage/DamageVisualizer.cs +++ b/Content.Client/Damage/DamageVisualizer.cs @@ -505,7 +505,7 @@ namespace Content.Client.Damage public override void OnChangeData(AppearanceComponent component) { var entities = _entityManager; - if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent damageData)) + if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent? damageData)) return; if (!damageData.Valid) @@ -527,8 +527,8 @@ namespace Content.Client.Damage private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData) { var entities = _entityManager; - if (!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent) - || !entities.TryGetComponent(component.Owner, out DamageableComponent damageComponent)) + if (!entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent) + || !entities.TryGetComponent(component.Owner, out DamageableComponent? damageComponent)) return; if (_targetLayers != null && _damageOverlayGroups != null) diff --git a/Content.Client/Items/Managers/ItemSlotManager.cs b/Content.Client/Items/Managers/ItemSlotManager.cs index d407ca7e04..9b2750adae 100644 --- a/Content.Client/Items/Managers/ItemSlotManager.cs +++ b/Content.Client/Items/Managers/ItemSlotManager.cs @@ -39,7 +39,7 @@ namespace Content.Client.Items.Managers { ISpriteComponent? sprite; if (_entityManager.TryGetComponent(entity, out HandVirtualItemComponent? virtPull) - && _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite)) + && _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent? pulledSprite)) { sprite = pulledSprite; } diff --git a/Content.Client/Light/Visualizers/ExpendableLightVisualizer.cs b/Content.Client/Light/Visualizers/ExpendableLightVisualizer.cs index 487e5e1bee..85e47706ce 100644 --- a/Content.Client/Light/Visualizers/ExpendableLightVisualizer.cs +++ b/Content.Client/Light/Visualizers/ExpendableLightVisualizer.cs @@ -1,4 +1,4 @@ -using Content.Client.Light.Components; +using Content.Client.Light.Components; using Content.Shared.Light.Component; using JetBrains.Annotations; using Robust.Client.GameObjects; @@ -19,7 +19,7 @@ namespace Content.Client.Light.Visualizers var entities = IoCManager.Resolve(); if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID)) { - if (entities.TryGetComponent(component.Owner, out LightBehaviourComponent lightBehaviour)) + if (entities.TryGetComponent(component.Owner, out LightBehaviourComponent? lightBehaviour)) { lightBehaviour.StopLightBehaviour(); @@ -27,7 +27,7 @@ namespace Content.Client.Light.Visualizers { lightBehaviour.StartLightBehaviour(lightBehaviourID); } - else if (entities.TryGetComponent(component.Owner, out PointLightComponent light)) + else if (entities.TryGetComponent(component.Owner, out PointLightComponent? light)) { light.Enabled = false; } @@ -40,7 +40,7 @@ namespace Content.Client.Light.Visualizers } if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state) - && entities.TryGetComponent(component.Owner, out ExpendableLightComponent expendableLight)) + && entities.TryGetComponent(component.Owner, out ExpendableLightComponent? expendableLight)) { switch (state) { diff --git a/Content.Client/Light/Visualizers/LightBulbVisualizer.cs b/Content.Client/Light/Visualizers/LightBulbVisualizer.cs index 6ee0783764..9fcfefeed9 100644 --- a/Content.Client/Light/Visualizers/LightBulbVisualizer.cs +++ b/Content.Client/Light/Visualizers/LightBulbVisualizer.cs @@ -15,7 +15,7 @@ namespace Content.Client.Light.Visualizers base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) + if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite)) return; // update sprite state diff --git a/Content.Client/Nutrition/Visualizers/DrinkCanVisualizer.cs b/Content.Client/Nutrition/Visualizers/DrinkCanVisualizer.cs index f004b5efd5..589ac074c6 100644 --- a/Content.Client/Nutrition/Visualizers/DrinkCanVisualizer.cs +++ b/Content.Client/Nutrition/Visualizers/DrinkCanVisualizer.cs @@ -21,7 +21,7 @@ namespace Content.Client.Nutrition.Visualizers base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) + if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) { return; } diff --git a/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs b/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs index 43c4c2db75..0b7eed35af 100644 --- a/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs +++ b/Content.Client/ParticleAccelerator/ParticleAcceleratorPartVisualizer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Content.Shared.Singularity.Components; using JetBrains.Annotations; @@ -52,7 +52,7 @@ namespace Content.Client.ParticleAccelerator base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) return; + if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return; if (!component.TryGetData(ParticleAcceleratorVisuals.VisualState, out ParticleAcceleratorVisualState state)) { state = ParticleAcceleratorVisualState.Unpowered; diff --git a/Content.Client/Pinpointer/PinpointerVisualizer.cs b/Content.Client/Pinpointer/PinpointerVisualizer.cs index b295e4b062..0ac8794119 100644 --- a/Content.Client/Pinpointer/PinpointerVisualizer.cs +++ b/Content.Client/Pinpointer/PinpointerVisualizer.cs @@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) + if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite)) return; // check if pinpointer screen is active diff --git a/Content.Client/PneumaticCannon/PneumaticCannonVisualizer.cs b/Content.Client/PneumaticCannon/PneumaticCannonVisualizer.cs index f01c6d5f1d..dc3905939f 100644 --- a/Content.Client/PneumaticCannon/PneumaticCannonVisualizer.cs +++ b/Content.Client/PneumaticCannon/PneumaticCannonVisualizer.cs @@ -1,4 +1,4 @@ -using Content.Shared.PneumaticCannon; +using Content.Shared.PneumaticCannon; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.IoC; @@ -12,7 +12,7 @@ namespace Content.Client.PneumaticCannon base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) + if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite)) return; if (component.TryGetData(PneumaticCannonVisuals.Tank, out bool tank)) diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index a6edf36764..36d1087e29 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -259,7 +259,7 @@ namespace Content.Client.Popups if (Entity == null) screenCoords = _eyeManager.CoordinatesToScreen(InitialPos); - else if (_entityManager.TryGetComponent(Entity.Value, out TransformComponent xform) + else if (_entityManager.TryGetComponent(Entity.Value, out TransformComponent? xform) && xform.MapID == _eyeManager.CurrentMap) screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates); else diff --git a/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs b/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs index 8d7bee10ec..552190cb57 100644 --- a/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs +++ b/Content.Client/Singularity/Visualizers/RadiationCollectorVisualizer.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Shared.Singularity.Components; using JetBrains.Annotations; using Robust.Client.Animations; @@ -54,8 +54,8 @@ namespace Content.Client.Singularity.Visualizers base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) return; - if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent animPlayer)) return; + if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return; + if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent? animPlayer)) return; if (!component.TryGetData(RadiationCollectorVisuals.VisualState, out RadiationCollectorVisualState state)) { state = RadiationCollectorVisualState.Deactive; diff --git a/Content.Client/Stack/StackVisualizer.cs b/Content.Client/Stack/StackVisualizer.cs index 6c880fb56c..e969a4bdaf 100644 --- a/Content.Client/Stack/StackVisualizer.cs +++ b/Content.Client/Stack/StackVisualizer.cs @@ -102,7 +102,7 @@ namespace Content.Client.Stack base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent)) + if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent)) { if (_isComposite) { diff --git a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs index 528ab708a0..a5f0007367 100644 --- a/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs +++ b/Content.Client/Storage/Visualizers/BagOpenCloseVisualizer.cs @@ -1,4 +1,4 @@ -using Content.Shared.Storage.Components; +using Content.Shared.Storage.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Shared.GameObjects; @@ -47,7 +47,7 @@ namespace Content.Client.Storage.Visualizers var entities = IoCManager.Resolve(); if (_openIcon == null || - !entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent)) + !entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent)) return; if (!component.TryGetData(SharedBagOpenVisuals.BagState, out var bagState)) diff --git a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs index a0ac0fee1d..63ac715005 100644 --- a/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs +++ b/Content.Client/Storage/Visualizers/MappedItemVisualizer.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Content.Shared.Storage.Components; using JetBrains.Annotations; @@ -32,7 +32,7 @@ namespace Content.Client.Storage.Visualizers base.OnChangeData(component); var entities = IoCManager.Resolve(); - if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent)) + if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent)) { if (_spriteLayers.Count == 0) { diff --git a/Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs b/Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs index 0a33cbd0d5..6202364c27 100644 --- a/Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs +++ b/Content.Client/SurveillanceCamera/UI/SurveillanceCameraMonitorBoundUi.cs @@ -104,7 +104,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter _currentCamera = cast.ActiveCamera; } - if (_entityManager.TryGetComponent(cast.ActiveCamera, out EyeComponent eye)) + if (_entityManager.TryGetComponent(cast.ActiveCamera, out EyeComponent? eye)) { _window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras); } diff --git a/Content.Server/Administration/Commands/AddReagent.cs b/Content.Server/Administration/Commands/AddReagent.cs index d7d8d998e3..8520816b19 100644 --- a/Content.Server/Administration/Commands/AddReagent.cs +++ b/Content.Server/Administration/Commands/AddReagent.cs @@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent man)) + if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent? man)) { shell.WriteLine($"Entity does not have any solutions."); return; diff --git a/Content.Server/Administration/Commands/SetSolutionCapacity.cs b/Content.Server/Administration/Commands/SetSolutionCapacity.cs index c8cc4aa0cb..983d89e3d9 100644 --- a/Content.Server/Administration/Commands/SetSolutionCapacity.cs +++ b/Content.Server/Administration/Commands/SetSolutionCapacity.cs @@ -27,7 +27,7 @@ namespace Content.Server.Administration.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent man)) + if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent? man)) { shell.WriteLine($"Entity does not have any solutions."); return; diff --git a/Content.Server/Administration/Commands/SetSolutionTemperature.cs b/Content.Server/Administration/Commands/SetSolutionTemperature.cs index b0e4769fec..fe6fbcb053 100644 --- a/Content.Server/Administration/Commands/SetSolutionTemperature.cs +++ b/Content.Server/Administration/Commands/SetSolutionTemperature.cs @@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent man)) + if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent? man)) { shell.WriteLine($"Entity does not have any solutions."); return; diff --git a/Content.Server/Administration/Commands/SetSolutionThermalEnergy.cs b/Content.Server/Administration/Commands/SetSolutionThermalEnergy.cs index 9166812f92..e2510a2884 100644 --- a/Content.Server/Administration/Commands/SetSolutionThermalEnergy.cs +++ b/Content.Server/Administration/Commands/SetSolutionThermalEnergy.cs @@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands return; } - if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent man)) + if (!IoCManager.Resolve().TryGetComponent(uid, out SolutionContainerManagerComponent? man)) { shell.WriteLine($"Entity does not have any solutions."); return; diff --git a/Content.Server/Administration/Logs/Converters/EntityUidConverter.cs b/Content.Server/Administration/Logs/Converters/EntityUidConverter.cs index 3788486fb9..04b36a1834 100644 --- a/Content.Server/Administration/Logs/Converters/EntityUidConverter.cs +++ b/Content.Server/Administration/Logs/Converters/EntityUidConverter.cs @@ -1,4 +1,4 @@ -using System.Text.Json; +using System.Text.Json; using Robust.Server.GameObjects; namespace Content.Server.Administration.Logs.Converters; @@ -14,7 +14,7 @@ public sealed class EntityUidConverter : AdminLogConverter writer.WriteNumber("id", (int) value); - if (entities.TryGetComponent(value, out MetaDataComponent metaData)) + if (entities.TryGetComponent(value, out MetaDataComponent? metaData)) { writer.WriteString("name", metaData.EntityName); } diff --git a/Content.Server/Alert/Click/StopPulling.cs b/Content.Server/Alert/Click/StopPulling.cs index c654db5e31..14e64d12d8 100644 --- a/Content.Server/Alert/Click/StopPulling.cs +++ b/Content.Server/Alert/Click/StopPulling.cs @@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click { var ps = EntitySystem.Get(); var playerTarget = ps.GetPulled(player); - if (playerTarget != default && IoCManager.Resolve().TryGetComponent(playerTarget, out SharedPullableComponent playerPullable)) + if (playerTarget != default && IoCManager.Resolve().TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable)) { ps.TryStopPull(playerPullable); } diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 458f8e9062..cea9cf7051 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -52,7 +52,7 @@ namespace Content.Server.Atmos.EntitySystems { var otherFixture = args.OtherFixture.Body.Owner; - if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent flammable)) + if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent? flammable)) return; flammable.FireStacks += component.FireStacks; diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmModes.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmModes.cs index be82243aed..4c9557fe88 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmModes.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmModes.cs @@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Monitor { public override void Execute(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) + if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)) return; foreach (var (addr, device) in alarm.DeviceData) @@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Monitor { public override void Execute(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) + if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)) return; foreach (var (addr, device) in alarm.DeviceData) @@ -132,7 +132,7 @@ namespace Content.Server.Atmos.Monitor { public override void Execute(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) + if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)) return; foreach (var (addr, device) in alarm.DeviceData) @@ -154,7 +154,7 @@ namespace Content.Server.Atmos.Monitor { public override void Execute(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) + if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)) return; foreach (var (addr, device) in alarm.DeviceData) @@ -183,9 +183,9 @@ namespace Content.Server.Atmos.Monitor public override void Execute(EntityUid uid) { - if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm) - || !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) - || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)) + if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm) + || !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) + || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)) return; _devices = alarm.DeviceData; diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs index 483f62abc0..a8b8ea5d32 100644 --- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs @@ -74,7 +74,7 @@ namespace Content.Server.Atmos.Monitor.Systems /// The data to send to the device. public void SetData(EntityUid uid, string address, IAtmosDeviceData data) { - if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) + if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) && !monitor.NetEnabled) return; @@ -93,7 +93,7 @@ namespace Content.Server.Atmos.Monitor.Systems /// public void SyncAllDevices(EntityUid uid) { - if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) + if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) && !monitor.NetEnabled) return; @@ -111,7 +111,7 @@ namespace Content.Server.Atmos.Monitor.Systems /// The address of the device. public void SyncDevice(EntityUid uid, string address) { - if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) + if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) && !monitor.NetEnabled) return; @@ -130,7 +130,7 @@ namespace Content.Server.Atmos.Monitor.Systems /// The mode to sync with the rest of the network. public void SyncMode(EntityUid uid, AirAlarmMode mode) { - if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) + if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor) && !monitor.NetEnabled) return; @@ -196,7 +196,7 @@ namespace Content.Server.Atmos.Monitor.Systems if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return; - if (EntityManager.TryGetComponent(uid, out WiresComponent wire) && wire.IsPanelOpen) + if (EntityManager.TryGetComponent(uid, out WiresComponent? wire) && wire.IsPanelOpen) { args.Handled = false; return; @@ -227,7 +227,7 @@ namespace Content.Server.Atmos.Monitor.Systems private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args) { string addr = string.Empty; - if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) addr = netConn.Address; + if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address; if (AccessCheck(uid, args.Session.AttachedEntity, component)) SetMode(uid, addr, args.Mode, true, false); else @@ -255,7 +255,7 @@ namespace Content.Server.Atmos.Monitor.Systems if (!Resolve(uid, ref component)) return false; - if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent reader) || user == null) + if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent? reader) || user == null) return false; if (!_accessSystem.IsAllowed(user.Value, reader)) @@ -276,7 +276,7 @@ namespace Content.Server.Atmos.Monitor.Systems } string addr = string.Empty; - if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) addr = netConn.Address; + if (EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) addr = netConn.Address; if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger) diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs index b0558d9f18..cd149c754a 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosAlarmableSystem.cs @@ -17,7 +17,7 @@ namespace Content.Server.Atmos.Monitor.Systems { if (component.IgnoreAlarms) return; - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) + if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) return; if (args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd) diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs index 49981da3df..225663a766 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs @@ -156,7 +156,7 @@ namespace Content.Server.Atmos.Monitor.Systems // the highest network alarm state at any time if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd) || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable) - || !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) + || !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)) return; // ignore packets from self, ignore from different frequency @@ -342,7 +342,7 @@ namespace Content.Server.Atmos.Monitor.Systems if (state == AtmosMonitorAlarmType.Danger) PlayAlertSound(uid, monitor); - if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent alarmable) + if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent? alarmable) && !alarmable.IgnoreAlarms) RaiseLocalEvent(monitor.Owner, new AtmosMonitorAlarmEvent(monitor.LastAlarmState, monitor.HighestAlarmInNetwork)); // TODO: Central system that grabs *all* alarms from wired network diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs index a36528f996..8acabe3996 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs @@ -127,7 +127,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args) { var impact = LogImpact.High; - if (EntityManager.TryGetComponent(uid, out ContainerManagerComponent containerManager) + if (EntityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager) && containerManager.TryGetContainer(canister.ContainerName, out var container)) impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index a4a56aeff9..36fa196eb9 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -159,8 +159,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPacketRecv(EntityUid uid, GasVentPumpComponent component, DeviceNetworkPacketEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn) - || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable) + if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn) + || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) return; diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index ae22d41a71..c0008afcc4 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -130,8 +130,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnPacketRecv(EntityUid uid, GasVentScrubberComponent component, DeviceNetworkPacketEvent args) { - if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn) - || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable) + if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn) + || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) return; diff --git a/Content.Server/Body/Systems/BrainSystem.cs b/Content.Server/Body/Systems/BrainSystem.cs index 5479088de2..2bd24f2565 100644 --- a/Content.Server/Body/Systems/BrainSystem.cs +++ b/Content.Server/Body/Systems/BrainSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.Body.Components; +using Content.Server.Body.Components; using Content.Server.Ghost.Components; using Content.Server.Mind.Components; using Content.Shared.Body.Components; @@ -24,7 +24,7 @@ namespace Content.Server.Body.Systems private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args) { // This one needs to be special, okay? - if (!EntityManager.TryGetComponent(uid, out MechanismComponent mech)) + if (!EntityManager.TryGetComponent(uid, out MechanismComponent? mech)) return; HandleMind((mech.Part!).Owner, (args.Old).Owner); diff --git a/Content.Server/Buckle/Components/BuckleComponent.cs b/Content.Server/Buckle/Components/BuckleComponent.cs index dd92894d5f..0f42144791 100644 --- a/Content.Server/Buckle/Components/BuckleComponent.cs +++ b/Content.Server/Buckle/Components/BuckleComponent.cs @@ -314,7 +314,7 @@ namespace Content.Server.Buckle.Components appearance.SetData(BuckleVisuals.Buckled, false); if (_entMan.HasComponent(Owner) - | _entMan.TryGetComponent(Owner, out var mobState) && mobState.IsIncapacitated()) + | (_entMan.TryGetComponent(Owner, out var mobState) && mobState.IsIncapacitated())) { EntitySystem.Get().Down(Owner); } diff --git a/Content.Server/Chat/SuicideSystem.cs b/Content.Server/Chat/SuicideSystem.cs index 79f5f3f58f..96ea5094ce 100644 --- a/Content.Server/Chat/SuicideSystem.cs +++ b/Content.Server/Chat/SuicideSystem.cs @@ -73,7 +73,7 @@ namespace Content.Server.Chat private void EnvironmentSuicideHandler(EntityUid victim, SuicideEvent suicideEvent) { // Suicide by held item - if (EntityManager.TryGetComponent(victim, out HandsComponent handsComponent) + if (EntityManager.TryGetComponent(victim, out HandsComponent? handsComponent) && handsComponent.ActiveHandEntity is EntityUid item) { RaiseLocalEvent(item, suicideEvent, false); diff --git a/Content.Server/Chemistry/Components/SolutionTransferComponent.cs b/Content.Server/Chemistry/Components/SolutionTransferComponent.cs index e444de3810..4e07041cc0 100644 --- a/Content.Server/Chemistry/Components/SolutionTransferComponent.cs +++ b/Content.Server/Chemistry/Components/SolutionTransferComponent.cs @@ -115,7 +115,7 @@ namespace Content.Server.Chemistry.Components //Special case for reagent tanks, because normally clicking another container will give solution, not take it. if (CanReceive && !_entities.HasComponent(target) // target must not be refillable (e.g. Reagent Tanks) && solutionsSys.TryGetDrainableSolution(target, out var targetDrain) // target must be drainable - && _entities.TryGetComponent(Owner, out RefillableSolutionComponent refillComp) + && _entities.TryGetComponent(Owner, out RefillableSolutionComponent? refillComp) && solutionsSys.TryGetRefillableSolution(Owner, out var ownerRefill, refillable: refillComp)) { diff --git a/Content.Server/Chemistry/ReagentEffectConditions/BodyTemperature.cs b/Content.Server/Chemistry/ReagentEffectConditions/BodyTemperature.cs index a5b07dd438..313d1eb629 100644 --- a/Content.Server/Chemistry/ReagentEffectConditions/BodyTemperature.cs +++ b/Content.Server/Chemistry/ReagentEffectConditions/BodyTemperature.cs @@ -1,4 +1,4 @@ -using Content.Server.Temperature.Components; +using Content.Server.Temperature.Components; using Content.Shared.Chemistry.Reagent; namespace Content.Server.Chemistry.ReagentEffectConditions @@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions public float Max = float.MaxValue; public override bool Condition(ReagentEffectArgs args) { - if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent temp)) + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp)) { if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max) return true; diff --git a/Content.Server/Chemistry/ReagentEffectConditions/TotalDamage.cs b/Content.Server/Chemistry/ReagentEffectConditions/TotalDamage.cs index b5f21d616e..4758bccea5 100644 --- a/Content.Server/Chemistry/ReagentEffectConditions/TotalDamage.cs +++ b/Content.Server/Chemistry/ReagentEffectConditions/TotalDamage.cs @@ -1,4 +1,4 @@ -using Content.Shared.Chemistry.Reagent; +using Content.Shared.Chemistry.Reagent; using Content.Shared.Damage; using Content.Shared.FixedPoint; @@ -14,7 +14,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions public override bool Condition(ReagentEffectArgs args) { - if (args.EntityManager.TryGetComponent(args.SolutionEntity, out DamageableComponent damage)) + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out DamageableComponent? damage)) { var total = damage.TotalDamage; if (total > Min && total < Max) diff --git a/Content.Server/Chemistry/ReagentEffects/AdjustTemperature.cs b/Content.Server/Chemistry/ReagentEffects/AdjustTemperature.cs index eb4f579022..81a0ddcbda 100644 --- a/Content.Server/Chemistry/ReagentEffects/AdjustTemperature.cs +++ b/Content.Server/Chemistry/ReagentEffects/AdjustTemperature.cs @@ -1,4 +1,4 @@ -using Content.Server.Temperature.Components; +using Content.Server.Temperature.Components; using Content.Server.Temperature.Systems; using Content.Shared.Chemistry.Reagent; @@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.ReagentEffects public override void Effect(ReagentEffectArgs args) { - if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent temp)) + if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp)) { var sys = args.EntityManager.EntitySysManager.GetEntitySystem(); sys.ChangeHeat(args.SolutionEntity, Amount, true, temp); diff --git a/Content.Server/CombatMode/CombatModeSystem.cs b/Content.Server/CombatMode/CombatModeSystem.cs index 59c73a710f..dbb12217ae 100644 --- a/Content.Server/CombatMode/CombatModeSystem.cs +++ b/Content.Server/CombatMode/CombatModeSystem.cs @@ -40,7 +40,7 @@ namespace Content.Server.CombatMode EntityUid? inTargetHand = null; - if (EntityManager.TryGetComponent(args.Target, out HandsComponent targetHandsComponent) + if (EntityManager.TryGetComponent(args.Target, out HandsComponent? targetHandsComponent) && targetHandsComponent.ActiveHand != null && !targetHandsComponent.ActiveHand.IsEmpty) { diff --git a/Content.Server/Disease/Cures/DiseaseBodyTemperatureCure.cs b/Content.Server/Disease/Cures/DiseaseBodyTemperatureCure.cs index 6afc92a2e4..aa27d38e98 100644 --- a/Content.Server/Disease/Cures/DiseaseBodyTemperatureCure.cs +++ b/Content.Server/Disease/Cures/DiseaseBodyTemperatureCure.cs @@ -15,7 +15,7 @@ namespace Content.Server.Disease.Cures public float Max = float.MaxValue; public override bool Cure(DiseaseEffectArgs args) { - if (!args.EntityManager.TryGetComponent(args.DiseasedEntity, out TemperatureComponent temp)) + if (!args.EntityManager.TryGetComponent(args.DiseasedEntity, out TemperatureComponent? temp)) return false; return temp.CurrentTemperature > Min && temp.CurrentTemperature < float.MaxValue; diff --git a/Content.Server/Doors/Systems/FirelockSystem.cs b/Content.Server/Doors/Systems/FirelockSystem.cs index 34203d91e6..42bdba35ba 100644 --- a/Content.Server/Doors/Systems/FirelockSystem.cs +++ b/Content.Server/Doors/Systems/FirelockSystem.cs @@ -65,7 +65,7 @@ namespace Content.Server.Doors.Systems // Make firelocks autoclose, but only if the last alarm type it // remembers was a danger. This is to prevent people from // flooding hallways with endless bad air/fire. - if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)) + if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)) { args.Cancel(); return; diff --git a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs index 30a3e391ad..2bcd30b67f 100644 --- a/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs +++ b/Content.Server/Explosion/EntitySystems/ExplosionSystem.Airtight.cs @@ -97,7 +97,7 @@ public sealed partial class ExplosionSystem : EntitySystem if (!airtight.AirBlocked) return; - if (!EntityManager.TryGetComponent(uid, out TransformComponent transform) || !transform.Anchored) + if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored) return; if (!_mapManager.TryGetGrid(transform.GridID, out var grid)) diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index deb35a976e..ed0979aa99 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -57,7 +57,7 @@ namespace Content.Server.Fluids.EntitySystems bool hasEvaporationComponent = EntityManager.TryGetComponent(uid, out var evaporationComponent); bool canEvaporate = (hasEvaporationComponent && - (evaporationComponent.LowerLimit == 0 || puddleComponent.CurrentVolume > evaporationComponent.LowerLimit)); + (evaporationComponent!.LowerLimit == 0 || puddleComponent.CurrentVolume > evaporationComponent.LowerLimit)); // "Does this puddle's sprite need changing to the wet floor effect sprite?" bool changeToWetFloor = (puddleComponent.CurrentVolume <= puddleComponent.WetFloorEffectThreshold diff --git a/Content.Server/Labels/Label/LabelSystem.cs b/Content.Server/Labels/Label/LabelSystem.cs index d5886638fc..3aebd50446 100644 --- a/Content.Server/Labels/Label/LabelSystem.cs +++ b/Content.Server/Labels/Label/LabelSystem.cs @@ -33,7 +33,7 @@ namespace Content.Server.Labels { _itemSlotsSystem.AddItemSlot(uid, component.Name, component.LabelSlot); - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(PaperLabelVisuals.HasLabel, false); @@ -68,7 +68,7 @@ namespace Content.Server.Labels return; } - if (!EntityManager.TryGetComponent(item, out PaperComponent paper)) + if (!EntityManager.TryGetComponent(item, out PaperComponent? paper)) // Assuming yaml has the correct entity whitelist, this should not happen. return; @@ -90,7 +90,7 @@ namespace Content.Server.Labels if (args.Container.ID != label.LabelSlot.ID) return; - if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance)) + if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem); diff --git a/Content.Server/Mind/Commands/RenameCommand.cs b/Content.Server/Mind/Commands/RenameCommand.cs index ec0149f233..c68df47c2a 100644 --- a/Content.Server/Mind/Commands/RenameCommand.cs +++ b/Content.Server/Mind/Commands/RenameCommand.cs @@ -1,4 +1,4 @@ -using Content.Server.Access.Systems; +using Content.Server.Access.Systems; using Content.Server.Administration; using Content.Server.Administration.Systems; using Content.Server.Cloning; @@ -47,7 +47,7 @@ public sealed class RenameCommand : IConsoleCommand var entSysMan = IoCManager.Resolve(); - if (entMan.TryGetComponent(entityUid, out MindComponent mind) && mind.Mind != null) + if (entMan.TryGetComponent(entityUid, out MindComponent? mind) && mind.Mind != null) { // Mind mind.Mind.CharacterName = name; diff --git a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs index d638fc60de..c942dc85c9 100644 --- a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs @@ -58,7 +58,7 @@ namespace Content.Server.Morgue.Components if (Open) CloseStorage(); - if(_entities.TryGetComponent(Owner, out AppearanceComponent appearanceComponent)) + if(_entities.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent)) appearanceComponent.SetData(CrematoriumVisuals.Burning, true); Cooking = true; diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index 58c482c699..f45ea949b6 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -284,7 +284,7 @@ namespace Content.Server.Nuke return; var anchored = false; - if (EntityManager.TryGetComponent(uid, out TransformComponent transform)) + if (EntityManager.TryGetComponent(uid, out TransformComponent? transform)) anchored = transform.Anchored; var allowArm = component.DiskSlot.HasItem && diff --git a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs index f983293427..171b65d9fb 100644 --- a/Content.Server/Nutrition/EntitySystems/FoodSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/FoodSystem.cs @@ -358,7 +358,7 @@ namespace Content.Server.Nutrition.EntitySystems if (args.Cancelled) return; - IngestionBlockerComponent blocker; + IngestionBlockerComponent? blocker; if (_inventorySystem.TryGetSlotEntity(uid, "mask", out var maskUid) && EntityManager.TryGetComponent(maskUid, out blocker) && diff --git a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs index 5d58fb4713..c78769af49 100644 --- a/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/UtensilSystem.cs @@ -38,7 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems private bool TryUseUtensil(EntityUid user, EntityUid target, UtensilComponent component) { - if (!EntityManager.TryGetComponent(target, out FoodComponent food)) + if (!EntityManager.TryGetComponent(target, out FoodComponent? food)) return false; //Prevents food usage with a wrong utensil diff --git a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs index 0da04e2bde..3655f0e471 100644 --- a/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs +++ b/Content.Server/Objectives/Conditions/KillRandomPersonCondition.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using Content.Server.Mind.Components; using Content.Server.Objectives.Interfaces; using Content.Shared.MobState.Components; @@ -21,7 +21,7 @@ namespace Content.Server.Objectives.Conditions if (entity == default) return false; - return entityMgr.TryGetComponent(entity, out MobStateComponent mobState) && + return entityMgr.TryGetComponent(entity, out MobStateComponent? mobState) && mobState.IsAlive() && mc.Mind != mind; }).Select(mc => mc.Mind).ToList(); diff --git a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs index faa9912a6d..9f407b9ce4 100644 --- a/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs +++ b/Content.Server/Power/EntitySystems/PowerReceiverSystem.cs @@ -60,7 +60,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverConnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverConnectedEvent args) { - if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver)) + if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent? receiver)) { provider.AddReceiver(receiver); } @@ -68,7 +68,7 @@ namespace Content.Server.Power.EntitySystems private void OnReceiverDisconnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverDisconnectedEvent args) { - if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent receiver)) + if (EntityManager.TryGetComponent(args.Receiver.Owner, out ApcPowerReceiverComponent? receiver)) { provider.RemoveReceiver(receiver); } diff --git a/Content.Server/VendingMachines/VendingMachineContrabandWireAction.cs b/Content.Server/VendingMachines/VendingMachineContrabandWireAction.cs index 0e2100f6bd..5f5ba7243b 100644 --- a/Content.Server/VendingMachines/VendingMachineContrabandWireAction.cs +++ b/Content.Server/VendingMachines/VendingMachineContrabandWireAction.cs @@ -15,7 +15,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction public override StatusLightData? GetStatusLightData(Wire wire) { var lightState = StatusLightState.Off; - if (IsPowered(wire.Owner) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending)) + if (IsPowered(wire.Owner) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending)) { lightState = vending.Contraband ? StatusLightState.BlinkingSlow @@ -30,7 +30,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction public override void ToggleValue(EntityUid owner, bool setting) { - if (EntityManager.TryGetComponent(owner, out VendingMachineComponent vending)) + if (EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending)) { vending.Contraband = !setting; } @@ -38,6 +38,6 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction public override bool GetValue(EntityUid owner) { - return EntityManager.TryGetComponent(owner, out VendingMachineComponent vending) && !vending.Contraband; + return EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending) && !vending.Contraband; } } diff --git a/Content.Server/VendingMachines/VendingMachineEjectItemWireAction.cs b/Content.Server/VendingMachines/VendingMachineEjectItemWireAction.cs index b0c7e8cd51..69c95057c6 100644 --- a/Content.Server/VendingMachines/VendingMachineEjectItemWireAction.cs +++ b/Content.Server/VendingMachines/VendingMachineEjectItemWireAction.cs @@ -18,7 +18,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction var lightState = StatusLightState.Off; if (IsPowered(wire.Owner) - && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending)) + && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending)) { lightState = vending.CanShoot ? StatusLightState.BlinkingFast @@ -40,7 +40,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction public override bool Cut(EntityUid user, Wire wire) { - if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending)) + if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending)) { vending.CanShoot = true; } @@ -50,7 +50,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction public override bool Mend(EntityUid user, Wire wire) { - if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending)) + if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending)) { vending.CanShoot = false; } diff --git a/Content.Shared/Alert/AlertsSystem.cs b/Content.Shared/Alert/AlertsSystem.cs index d8b7fd93a9..a045eae0ae 100644 --- a/Content.Shared/Alert/AlertsSystem.cs +++ b/Content.Shared/Alert/AlertsSystem.cs @@ -15,14 +15,14 @@ public abstract class AlertsSystem : EntitySystem public IReadOnlyDictionary? GetActiveAlerts(EntityUid euid) { - return EntityManager.TryGetComponent(euid, out AlertsComponent comp) + return EntityManager.TryGetComponent(euid, out AlertsComponent? comp) ? comp.Alerts : null; } public bool IsShowingAlert(EntityUid euid, AlertType alertType) { - if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) + if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return false; if (TryGet(alertType, out var alert)) @@ -37,13 +37,13 @@ public abstract class AlertsSystem : EntitySystem /// true iff an alert of the indicated alert category is currently showing public bool IsShowingAlertCategory(EntityUid euid, AlertCategory alertCategory) { - return EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent) + return EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent) && alertsComponent.Alerts.ContainsKey(AlertKey.ForCategory(alertCategory)); } public bool TryGetAlertState(EntityUid euid, AlertKey key, out AlertState alertState) { - if (EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) + if (EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return alertsComponent.Alerts.TryGetValue(key, out alertState); alertState = default; @@ -62,7 +62,7 @@ public abstract class AlertsSystem : EntitySystem /// be erased if there is currently a cooldown for the alert) public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null) { - if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) + if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return; if (TryGet(alertType, out var alert)) @@ -100,7 +100,7 @@ public abstract class AlertsSystem : EntitySystem /// public void ClearAlertCategory(EntityUid euid, AlertCategory category) { - if(!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) + if(!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return; var key = AlertKey.ForCategory(category); @@ -119,7 +119,7 @@ public abstract class AlertsSystem : EntitySystem /// public void ClearAlert(EntityUid euid, AlertType alertType) { - if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) + if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent)) return; if (TryGet(alertType, out var alert)) diff --git a/Content.Shared/Camera/CameraRecoilSystem.cs b/Content.Shared/Camera/CameraRecoilSystem.cs index 3eb5e857be..97f1670843 100644 --- a/Content.Shared/Camera/CameraRecoilSystem.cs +++ b/Content.Shared/Camera/CameraRecoilSystem.cs @@ -88,7 +88,7 @@ public sealed class CameraRecoilSystem : EntitySystem private void HandleCameraKick(CameraKickEvent args) { - if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent recoil)) + if (!EntityManager.TryGetComponent(args.Euid, out CameraRecoilComponent? recoil)) { _log.Warning($"Received a kick for euid {args.Euid}, but it is missing required components."); return; diff --git a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs index 50d0c17344..47a0474e36 100644 --- a/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs +++ b/Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs @@ -165,7 +165,7 @@ namespace Content.Shared.Containers.ItemSlots if (args.Handled) return; - if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent hands)) + if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent? hands)) return; foreach (var slot in itemSlots.Slots.Values) diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 257088dbcb..757f5e7c24 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -44,7 +44,7 @@ namespace Content.Shared.Examine public bool IsInDetailsRange(EntityUid examiner, EntityUid entity) { // check if the mob is in ciritcal or dead - if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated()) + if (EntityManager.TryGetComponent(examiner, out MobStateComponent? mobState) && mobState.IsIncapacitated()) return false; if (!_interactionSystem.InRangeUnobstructed(examiner, entity, ExamineDetailsRange)) diff --git a/Content.Shared/Item/SharedItemComponent.cs b/Content.Shared/Item/SharedItemComponent.cs index 0a4f4296d2..ba0d353901 100644 --- a/Content.Shared/Item/SharedItemComponent.cs +++ b/Content.Shared/Item/SharedItemComponent.cs @@ -90,13 +90,13 @@ namespace Content.Shared.Item public void RemovedFromSlot() { - if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component)) + if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component)) component.Visible = true; } public virtual void EquippedToSlot() { - if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component)) + if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component)) component.Visible = false; } }