using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; namespace Content.Shared.Materials; [Access(typeof(SharedMaterialStorageSystem))] [RegisterComponent, NetworkedComponent] public sealed class MaterialStorageComponent : Component { [DataField("storage", customTypeSerializer: typeof(PrototypeIdDictionarySerializer))] public Dictionary Storage { get; set; } = new(); /// /// How much material the storage can store in total. /// [ViewVariables(VVAccess.ReadWrite), DataField("storageLimit")] public int? StorageLimit; /// /// Whitelist for specifying the kind of items that can be insert into this entity. /// [DataField("whitelist")] public EntityWhitelist? EntityWhitelist; /// /// Whether or not to drop contained materials when deconstructed. /// [DataField("dropOnDeconstruct")] public bool DropOnDeconstruct = true; /// /// Whitelist generated on runtime for what specific materials can be inserted into this entity. /// [DataField("materialWhiteList", customTypeSerializer: typeof(PrototypeIdListSerializer))] public List? MaterialWhiteList; /// /// The sound that plays when inserting an item into the storage /// [DataField("insertingSound")] public SoundSpecifier? InsertingSound; } /// /// event raised on the materialStorage when a material entity is inserted into it. /// public readonly struct MaterialEntityInsertedEvent { public readonly MaterialComponent MaterialComp; public MaterialEntityInsertedEvent(MaterialComponent materials) { MaterialComp = materials; } } /// /// Event raised when a material amount is changed /// public readonly struct MaterialAmountChangedEvent { } public sealed class GetMaterialWhitelistEvent : EntityEventArgs { public readonly EntityUid Storage; public List Whitelist = new(); public GetMaterialWhitelistEvent(EntityUid storage) { Storage = storage; } } [Serializable, NetSerializable] public sealed class MaterialStorageComponentState : ComponentState { public Dictionary Storage; public List? MaterialWhitelist; public MaterialStorageComponentState(Dictionary storage, List? materialWhitelist) { Storage = storage; MaterialWhitelist = materialWhitelist; } }