Enable nullability in Content.Shared (#3626)

* Enable nullability in Content.Shared

* Fix null errors in server

* aye github i swear on me mom
This commit is contained in:
DrSmugleaf
2021-03-15 21:55:49 +01:00
committed by GitHub
parent 04201e944c
commit 6f012cb9ad
31 changed files with 167 additions and 117 deletions

View File

@@ -6,7 +6,6 @@ using Content.Client.GameObjects.EntitySystems;
using Content.Client.UserInterface;
using Content.Client.Utility;
using Content.Shared.Construction;
using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Interactable;
using Robust.Client.Graphics;
using Robust.Client.Placement;
@@ -18,7 +17,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Construction
{
@@ -224,15 +222,21 @@ namespace Content.Client.Construction
var startNode = graph.Nodes[prototype.StartNode];
var targetNode = graph.Nodes[prototype.TargetNode];
var path = graph.Path(startNode.Name, targetNode.Name);
if (!graph.TryPath(startNode.Name, targetNode.Name, out var path))
{
return;
}
var current = startNode;
var stepNumber = 1;
foreach (var node in path)
{
var edge = current.GetEdge(node.Name);
if (!current.TryGetEdge(node.Name, out var edge))
{
continue;
}
var firstNode = current == startNode;
if (firstNode)

View File

@@ -165,7 +165,7 @@ namespace Content.Client.GameObjects.Components.Atmos
TemperatureHelpers.KelvinToCelsius(state.Temperature))
});
// Return here cause all that stuff down there is gas stuff (so we don't get the seperators)
if (state.Gases.Length == 0)
if (state.Gases == null || state.Gases.Length == 0)
{
return;
}

View File

@@ -27,8 +27,13 @@ namespace Content.Client.GameObjects.Components.Construction
if (!_prototypeManager.TryIndex(Prototype.Graph, out ConstructionGraphPrototype? graph)) return;
var startNode = graph.Nodes[Prototype.StartNode];
var path = graph.Path(Prototype.StartNode, Prototype.TargetNode);
var edge = startNode.GetEdge(path[0].Name);
if (!graph.TryPath(Prototype.StartNode, Prototype.TargetNode, out var path) ||
!startNode.TryGetEdge(path[0].Name, out var edge))
{
return;
}
edge.Steps[0].DoExamine(message, inDetailsRange);
}
}

View File

@@ -20,6 +20,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using DrawDepth = Content.Shared.GameObjects.DrawDepth;
namespace Content.Client.GameObjects.EntitySystems
@@ -217,8 +218,11 @@ namespace Content.Client.GameObjects.EntitySystems
{
return false;
}
DebugTools.AssertNotNull(_dragger);
// still in range of the thing we are dragging?
if (!_interactionSystem.InRangeUnobstructed(_dragger, _dragDropHelper.Dragged))
if (!_interactionSystem.InRangeUnobstructed(_dragger!, _dragDropHelper.Dragged))
{
return false;
}