Files
tbd-station-14/Content.Shared/Stacks/StackPrototype.cs
DrSmugleaf fdcbece63d Refactor stacks to use prototypes (#3387)
* Refactor stacks to use prototypes

* Fix not assigned warning

* Add names to stacks

* Make machine baords and material constructions use the name as well

* Remove defaulting stacks to prototype id

* Fix tests

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2021-02-25 16:18:29 +11:00

34 lines
1.0 KiB
C#

#nullable enable
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.Stacks
{
[Prototype("stack")]
public class StackPrototype : IPrototype
{
public string ID { get; private set; } = string.Empty;
public string Name { get; private set; } = string.Empty;
public SpriteSpecifier? Icon { get; private set; }
/// <summary>
/// The entity id that will be spawned by default from this stack.
/// </summary>
public string? Spawn { get; private set; }
public void LoadFrom(YamlMappingNode mapping)
{
var reader = YamlObjectSerializer.NewReader(mapping);
reader.DataField(this, x => x.ID, "id", string.Empty);
reader.DataField(this, x => x.Name, "name", string.Empty);
reader.DataField(this, x => x.Icon, "icon", null);
reader.DataField(this, x => x.Spawn, "spawn", null);
}
}
}