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:
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -12,12 +12,13 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
[DataField("actions", serverOnly: true)]
|
||||
private List<IGraphAction> _actions = new();
|
||||
|
||||
[DataField("edges")]
|
||||
private List<ConstructionGraphEdge> _edges = new();
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("node")]
|
||||
public string Name { get; private set; }
|
||||
[DataField("node", required: true)]
|
||||
public string Name { get; private set; } = default!;
|
||||
|
||||
[ViewVariables]
|
||||
public IReadOnlyList<ConstructionGraphEdge> Edges => _edges;
|
||||
@@ -27,9 +28,9 @@ namespace Content.Shared.Construction
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("entity")]
|
||||
public string Entity { get; private set; }
|
||||
public string? Entity { get; private set; }
|
||||
|
||||
public ConstructionGraphEdge GetEdge(string target)
|
||||
public ConstructionGraphEdge? GetEdge(string target)
|
||||
{
|
||||
foreach (var edge in _edges)
|
||||
{
|
||||
@@ -39,5 +40,10 @@ namespace Content.Shared.Construction
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool TryGetEdge(string target, [NotNullWhen(true)] out ConstructionGraphEdge? edge)
|
||||
{
|
||||
return (edge = GetEdge(target)) != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user