using System; using System.Collections.Generic; using Content.Shared.Research.Prototypes; using Robust.Shared.GameObjects; using Robust.Shared.GameStates; using Robust.Shared.IoC; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; namespace Content.Shared.Lathe { [ComponentReference(typeof(SharedLatheDatabaseComponent))] [NetworkedComponent()] public class SharedProtolatheDatabaseComponent : SharedLatheDatabaseComponent, ISerializationHooks { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [DataField("protolatherecipes", customTypeSerializer:typeof(PrototypeIdListSerializer))] private List _recipeIds = new(); /// /// A full list of recipes this protolathe can print. /// public IEnumerable ProtolatheRecipes { get { foreach (var id in _recipeIds) { yield return _prototypeManager.Index(id); } } } } [NetSerializable, Serializable] public class ProtolatheDatabaseState : ComponentState { public readonly List Recipes; public ProtolatheDatabaseState(List recipes) { Recipes = recipes; } } }