Files
tbd-station-14/Content.Shared/Construction/NestedConstructionGraphStep.cs
DrSmugleaf 5c0cf1b1a0 Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2020-11-27 21:00:49 +11:00

42 lines
1.3 KiB
C#

using System.Collections.Generic;
using System.IO;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.Construction
{
public class NestedConstructionGraphStep : ConstructionGraphStep
{
public List<List<ConstructionGraphStep>> Steps { get; private set; } = new();
public void LoadFrom(YamlMappingNode mapping)
{
if (!mapping.TryGetNode("steps", out YamlSequenceNode steps)) return;
foreach (var node in steps)
{
var sequence = (YamlSequenceNode) node;
var list = new List<ConstructionGraphStep>();
foreach (var innerNode in sequence)
{
var stepNode = (YamlMappingNode) innerNode;
var step = ConstructionGraphEdge.LoadStep(stepNode);
if(step is NestedConstructionGraphStep)
throw new InvalidDataException("Can't have nested construction steps inside nested construction steps!");
list.Add(step);
}
Steps.Add(list);
}
}
public override void DoExamine(FormattedMessage message, bool inDetailsRange)
{
}
}
}