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,3 +1,4 @@
#nullable enable
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -29,7 +30,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
private INodeGroup _nodeGroup = BaseNodeGroup.NullGroup;
[ViewVariables]
public IEntity Owner { get; private set; }
public IEntity Owner { get; private set; } = default!;
[ViewVariables]
private bool _needsGroup = true;
@@ -46,8 +47,6 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
/// </summary>
private bool _deleting = false;
private INodeGroupFactory _nodeGroupFactory;
public virtual void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.NodeGroupID, "nodeGroupID", NodeGroupID.Default);
@@ -56,7 +55,6 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
public virtual void Initialize(IEntity owner)
{
Owner = owner;
_nodeGroupFactory = IoCManager.Resolve<INodeGroupFactory>();
}
public void OnContainerStartup()
@@ -163,7 +161,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.Nodes
private INodeGroup MakeNewGroup()
{
return _nodeGroupFactory.MakeNodeGroup(this);
return IoCManager.Resolve<INodeGroupFactory>().MakeNodeGroup(this);
}
}
}