Generalized material spawning (#12489)

This commit is contained in:
Rane
2023-01-07 13:09:05 -05:00
committed by GitHub
parent f1cb0ca37a
commit fecd60e98a
13 changed files with 177 additions and 60 deletions

View File

@@ -1,8 +1,7 @@
using Content.Shared.Stacks;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Utility;
namespace Content.Shared.Materials
{
@@ -13,8 +12,6 @@ namespace Content.Shared.Materials
[Prototype("material")]
public sealed class MaterialPrototype : IPrototype, IInheritingPrototype
{
private string _name = string.Empty;
[ViewVariables]
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<MaterialPrototype>))]
public string[]? Parents { get; }
@@ -27,11 +24,16 @@ namespace Content.Shared.Materials
[IdDataFieldAttribute]
public string ID { get; } = default!;
[DataField("stack", customTypeSerializer:typeof(PrototypeIdSerializer<StackPrototype>))]
public string? StackId { get; } = null;
/// <summary>
/// For material storage to be able to convert back and forth
/// between the material and physical entities you can carry,
/// include which stack we should spawn by default.
/// </summary>
[DataField("stackEntity", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string StackEntity { get; } = "";
[DataField("name")]
public string Name { get; private set; } = "";
public string Name = "";
[DataField("color")]
public Color Color { get; } = Color.Gray;