Missing nullables (#8634)
This commit is contained in:
@@ -149,7 +149,7 @@ namespace Content.Client.Actions.UI
|
||||
|
||||
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.Sprite = null;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Content.Client.Body.UI
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<IEntityManager>();
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.Light.Visualizers
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
// update sprite state
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Client.Nutrition.Visualizers
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out ISpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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<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))
|
||||
{
|
||||
state = ParticleAcceleratorVisualState.Unpowered;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent sprite))
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
return;
|
||||
|
||||
// check if pinpointer screen is active
|
||||
|
||||
@@ -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<IEntityManager>();
|
||||
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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<IEntityManager>();
|
||||
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;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Content.Client.Stack
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent))
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
|
||||
{
|
||||
if (_isComposite)
|
||||
{
|
||||
|
||||
@@ -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<IEntityManager>();
|
||||
|
||||
if (_openIcon == null ||
|
||||
!entities.TryGetComponent(component.Owner, out SpriteComponent spriteComponent))
|
||||
!entities.TryGetComponent(component.Owner, out SpriteComponent? spriteComponent))
|
||||
return;
|
||||
|
||||
if (!component.TryGetData<SharedBagState>(SharedBagOpenVisuals.BagState, out var bagState))
|
||||
|
||||
@@ -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<IEntityManager>();
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent spriteComponent))
|
||||
if (entities.TryGetComponent(component.Owner, out ISpriteComponent? spriteComponent))
|
||||
{
|
||||
if (_spriteLayers.Count == 0)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
|
||||
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.");
|
||||
return;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Administration.Commands
|
||||
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.");
|
||||
return;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
||||
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.");
|
||||
return;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Server.Administration.Commands
|
||||
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.");
|
||||
return;
|
||||
|
||||
@@ -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<EntityUid>
|
||||
|
||||
writer.WriteNumber("id", (int) value);
|
||||
|
||||
if (entities.TryGetComponent(value, out MetaDataComponent metaData))
|
||||
if (entities.TryGetComponent(value, out MetaDataComponent? metaData))
|
||||
{
|
||||
writer.WriteString("name", metaData.EntityName);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.Alert.Click
|
||||
{
|
||||
var ps = EntitySystem.Get<SharedPullingSystem>();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Content.Server.Atmos.Monitor.Systems
|
||||
/// <param name="data">The data to send to the device.</param>
|
||||
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
|
||||
/// </summary>
|
||||
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
|
||||
/// <param name="address">The address of the device.</param>
|
||||
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
|
||||
/// <param name="mode">The mode to sync with the rest of the network.</param>
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Content.Server.Buckle.Components
|
||||
appearance.SetData(BuckleVisuals.Buckled, false);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<RefillableSolutionComponent>(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))
|
||||
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<TemperatureSystem>();
|
||||
sys.ChangeHeat(args.SolutionEntity, Amount, true, temp);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Server.CombatMode
|
||||
|
||||
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.IsEmpty)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Fluids.EntitySystems
|
||||
|
||||
bool hasEvaporationComponent = EntityManager.TryGetComponent<EvaporationComponent>(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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<IEntitySystemManager>();
|
||||
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ public abstract class AlertsSystem : EntitySystem
|
||||
|
||||
public IReadOnlyDictionary<AlertKey, AlertState>? 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
|
||||
/// <returns>true iff an alert of the indicated alert category is currently showing</returns>
|
||||
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)</param>
|
||||
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
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user