using Content.Shared.Item; using Content.Shared.Storage.EntitySystems; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared.Storage { /// /// Handles generic storage with window, such as backpacks. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class StorageComponent : Component { public static string ContainerId = "storagebase"; // TODO: This fucking sucks [ViewVariables(VVAccess.ReadWrite), DataField("isOpen"), AutoNetworkedField] public bool IsUiOpen; [ViewVariables] public Container Container = default!; /// /// A limit for the cumulative ItemSize weights that can be inserted in this storage. /// If MaxSlots is not null, then this is ignored. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public int MaxTotalWeight; /// /// The maximum size item that can be inserted into this storage, /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] [Access(typeof(SharedStorageSystem))] public ProtoId? MaxItemSize; /// /// The max number of entities that can be inserted into this storage. /// [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public int? MaxSlots; // TODO: Make area insert its own component. [DataField("quickInsert")] public bool QuickInsert; // Can insert storables by "attacking" them with the storage entity [DataField("clickInsert")] public bool ClickInsert = true; // Can insert stuff by clicking the storage entity with it [DataField("areaInsert")] public bool AreaInsert; // "Attacking" with the storage entity causes it to insert all nearby storables after a delay [DataField("areaInsertRadius")] public int AreaInsertRadius = 1; /// /// Whitelist for entities that can go into the storage. /// [DataField("whitelist")] public EntityWhitelist? Whitelist; /// /// Blacklist for entities that can go into storage. /// [DataField("blacklist")] public EntityWhitelist? Blacklist; /// /// Sound played whenever an entity is inserted into storage. /// [DataField("storageInsertSound")] public SoundSpecifier? StorageInsertSound = new SoundCollectionSpecifier("storageRustle"); /// /// Sound played whenever an entity is removed from storage. /// [DataField("storageRemoveSound")] public SoundSpecifier? StorageRemoveSound; /// /// Sound played whenever the storage window is opened. /// [DataField("storageOpenSound")] public SoundSpecifier? StorageOpenSound = new SoundCollectionSpecifier("storageRustle"); /// /// Sound played whenever the storage window is closed. /// [DataField("storageCloseSound")] public SoundSpecifier? StorageCloseSound; [Serializable, NetSerializable] public sealed class StorageInsertItemMessage : BoundUserInterfaceMessage { } [Serializable, NetSerializable] public enum StorageUiKey { Key, } } [Serializable, NetSerializable] public sealed class StorageInteractWithItemEvent : BoundUserInterfaceMessage { public readonly NetEntity InteractedItemUID; public StorageInteractWithItemEvent(NetEntity interactedItemUID) { InteractedItemUID = interactedItemUID; } } /// /// Network event for displaying an animation of entities flying into a storage entity /// [Serializable, NetSerializable] public sealed class AnimateInsertingEntitiesEvent : EntityEventArgs { public readonly NetEntity Storage; public readonly List StoredEntities; public readonly List EntityPositions; public readonly List EntityAngles; public AnimateInsertingEntitiesEvent(NetEntity storage, List storedEntities, List entityPositions, List entityAngles) { Storage = storage; StoredEntities = storedEntities; EntityPositions = entityPositions; EntityAngles = entityAngles; } } [NetSerializable] [Serializable] public enum StorageVisuals : byte { Open, HasContents, CanLock, Locked, StorageUsed, Capacity } }