2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2021-02-03 22:07:13 +00:00
|
|
|
using Robust.Shared.Map;
|
2019-11-13 17:37:46 -05:00
|
|
|
using Robust.Shared.Serialization;
|
2018-04-22 06:11:38 -05:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Storage
|
2018-04-22 06:11:38 -05:00
|
|
|
{
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2022-05-03 23:00:22 -04:00
|
|
|
public abstract class SharedStorageComponent : Component
|
2018-04-22 06:11:38 -05:00
|
|
|
{
|
2022-04-28 06:11:15 -06:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class StorageBoundUserInterfaceState : BoundUserInterfaceState
|
|
|
|
|
{
|
|
|
|
|
public readonly List<EntityUid> StoredEntities;
|
|
|
|
|
public readonly int StorageSizeUsed;
|
|
|
|
|
public readonly int StorageCapacityMax;
|
|
|
|
|
|
|
|
|
|
public StorageBoundUserInterfaceState(List<EntityUid> storedEntities, int storageSizeUsed, int storageCapacityMax)
|
|
|
|
|
{
|
|
|
|
|
StoredEntities = storedEntities;
|
|
|
|
|
StorageSizeUsed = storageSizeUsed;
|
|
|
|
|
StorageCapacityMax = storageCapacityMax;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class StorageInsertItemMessage : BoundUserInterfaceMessage
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-05-20 15:56:43 +12:00
|
|
|
public sealed class StorageInteractWithItemEvent : BoundUserInterfaceMessage
|
2022-04-28 06:11:15 -06:00
|
|
|
{
|
|
|
|
|
public readonly EntityUid InteractedItemUID;
|
2022-05-20 15:56:43 +12:00
|
|
|
public StorageInteractWithItemEvent(EntityUid interactedItemUID)
|
2022-04-28 06:11:15 -06:00
|
|
|
{
|
|
|
|
|
InteractedItemUID = interactedItemUID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum StorageUiKey
|
|
|
|
|
{
|
|
|
|
|
Key,
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-08 17:32:32 +01:00
|
|
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
2021-12-04 12:59:44 +01:00
|
|
|
public abstract IReadOnlyList<EntityUid>? StoredEntities { get; }
|
2020-10-14 15:24:07 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Removes from the storage container and updates the stored value
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="entity">The entity to remove</param>
|
|
|
|
|
/// <returns>True if no longer in storage, false otherwise</returns>
|
2021-12-04 12:59:44 +01:00
|
|
|
public abstract bool Remove(EntityUid entity);
|
2020-10-14 15:24:07 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-03 22:07:13 +00:00
|
|
|
/// <summary>
|
2022-03-30 16:23:20 -07:00
|
|
|
/// Network event for displaying an animation of entities flying into a storage entity
|
2021-02-03 22:07:13 +00:00
|
|
|
/// </summary>
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-03-30 16:23:20 -07:00
|
|
|
public sealed class AnimateInsertingEntitiesEvent : EntityEventArgs
|
2021-02-03 22:07:13 +00:00
|
|
|
{
|
2022-03-30 16:23:20 -07:00
|
|
|
public readonly EntityUid Storage;
|
2021-02-03 22:07:13 +00:00
|
|
|
public readonly List<EntityUid> StoredEntities;
|
|
|
|
|
public readonly List<EntityCoordinates> EntityPositions;
|
2022-03-30 16:23:20 -07:00
|
|
|
|
|
|
|
|
public AnimateInsertingEntitiesEvent(EntityUid storage, List<EntityUid> storedEntities, List<EntityCoordinates> entityPositions)
|
2021-02-03 22:07:13 +00:00
|
|
|
{
|
2022-03-30 16:23:20 -07:00
|
|
|
Storage = storage;
|
2021-02-03 22:07:13 +00:00
|
|
|
StoredEntities = storedEntities;
|
|
|
|
|
EntityPositions = entityPositions;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-05 18:52:06 +02:00
|
|
|
[NetSerializable]
|
|
|
|
|
[Serializable]
|
2022-05-09 08:51:52 +03:00
|
|
|
public enum StorageVisuals : byte
|
2019-05-05 18:52:06 +02:00
|
|
|
{
|
2020-05-25 13:58:56 +02:00
|
|
|
Open,
|
2020-10-28 22:51:43 +00:00
|
|
|
CanLock,
|
2020-05-25 13:58:56 +02:00
|
|
|
Locked
|
2019-05-05 18:52:06 +02:00
|
|
|
}
|
2018-04-22 06:11:38 -05:00
|
|
|
}
|