Replace CanBeNull annotations with nullable reference types (#1270)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
@@ -32,12 +33,12 @@ namespace Content.Server.GameObjects.Components
|
||||
public class WiresComponent : SharedWiresComponent, IInteractUsing, IExamine, IMapInit
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IRobustRandom _random;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
#pragma warning restore 649
|
||||
private AudioSystem _audioSystem;
|
||||
private AppearanceComponent _appearance;
|
||||
private BoundUserInterface _userInterface;
|
||||
private AudioSystem _audioSystem = default!;
|
||||
private AppearanceComponent _appearance = default!;
|
||||
private BoundUserInterface _userInterface = default!;
|
||||
|
||||
private bool _isPanelOpen;
|
||||
|
||||
@@ -93,7 +94,7 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string SerialNumber
|
||||
public string? SerialNumber
|
||||
{
|
||||
get => _serialNumber;
|
||||
set
|
||||
@@ -127,16 +128,16 @@ namespace Content.Server.GameObjects.Components
|
||||
private readonly List<WireLetter> _availableLetters =
|
||||
new List<WireLetter>((WireLetter[]) Enum.GetValues(typeof(WireLetter)));
|
||||
|
||||
private string _boardName;
|
||||
private string _boardName = default!;
|
||||
|
||||
private string _serialNumber;
|
||||
private string? _serialNumber;
|
||||
|
||||
// Used to generate wire appearance randomization client side.
|
||||
// We honestly don't care what it is or such but do care that it doesn't change between UI re-opens.
|
||||
[ViewVariables]
|
||||
private int _wireSeed;
|
||||
[ViewVariables]
|
||||
private string _layoutId;
|
||||
private string? _layoutId;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -186,7 +187,7 @@ namespace Content.Server.GameObjects.Components
|
||||
base.Startup();
|
||||
|
||||
|
||||
WireLayout layout = null;
|
||||
WireLayout? layout = null;
|
||||
var hackingSystem = EntitySystem.Get<WireHackingSystem>();
|
||||
if (_layoutId != null)
|
||||
{
|
||||
@@ -299,9 +300,9 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[NotNull] private readonly WiresComponent _wires;
|
||||
[NotNull] private readonly IWires _owner;
|
||||
[CanBeNull] private readonly WireLayout _layout;
|
||||
private readonly WireLayout? _layout;
|
||||
|
||||
public WiresBuilder(WiresComponent wires, IWires owner, WireLayout layout)
|
||||
public WiresBuilder(WiresComponent wires, IWires owner, WireLayout? layout)
|
||||
{
|
||||
_wires = wires;
|
||||
_owner = owner;
|
||||
@@ -365,12 +366,12 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
case WiresActionMessage msg:
|
||||
var wire = WiresList.Find(x => x.Id == msg.Id);
|
||||
if (wire == null)
|
||||
var player = serverMsg.Session.AttachedEntity;
|
||||
if (wire == null || player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var player = serverMsg.Session.AttachedEntity;
|
||||
if (!player.TryGetComponent(out IHandsComponent handsComponent))
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner.Transform.GridPosition, player,
|
||||
@@ -386,7 +387,7 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
|
||||
var activeHandEntity = handsComponent.GetActiveHand?.Owner;
|
||||
ToolComponent tool = null;
|
||||
ToolComponent? tool = null;
|
||||
activeHandEntity?.TryGetComponent(out tool);
|
||||
|
||||
switch (msg.Action)
|
||||
|
||||
Reference in New Issue
Block a user