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

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);

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.
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))
{

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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))

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 &&

View File

@@ -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) &&

View File

@@ -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

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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;
}
}

View File

@@ -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;
}