Missing nullables (#8634)

This commit is contained in:
Leon Friedrich
2022-06-04 19:17:48 +12:00
committed by GitHub
parent 31090b9c25
commit ca7960382b
59 changed files with 109 additions and 109 deletions

View File

@@ -149,7 +149,7 @@ namespace Content.Client.Actions.UI
private void UpdateItemIcon() private void UpdateItemIcon()
{ {
if (Action?.EntityIcon == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent sprite)) if (Action?.EntityIcon == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Action.EntityIcon.Value, out SpriteComponent? sprite))
{ {
_bigItemSpriteView.Visible = false; _bigItemSpriteView.Visible = false;
_bigItemSpriteView.Sprite = null; _bigItemSpriteView.Sprite = null;

View File

@@ -436,7 +436,7 @@ namespace Content.Client.Actions.UI
return; 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.Visible = false;
_bigItemSpriteView.Sprite = null; _bigItemSpriteView.Sprite = null;

View File

@@ -122,7 +122,7 @@ namespace Content.Client.Body.UI
public void BodyPartOnItemSelected(ItemListSelectedEventArgs args) public void BodyPartOnItemSelected(ItemListSelectedEventArgs args)
{ {
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
{ {
return; return;
} }

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Shared.CharacterInfo; using Content.Shared.CharacterInfo;
using Content.Shared.Objectives; using Content.Shared.Objectives;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
@@ -32,7 +32,7 @@ public sealed class CharacterInfoSystem : EntitySystem
private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args) private void OnCharacterInfoEvent(CharacterInfoEvent msg, EntitySessionEventArgs args)
{ {
if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent characterInfoComponent)) if (!EntityManager.TryGetComponent(msg.EntityUid, out CharacterInfoComponent? characterInfoComponent))
return; return;
UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives, msg.Briefing); UpdateUI(characterInfoComponent, msg.JobTitle, msg.Objectives, msg.Briefing);
@@ -41,7 +41,7 @@ public sealed class CharacterInfoSystem : EntitySystem
characterInfoComponent.Control.SpriteView.Sprite = spriteComponent; characterInfoComponent.Control.SpriteView.Sprite = spriteComponent;
} }
if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent metadata)) if (!EntityManager.TryGetComponent(msg.EntityUid, out MetaDataComponent? metadata))
return; return;
characterInfoComponent.Control.NameLabel.Text = metadata.EntityName; characterInfoComponent.Control.NameLabel.Text = metadata.EntityName;
} }

View File

@@ -505,7 +505,7 @@ namespace Content.Client.Damage
public override void OnChangeData(AppearanceComponent component) public override void OnChangeData(AppearanceComponent component)
{ {
var entities = _entityManager; var entities = _entityManager;
if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent damageData)) if (!entities.TryGetComponent(component.Owner, out DamageVisualizerDataComponent? damageData))
return; return;
if (!damageData.Valid) if (!damageData.Valid)
@@ -527,8 +527,8 @@ namespace Content.Client.Damage
private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData) private void HandleDamage(AppearanceComponent component, DamageVisualizerDataComponent damageData)
{ {
var entities = _entityManager; var entities = _entityManager;
if (!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent) if (!entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent)
|| !entities.TryGetComponent(component.Owner, out DamageableComponent damageComponent)) || !entities.TryGetComponent(component.Owner, out DamageableComponent? damageComponent))
return; return;
if (_targetLayers != null && _damageOverlayGroups != null) if (_targetLayers != null && _damageOverlayGroups != null)

View File

@@ -39,7 +39,7 @@ namespace Content.Client.Items.Managers
{ {
ISpriteComponent? sprite; ISpriteComponent? sprite;
if (_entityManager.TryGetComponent(entity, out HandVirtualItemComponent? virtPull) if (_entityManager.TryGetComponent(entity, out HandVirtualItemComponent? virtPull)
&& _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent pulledSprite)) && _entityManager.TryGetComponent(virtPull.BlockingEntity, out ISpriteComponent? pulledSprite))
{ {
sprite = pulledSprite; sprite = pulledSprite;
} }

View File

@@ -1,4 +1,4 @@
using Content.Client.Light.Components; using Content.Client.Light.Components;
using Content.Shared.Light.Component; using Content.Shared.Light.Component;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
@@ -19,7 +19,7 @@ namespace Content.Client.Light.Visualizers
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (component.TryGetData(ExpendableLightVisuals.Behavior, out string lightBehaviourID)) 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(); lightBehaviour.StopLightBehaviour();
@@ -27,7 +27,7 @@ namespace Content.Client.Light.Visualizers
{ {
lightBehaviour.StartLightBehaviour(lightBehaviourID); lightBehaviour.StartLightBehaviour(lightBehaviourID);
} }
else if (entities.TryGetComponent(component.Owner, out PointLightComponent light)) else if (entities.TryGetComponent(component.Owner, out PointLightComponent? light))
{ {
light.Enabled = false; light.Enabled = false;
} }
@@ -40,7 +40,7 @@ namespace Content.Client.Light.Visualizers
} }
if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state) if (component.TryGetData(ExpendableLightVisuals.State, out ExpendableLightState state)
&& entities.TryGetComponent(component.Owner, out ExpendableLightComponent expendableLight)) && entities.TryGetComponent(component.Owner, out ExpendableLightComponent? expendableLight))
{ {
switch (state) switch (state)
{ {

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Light.Visualizers
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
return; return;
// update sprite state // update sprite state

View File

@@ -21,7 +21,7 @@ namespace Content.Client.Nutrition.Visualizers
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
{ {
return; return;
} }

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Shared.Singularity.Components; using Content.Shared.Singularity.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -52,7 +52,7 @@ namespace Content.Client.ParticleAccelerator
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
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)) if (!component.TryGetData(ParticleAcceleratorVisuals.VisualState, out ParticleAcceleratorVisualState state))
{ {
state = ParticleAcceleratorVisualState.Unpowered; state = ParticleAcceleratorVisualState.Unpowered;

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
return; return;
// check if pinpointer screen is active // check if pinpointer screen is active

View File

@@ -1,4 +1,4 @@
using Content.Shared.PneumaticCannon; using Content.Shared.PneumaticCannon;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC; using Robust.Shared.IoC;
@@ -12,7 +12,7 @@ namespace Content.Client.PneumaticCannon
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite)) if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
return; return;
if (component.TryGetData(PneumaticCannonVisuals.Tank, out bool tank)) if (component.TryGetData(PneumaticCannonVisuals.Tank, out bool tank))

View File

@@ -259,7 +259,7 @@ namespace Content.Client.Popups
if (Entity == null) if (Entity == null)
screenCoords = _eyeManager.CoordinatesToScreen(InitialPos); 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) && xform.MapID == _eyeManager.CurrentMap)
screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates); screenCoords = _eyeManager.CoordinatesToScreen(xform.Coordinates);
else else

View File

@@ -1,4 +1,4 @@
using System; using System;
using Content.Shared.Singularity.Components; using Content.Shared.Singularity.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.Animations; using Robust.Client.Animations;
@@ -54,8 +54,8 @@ namespace Content.Client.Singularity.Visualizers
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite)) return; if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite)) return;
if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent animPlayer)) return; if (!entities.TryGetComponent(component.Owner, out AnimationPlayerComponent? animPlayer)) return;
if (!component.TryGetData(RadiationCollectorVisuals.VisualState, out RadiationCollectorVisualState state)) if (!component.TryGetData(RadiationCollectorVisuals.VisualState, out RadiationCollectorVisualState state))
{ {
state = RadiationCollectorVisualState.Deactive; state = RadiationCollectorVisualState.Deactive;

View File

@@ -102,7 +102,7 @@ namespace Content.Client.Stack
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent)) if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
{ {
if (_isComposite) if (_isComposite)
{ {

View File

@@ -1,4 +1,4 @@
using Content.Shared.Storage.Components; using Content.Shared.Storage.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -47,7 +47,7 @@ namespace Content.Client.Storage.Visualizers
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (_openIcon == null || if (_openIcon == null ||
!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent)) !entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent))
return; return;
if (!component.TryGetData<SharedBagState>(SharedBagOpenVisuals.BagState, out var bagState)) if (!component.TryGetData<SharedBagState>(SharedBagOpenVisuals.BagState, out var bagState))

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Shared.Storage.Components; using Content.Shared.Storage.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -32,7 +32,7 @@ namespace Content.Client.Storage.Visualizers
base.OnChangeData(component); base.OnChangeData(component);
var entities = IoCManager.Resolve<IEntityManager>(); var entities = IoCManager.Resolve<IEntityManager>();
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent)) if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
{ {
if (_spriteLayers.Count == 0) if (_spriteLayers.Count == 0)
{ {

View File

@@ -104,7 +104,7 @@ public sealed class SurveillanceCameraMonitorBoundUserInterface : BoundUserInter
_currentCamera = cast.ActiveCamera; _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); _window.UpdateState(eye.Eye, cast.Subnets, cast.ActiveAddress, cast.ActiveSubnet, cast.Cameras);
} }

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
{ {
shell.WriteLine($"Entity does not have any solutions."); shell.WriteLine($"Entity does not have any solutions.");
return; return;

View File

@@ -27,7 +27,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
{ {
shell.WriteLine($"Entity does not have any solutions."); shell.WriteLine($"Entity does not have any solutions.");
return; return;

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
{ {
shell.WriteLine($"Entity does not have any solutions."); shell.WriteLine($"Entity does not have any solutions.");
return; return;

View File

@@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
return; return;
} }
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent man)) if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(uid, out SolutionContainerManagerComponent? man))
{ {
shell.WriteLine($"Entity does not have any solutions."); shell.WriteLine($"Entity does not have any solutions.");
return; return;

View File

@@ -1,4 +1,4 @@
using System.Text.Json; using System.Text.Json;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
namespace Content.Server.Administration.Logs.Converters; namespace Content.Server.Administration.Logs.Converters;
@@ -14,7 +14,7 @@ public sealed class EntityUidConverter : AdminLogConverter<EntityUid>
writer.WriteNumber("id", (int) value); writer.WriteNumber("id", (int) value);
if (entities.TryGetComponent(value, out MetaDataComponent metaData)) if (entities.TryGetComponent(value, out MetaDataComponent? metaData))
{ {
writer.WriteString("name", metaData.EntityName); writer.WriteString("name", metaData.EntityName);
} }

View File

@@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click
{ {
var ps = EntitySystem.Get<SharedPullingSystem>(); var ps = EntitySystem.Get<SharedPullingSystem>();
var playerTarget = ps.GetPulled(player); var playerTarget = ps.GetPulled(player);
if (playerTarget != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget, out SharedPullableComponent playerPullable)) if (playerTarget != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable))
{ {
ps.TryStopPull(playerPullable); ps.TryStopPull(playerPullable);
} }

View File

@@ -52,7 +52,7 @@ namespace Content.Server.Atmos.EntitySystems
{ {
var otherFixture = args.OtherFixture.Body.Owner; var otherFixture = args.OtherFixture.Body.Owner;
if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent flammable)) if (!EntityManager.TryGetComponent(otherFixture, out FlammableComponent? flammable))
return; return;
flammable.FireStacks += component.FireStacks; flammable.FireStacks += component.FireStacks;

View File

@@ -95,7 +95,7 @@ namespace Content.Server.Atmos.Monitor
{ {
public override void Execute(EntityUid uid) public override void Execute(EntityUid uid)
{ {
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
return; return;
foreach (var (addr, device) in alarm.DeviceData) foreach (var (addr, device) in alarm.DeviceData)
@@ -110,7 +110,7 @@ namespace Content.Server.Atmos.Monitor
{ {
public override void Execute(EntityUid uid) public override void Execute(EntityUid uid)
{ {
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
return; return;
foreach (var (addr, device) in alarm.DeviceData) foreach (var (addr, device) in alarm.DeviceData)
@@ -132,7 +132,7 @@ namespace Content.Server.Atmos.Monitor
{ {
public override void Execute(EntityUid uid) public override void Execute(EntityUid uid)
{ {
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
return; return;
foreach (var (addr, device) in alarm.DeviceData) foreach (var (addr, device) in alarm.DeviceData)
@@ -154,7 +154,7 @@ namespace Content.Server.Atmos.Monitor
{ {
public override void Execute(EntityUid uid) public override void Execute(EntityUid uid)
{ {
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm)) if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm))
return; return;
foreach (var (addr, device) in alarm.DeviceData) foreach (var (addr, device) in alarm.DeviceData)
@@ -183,9 +183,9 @@ namespace Content.Server.Atmos.Monitor
public override void Execute(EntityUid uid) public override void Execute(EntityUid uid)
{ {
if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent alarm) if (!EntityManager.TryGetComponent(uid, out AirAlarmComponent? alarm)
|| !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) || !EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)) || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable))
return; return;
_devices = alarm.DeviceData; _devices = alarm.DeviceData;

View File

@@ -74,7 +74,7 @@ namespace Content.Server.Atmos.Monitor.Systems
/// <param name="data">The data to send to the device.</param> /// <param name="data">The data to send to the device.</param>
public void SetData(EntityUid uid, string address, IAtmosDeviceData data) 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) && !monitor.NetEnabled)
return; return;
@@ -93,7 +93,7 @@ namespace Content.Server.Atmos.Monitor.Systems
/// </summary> /// </summary>
public void SyncAllDevices(EntityUid uid) public void SyncAllDevices(EntityUid uid)
{ {
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
&& !monitor.NetEnabled) && !monitor.NetEnabled)
return; return;
@@ -111,7 +111,7 @@ namespace Content.Server.Atmos.Monitor.Systems
/// <param name="address">The address of the device.</param> /// <param name="address">The address of the device.</param>
public void SyncDevice(EntityUid uid, string address) public void SyncDevice(EntityUid uid, string address)
{ {
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
&& !monitor.NetEnabled) && !monitor.NetEnabled)
return; return;
@@ -130,7 +130,7 @@ namespace Content.Server.Atmos.Monitor.Systems
/// <param name="mode">The mode to sync with the rest of the network.</param> /// <param name="mode">The mode to sync with the rest of the network.</param>
public void SyncMode(EntityUid uid, AirAlarmMode mode) public void SyncMode(EntityUid uid, AirAlarmMode mode)
{ {
if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent monitor) if (EntityManager.TryGetComponent(uid, out AtmosMonitorComponent? monitor)
&& !monitor.NetEnabled) && !monitor.NetEnabled)
return; return;
@@ -196,7 +196,7 @@ namespace Content.Server.Atmos.Monitor.Systems
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
return; return;
if (EntityManager.TryGetComponent(uid, out WiresComponent wire) && wire.IsPanelOpen) if (EntityManager.TryGetComponent(uid, out WiresComponent? wire) && wire.IsPanelOpen)
{ {
args.Handled = false; args.Handled = false;
return; return;
@@ -227,7 +227,7 @@ namespace Content.Server.Atmos.Monitor.Systems
private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args) private void OnUpdateAlarmMode(EntityUid uid, AirAlarmComponent component, AirAlarmUpdateAlarmModeMessage args)
{ {
string addr = string.Empty; 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)) if (AccessCheck(uid, args.Session.AttachedEntity, component))
SetMode(uid, addr, args.Mode, true, false); SetMode(uid, addr, args.Mode, true, false);
else else
@@ -255,7 +255,7 @@ namespace Content.Server.Atmos.Monitor.Systems
if (!Resolve(uid, ref component)) if (!Resolve(uid, ref component))
return false; return false;
if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent reader) || user == null) if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent? reader) || user == null)
return false; return false;
if (!_accessSystem.IsAllowed(user.Value, reader)) if (!_accessSystem.IsAllowed(user.Value, reader))
@@ -276,7 +276,7 @@ namespace Content.Server.Atmos.Monitor.Systems
} }
string addr = string.Empty; 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) if (args.HighestNetworkType == AtmosMonitorAlarmType.Danger)

View File

@@ -17,7 +17,7 @@ namespace Content.Server.Atmos.Monitor.Systems
{ {
if (component.IgnoreAlarms) return; if (component.IgnoreAlarms) return;
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
return; return;
if (args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd) if (args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)

View File

@@ -156,7 +156,7 @@ namespace Content.Server.Atmos.Monitor.Systems
// the highest network alarm state at any time // the highest network alarm state at any time
if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd) if (!args.Data.TryGetValue(DeviceNetworkConstants.Command, out string? cmd)
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable) || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|| !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn)) || !EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn))
return; return;
// ignore packets from self, ignore from different frequency // 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 (state == AtmosMonitorAlarmType.Danger) PlayAlertSound(uid, monitor);
if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent alarmable) if (EntityManager.TryGetComponent(monitor.Owner, out AtmosAlarmableComponent? alarmable)
&& !alarmable.IgnoreAlarms) && !alarmable.IgnoreAlarms)
RaiseLocalEvent(monitor.Owner, new AtmosMonitorAlarmEvent(monitor.LastAlarmState, monitor.HighestAlarmInNetwork)); RaiseLocalEvent(monitor.Owner, new AtmosMonitorAlarmEvent(monitor.LastAlarmState, monitor.HighestAlarmInNetwork));
// TODO: Central system that grabs *all* alarms from wired network // TODO: Central system that grabs *all* alarms from wired network

View File

@@ -127,7 +127,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args) private void OnCanisterChangeReleaseValve(EntityUid uid, GasCanisterComponent canister, GasCanisterChangeReleaseValveMessage args)
{ {
var impact = LogImpact.High; 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)) && containerManager.TryGetContainer(canister.ContainerName, out var container))
impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High; impact = container.ContainedEntities.Count != 0 ? LogImpact.Medium : LogImpact.High;

View File

@@ -159,8 +159,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnPacketRecv(EntityUid uid, GasVentPumpComponent component, DeviceNetworkPacketEvent args) private void OnPacketRecv(EntityUid uid, GasVentPumpComponent component, DeviceNetworkPacketEvent args)
{ {
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn) if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable) || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|| !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd))
return; return;

View File

@@ -130,8 +130,8 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnPacketRecv(EntityUid uid, GasVentScrubberComponent component, DeviceNetworkPacketEvent args) private void OnPacketRecv(EntityUid uid, GasVentScrubberComponent component, DeviceNetworkPacketEvent args)
{ {
if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent netConn) if (!EntityManager.TryGetComponent(uid, out DeviceNetworkComponent? netConn)
|| !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable) || !EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable)
|| !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd)) || !args.Data.TryGetValue(DeviceNetworkConstants.Command, out var cmd))
return; return;

View File

@@ -1,4 +1,4 @@
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Ghost.Components; using Content.Server.Ghost.Components;
using Content.Server.Mind.Components; using Content.Server.Mind.Components;
using Content.Shared.Body.Components; using Content.Shared.Body.Components;
@@ -24,7 +24,7 @@ namespace Content.Server.Body.Systems
private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args) private void OnRemovedFromBody(EntityUid uid, BrainComponent component, RemovedFromBodyEvent args)
{ {
// This one needs to be special, okay? // This one needs to be special, okay?
if (!EntityManager.TryGetComponent(uid, out MechanismComponent mech)) if (!EntityManager.TryGetComponent(uid, out MechanismComponent? mech))
return; return;
HandleMind((mech.Part!).Owner, (args.Old).Owner); HandleMind((mech.Part!).Owner, (args.Old).Owner);

View File

@@ -314,7 +314,7 @@ namespace Content.Server.Buckle.Components
appearance.SetData(BuckleVisuals.Buckled, false); appearance.SetData(BuckleVisuals.Buckled, false);
if (_entMan.HasComponent<KnockedDownComponent>(Owner) if (_entMan.HasComponent<KnockedDownComponent>(Owner)
| _entMan.TryGetComponent<MobStateComponent>(Owner, out var mobState) && mobState.IsIncapacitated()) | (_entMan.TryGetComponent<MobStateComponent>(Owner, out var mobState) && mobState.IsIncapacitated()))
{ {
EntitySystem.Get<StandingStateSystem>().Down(Owner); EntitySystem.Get<StandingStateSystem>().Down(Owner);
} }

View File

@@ -73,7 +73,7 @@ namespace Content.Server.Chat
private void EnvironmentSuicideHandler(EntityUid victim, SuicideEvent suicideEvent) private void EnvironmentSuicideHandler(EntityUid victim, SuicideEvent suicideEvent)
{ {
// Suicide by held item // Suicide by held item
if (EntityManager.TryGetComponent(victim, out HandsComponent handsComponent) if (EntityManager.TryGetComponent(victim, out HandsComponent? handsComponent)
&& handsComponent.ActiveHandEntity is EntityUid item) && handsComponent.ActiveHandEntity is EntityUid item)
{ {
RaiseLocalEvent(item, suicideEvent, false); RaiseLocalEvent(item, suicideEvent, false);

View File

@@ -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. //Special case for reagent tanks, because normally clicking another container will give solution, not take it.
if (CanReceive && !_entities.HasComponent<RefillableSolutionComponent>(target) // target must not be refillable (e.g. Reagent Tanks) if (CanReceive && !_entities.HasComponent<RefillableSolutionComponent>(target) // target must not be refillable (e.g. Reagent Tanks)
&& solutionsSys.TryGetDrainableSolution(target, out var targetDrain) // target must be drainable && 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)) && solutionsSys.TryGetRefillableSolution(Owner, out var ownerRefill, refillable: refillComp))
{ {

View File

@@ -1,4 +1,4 @@
using Content.Server.Temperature.Components; using Content.Server.Temperature.Components;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
namespace Content.Server.Chemistry.ReagentEffectConditions namespace Content.Server.Chemistry.ReagentEffectConditions
@@ -16,7 +16,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
public float Max = float.MaxValue; public float Max = float.MaxValue;
public override bool Condition(ReagentEffectArgs args) 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) if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max)
return true; return true;

View File

@@ -1,4 +1,4 @@
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
@@ -14,7 +14,7 @@ namespace Content.Server.Chemistry.ReagentEffectConditions
public override bool Condition(ReagentEffectArgs args) 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; var total = damage.TotalDamage;
if (total > Min && total < Max) if (total > Min && total < Max)

View File

@@ -1,4 +1,4 @@
using Content.Server.Temperature.Components; using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems; using Content.Server.Temperature.Systems;
using Content.Shared.Chemistry.Reagent; using Content.Shared.Chemistry.Reagent;
@@ -11,7 +11,7 @@ namespace Content.Server.Chemistry.ReagentEffects
public override void Effect(ReagentEffectArgs args) 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<TemperatureSystem>(); var sys = args.EntityManager.EntitySysManager.GetEntitySystem<TemperatureSystem>();
sys.ChangeHeat(args.SolutionEntity, Amount, true, temp); sys.ChangeHeat(args.SolutionEntity, Amount, true, temp);

View File

@@ -40,7 +40,7 @@ namespace Content.Server.CombatMode
EntityUid? inTargetHand = null; EntityUid? inTargetHand = null;
if (EntityManager.TryGetComponent<HandsComponent>(args.Target, out HandsComponent targetHandsComponent) if (EntityManager.TryGetComponent<HandsComponent>(args.Target, out HandsComponent? targetHandsComponent)
&& targetHandsComponent.ActiveHand != null && targetHandsComponent.ActiveHand != null
&& !targetHandsComponent.ActiveHand.IsEmpty) && !targetHandsComponent.ActiveHand.IsEmpty)
{ {

View File

@@ -15,7 +15,7 @@ namespace Content.Server.Disease.Cures
public float Max = float.MaxValue; public float Max = float.MaxValue;
public override bool Cure(DiseaseEffectArgs args) 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 false;
return temp.CurrentTemperature > Min && temp.CurrentTemperature < float.MaxValue; return temp.CurrentTemperature > Min && temp.CurrentTemperature < float.MaxValue;

View File

@@ -65,7 +65,7 @@ namespace Content.Server.Doors.Systems
// Make firelocks autoclose, but only if the last alarm type it // Make firelocks autoclose, but only if the last alarm type it
// remembers was a danger. This is to prevent people from // remembers was a danger. This is to prevent people from
// flooding hallways with endless bad air/fire. // flooding hallways with endless bad air/fire.
if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent alarmable)) if (!EntityManager.TryGetComponent(uid, out AtmosAlarmableComponent? alarmable))
{ {
args.Cancel(); args.Cancel();
return; return;

View File

@@ -97,7 +97,7 @@ public sealed partial class ExplosionSystem : EntitySystem
if (!airtight.AirBlocked) if (!airtight.AirBlocked)
return; return;
if (!EntityManager.TryGetComponent(uid, out TransformComponent transform) || !transform.Anchored) if (!EntityManager.TryGetComponent(uid, out TransformComponent? transform) || !transform.Anchored)
return; return;
if (!_mapManager.TryGetGrid(transform.GridID, out var grid)) if (!_mapManager.TryGetGrid(transform.GridID, out var grid))

View File

@@ -57,7 +57,7 @@ namespace Content.Server.Fluids.EntitySystems
bool hasEvaporationComponent = EntityManager.TryGetComponent<EvaporationComponent>(uid, out var evaporationComponent); bool hasEvaporationComponent = EntityManager.TryGetComponent<EvaporationComponent>(uid, out var evaporationComponent);
bool canEvaporate = (hasEvaporationComponent && 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?" // "Does this puddle's sprite need changing to the wet floor effect sprite?"
bool changeToWetFloor = (puddleComponent.CurrentVolume <= puddleComponent.WetFloorEffectThreshold bool changeToWetFloor = (puddleComponent.CurrentVolume <= puddleComponent.WetFloorEffectThreshold

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Labels
{ {
_itemSlotsSystem.AddItemSlot(uid, component.Name, component.LabelSlot); _itemSlotsSystem.AddItemSlot(uid, component.Name, component.LabelSlot);
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PaperLabelVisuals.HasLabel, false); appearance.SetData(PaperLabelVisuals.HasLabel, false);
@@ -68,7 +68,7 @@ namespace Content.Server.Labels
return; 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. // Assuming yaml has the correct entity whitelist, this should not happen.
return; return;
@@ -90,7 +90,7 @@ namespace Content.Server.Labels
if (args.Container.ID != label.LabelSlot.ID) if (args.Container.ID != label.LabelSlot.ID)
return; return;
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent appearance)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem); appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem);

View File

@@ -1,4 +1,4 @@
using Content.Server.Access.Systems; using Content.Server.Access.Systems;
using Content.Server.Administration; using Content.Server.Administration;
using Content.Server.Administration.Systems; using Content.Server.Administration.Systems;
using Content.Server.Cloning; using Content.Server.Cloning;
@@ -47,7 +47,7 @@ public sealed class RenameCommand : IConsoleCommand
var entSysMan = IoCManager.Resolve<IEntitySystemManager>(); var entSysMan = IoCManager.Resolve<IEntitySystemManager>();
if (entMan.TryGetComponent(entityUid, out MindComponent mind) && mind.Mind != null) if (entMan.TryGetComponent(entityUid, out MindComponent? mind) && mind.Mind != null)
{ {
// Mind // Mind
mind.Mind.CharacterName = name; mind.Mind.CharacterName = name;

View File

@@ -58,7 +58,7 @@ namespace Content.Server.Morgue.Components
if (Open) if (Open)
CloseStorage(); CloseStorage();
if(_entities.TryGetComponent(Owner, out AppearanceComponent appearanceComponent)) if(_entities.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
appearanceComponent.SetData(CrematoriumVisuals.Burning, true); appearanceComponent.SetData(CrematoriumVisuals.Burning, true);
Cooking = true; Cooking = true;

View File

@@ -284,7 +284,7 @@ namespace Content.Server.Nuke
return; return;
var anchored = false; var anchored = false;
if (EntityManager.TryGetComponent(uid, out TransformComponent transform)) if (EntityManager.TryGetComponent(uid, out TransformComponent? transform))
anchored = transform.Anchored; anchored = transform.Anchored;
var allowArm = component.DiskSlot.HasItem && var allowArm = component.DiskSlot.HasItem &&

View File

@@ -358,7 +358,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (args.Cancelled) if (args.Cancelled)
return; return;
IngestionBlockerComponent blocker; IngestionBlockerComponent? blocker;
if (_inventorySystem.TryGetSlotEntity(uid, "mask", out var maskUid) && if (_inventorySystem.TryGetSlotEntity(uid, "mask", out var maskUid) &&
EntityManager.TryGetComponent(maskUid, out blocker) && EntityManager.TryGetComponent(maskUid, out blocker) &&

View File

@@ -38,7 +38,7 @@ namespace Content.Server.Nutrition.EntitySystems
private bool TryUseUtensil(EntityUid user, EntityUid target, UtensilComponent component) 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; return false;
//Prevents food usage with a wrong utensil //Prevents food usage with a wrong utensil

View File

@@ -1,4 +1,4 @@
using System.Linq; using System.Linq;
using Content.Server.Mind.Components; using Content.Server.Mind.Components;
using Content.Server.Objectives.Interfaces; using Content.Server.Objectives.Interfaces;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
@@ -21,7 +21,7 @@ namespace Content.Server.Objectives.Conditions
if (entity == default) if (entity == default)
return false; return false;
return entityMgr.TryGetComponent(entity, out MobStateComponent mobState) && return entityMgr.TryGetComponent(entity, out MobStateComponent? mobState) &&
mobState.IsAlive() && mobState.IsAlive() &&
mc.Mind != mind; mc.Mind != mind;
}).Select(mc => mc.Mind).ToList(); }).Select(mc => mc.Mind).ToList();

View File

@@ -60,7 +60,7 @@ namespace Content.Server.Power.EntitySystems
private void OnReceiverConnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverConnectedEvent args) 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); provider.AddReceiver(receiver);
} }
@@ -68,7 +68,7 @@ namespace Content.Server.Power.EntitySystems
private void OnReceiverDisconnected(EntityUid uid, ApcPowerProviderComponent provider, ExtensionCableSystem.ReceiverDisconnectedEvent args) 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); provider.RemoveReceiver(receiver);
} }

View File

@@ -15,7 +15,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
public override StatusLightData? GetStatusLightData(Wire wire) public override StatusLightData? GetStatusLightData(Wire wire)
{ {
var lightState = StatusLightState.Off; 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 lightState = vending.Contraband
? StatusLightState.BlinkingSlow ? StatusLightState.BlinkingSlow
@@ -30,7 +30,7 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
public override void ToggleValue(EntityUid owner, bool setting) 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; vending.Contraband = !setting;
} }
@@ -38,6 +38,6 @@ public sealed class VendingMachineContrabandWireAction : BaseToggleWireAction
public override bool GetValue(EntityUid owner) public override bool GetValue(EntityUid owner)
{ {
return EntityManager.TryGetComponent(owner, out VendingMachineComponent vending) && !vending.Contraband; return EntityManager.TryGetComponent(owner, out VendingMachineComponent? vending) && !vending.Contraband;
} }
} }

View File

@@ -18,7 +18,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
var lightState = StatusLightState.Off; var lightState = StatusLightState.Off;
if (IsPowered(wire.Owner) if (IsPowered(wire.Owner)
&& EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent vending)) && EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
{ {
lightState = vending.CanShoot lightState = vending.CanShoot
? StatusLightState.BlinkingFast ? StatusLightState.BlinkingFast
@@ -40,7 +40,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
public override bool Cut(EntityUid user, Wire wire) 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; vending.CanShoot = true;
} }
@@ -50,7 +50,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
public override bool Mend(EntityUid user, Wire wire) 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; vending.CanShoot = false;
} }

View File

@@ -15,14 +15,14 @@ public abstract class AlertsSystem : EntitySystem
public IReadOnlyDictionary<AlertKey, AlertState>? GetActiveAlerts(EntityUid euid) public IReadOnlyDictionary<AlertKey, AlertState>? GetActiveAlerts(EntityUid euid)
{ {
return EntityManager.TryGetComponent(euid, out AlertsComponent comp) return EntityManager.TryGetComponent(euid, out AlertsComponent? comp)
? comp.Alerts ? comp.Alerts
: null; : null;
} }
public bool IsShowingAlert(EntityUid euid, AlertType alertType) public bool IsShowingAlert(EntityUid euid, AlertType alertType)
{ {
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
return false; return false;
if (TryGet(alertType, out var alert)) if (TryGet(alertType, out var alert))
@@ -37,13 +37,13 @@ public abstract class AlertsSystem : EntitySystem
/// <returns>true iff an alert of the indicated alert category is currently showing</returns> /// <returns>true iff an alert of the indicated alert category is currently showing</returns>
public bool IsShowingAlertCategory(EntityUid euid, AlertCategory alertCategory) 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)); && alertsComponent.Alerts.ContainsKey(AlertKey.ForCategory(alertCategory));
} }
public bool TryGetAlertState(EntityUid euid, AlertKey key, out AlertState alertState) 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); return alertsComponent.Alerts.TryGetValue(key, out alertState);
alertState = default; alertState = default;
@@ -62,7 +62,7 @@ public abstract class AlertsSystem : EntitySystem
/// be erased if there is currently a cooldown for the alert)</param> /// be erased if there is currently a cooldown for the alert)</param>
public void ShowAlert(EntityUid euid, AlertType alertType, short? severity = null, (TimeSpan, TimeSpan)? cooldown = null) 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; return;
if (TryGet(alertType, out var alert)) if (TryGet(alertType, out var alert))
@@ -100,7 +100,7 @@ public abstract class AlertsSystem : EntitySystem
/// </summary> /// </summary>
public void ClearAlertCategory(EntityUid euid, AlertCategory category) public void ClearAlertCategory(EntityUid euid, AlertCategory category)
{ {
if(!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) if(!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
return; return;
var key = AlertKey.ForCategory(category); var key = AlertKey.ForCategory(category);
@@ -119,7 +119,7 @@ public abstract class AlertsSystem : EntitySystem
/// </summary> /// </summary>
public void ClearAlert(EntityUid euid, AlertType alertType) public void ClearAlert(EntityUid euid, AlertType alertType)
{ {
if (!EntityManager.TryGetComponent(euid, out AlertsComponent alertsComponent)) if (!EntityManager.TryGetComponent(euid, out AlertsComponent? alertsComponent))
return; return;
if (TryGet(alertType, out var alert)) if (TryGet(alertType, out var alert))

View File

@@ -88,7 +88,7 @@ public sealed class CameraRecoilSystem : EntitySystem
private void HandleCameraKick(CameraKickEvent args) 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."); _log.Warning($"Received a kick for euid {args.Euid}, but it is missing required components.");
return; return;

View File

@@ -165,7 +165,7 @@ namespace Content.Shared.Containers.ItemSlots
if (args.Handled) if (args.Handled)
return; return;
if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent hands)) if (!EntityManager.TryGetComponent(args.User, out SharedHandsComponent? hands))
return; return;
foreach (var slot in itemSlots.Slots.Values) foreach (var slot in itemSlots.Slots.Values)

View File

@@ -44,7 +44,7 @@ namespace Content.Shared.Examine
public bool IsInDetailsRange(EntityUid examiner, EntityUid entity) public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
{ {
// check if the mob is in ciritcal or dead // 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; return false;
if (!_interactionSystem.InRangeUnobstructed(examiner, entity, ExamineDetailsRange)) if (!_interactionSystem.InRangeUnobstructed(examiner, entity, ExamineDetailsRange))

View File

@@ -90,13 +90,13 @@ namespace Content.Shared.Item
public void RemovedFromSlot() public void RemovedFromSlot()
{ {
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component)) if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
component.Visible = true; component.Visible = true;
} }
public virtual void EquippedToSlot() public virtual void EquippedToSlot()
{ {
if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent component)) if (_entMan.TryGetComponent(Owner, out SharedSpriteComponent? component))
component.Visible = false; component.Visible = false;
} }
} }