using SS14.Shared.GameObjects; using SS14.Shared.Serialization; using System; using System.Collections.Generic; namespace Content.Shared.GameObjects.Components.Storage { public abstract class SharedStorageComponent : Component { public sealed override string Name => "Storage"; public override uint? NetID => ContentNetIDs.INVENTORY; public override Type StateType => typeof(StorageComponentState); protected bool _open; /// public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); serializer.DataField(ref _open, "open", false); } } [Serializable, NetSerializable] public class StorageComponentState : ComponentState { public bool Open { get; } public StorageComponentState(bool open) : base(ContentNetIDs.INVENTORY) { Open = open; } } /// /// Updates the client component about what entities this storage is holding /// [Serializable, NetSerializable] public class StorageHeldItemsMessage : ComponentMessage { public readonly int StorageSizeMax; public readonly int StorageSizeUsed; public Dictionary StoredEntities; public StorageHeldItemsMessage(Dictionary storedentities, int storageused, int storagemaxsize) { Directed = true; StorageSizeMax = storagemaxsize; StorageSizeUsed = storageused; StoredEntities = storedentities; } } /// /// Component message for removing a contained entity from the storage entity /// [Serializable, NetSerializable] public class RemoveEntityMessage : ComponentMessage { public EntityUid EntityUid; public RemoveEntityMessage(EntityUid entityuid) { Directed = true; EntityUid = entityuid; } } /// /// Component message for opening the storage UI /// [Serializable, NetSerializable] public class OpenStorageUIMessage : ComponentMessage { public OpenStorageUIMessage() { Directed = true; } } /// /// Component message for closing the storage UI. /// E.g when the player moves too far away from the container. /// [Serializable, NetSerializable] public class CloseStorageUIMessage : ComponentMessage { public CloseStorageUIMessage() { Directed = true; } } }