Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -6,8 +6,6 @@ using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -29,7 +27,9 @@ namespace Content.Server.GameObjects.Components.Items.RCD
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
{
if (eventArgs.Target == null || !eventArgs.Target.TryGetComponent(out RCDComponent rcdComponent) || !eventArgs.User.TryGetComponent(out IHandsComponent hands))
if (eventArgs.Target == null ||
!eventArgs.Target.TryGetComponent(out RCDComponent? rcdComponent) ||
!eventArgs.User.TryGetComponent(out IHandsComponent? hands))
{
return false;
}

View File

@@ -13,8 +13,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -35,8 +33,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
[ViewVariables(VVAccess.ReadWrite)] [DataField("maxAmmo")] public int maxAmmo = 5;
public int _ammo; //How much "ammo" we have left. You can refill this with RCD ammo.
[ViewVariables(VVAccess.ReadWrite)] [DataField("delay")] private float _delay = 2f;
private DoAfterSystem doAfterSystem;
private DoAfterSystem doAfterSystem = default!;
///Enum to store the different mode states for clarity.
private enum RcdMode
@@ -135,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
}
else //Delete what the user targeted
{
eventArgs.Target.Delete();
eventArgs.Target?.Delete();
}
break;
//Walls are a special behaviour, and require us to build a new object with a transform rather than setting a grid tile, thus we early return to avoid the tile set code.
@@ -201,7 +198,7 @@ namespace Content.Server.GameObjects.Components.Items.RCD
return false;
}
//They tried to decon a non-turf but it's not in the whitelist
if (eventArgs.Target != null && !eventArgs.Target.TryGetComponent(out RCDDeconstructWhitelist rcd_decon))
if (eventArgs.Target != null && !eventArgs.Target.TryGetComponent(out RCDDeconstructWhitelist? deCon))
{
Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't deconstruct that!"));
return false;