Node and NodeGroup nullability (#3047)

Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
py01
2021-01-28 20:21:08 -06:00
committed by GitHub
parent 4bf61770e1
commit c80efdaf44
7 changed files with 16 additions and 14 deletions

View File

@@ -1,6 +1,5 @@
using System;
#nullable enable
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Content.Server.GameObjects.Components.Power;
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
@@ -58,7 +57,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
public void AddApc(ApcComponent apc)
{
if (!apc.Owner.TryGetComponent(out BatteryComponent battery))
if (!apc.Owner.TryGetComponent<BatteryComponent>(out var battery))
{
return;
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.Components.Power;

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Generic;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Robust.Shared.IoC;
using Robust.Shared.Map;

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Generic;
using Content.Server.Atmos;
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Server.GameObjects.EntitySystems;
@@ -27,9 +28,9 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
[ViewVariables]
private readonly List<PipeNode> _pipes = new();
[ViewVariables] private AtmosphereSystem _atmosphereSystem;
[ViewVariables] private AtmosphereSystem? _atmosphereSystem;
[ViewVariables] private IGridAtmosphereComponent GridAtmos => _atmosphereSystem.GetGridAtmosphere(GridId);
[ViewVariables] private IGridAtmosphereComponent? GridAtmos => _atmosphereSystem?.GetGridAtmosphere(GridId);
public override void Initialize(Node sourceNode)
{

View File

@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Content.Server.GameObjects.Components.Power.PowerNetComponents;