2022-06-23 00:52:28 -04:00
|
|
|
using Content.Shared.Actions;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2019-08-14 10:49:28 +02:00
|
|
|
using Robust.Shared.Serialization;
|
2022-07-26 12:35:36 +12:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2019-08-14 10:49:28 +02:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.VendingMachines
|
2019-08-14 10:49:28 +02:00
|
|
|
{
|
2021-07-12 01:32:10 -07:00
|
|
|
[NetworkedComponent()]
|
2022-07-26 12:35:36 +12:00
|
|
|
public abstract class SharedVendingMachineComponent : Component
|
2019-08-14 10:49:28 +02:00
|
|
|
{
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// PrototypeID for the vending machine's inventory, see <see cref="VendingMachineInventoryPrototype"/>
|
|
|
|
|
/// </summary>
|
2022-07-26 12:35:36 +12:00
|
|
|
[DataField("pack", customTypeSerializer: typeof(PrototypeIdSerializer<VendingMachineInventoryPrototype>))]
|
|
|
|
|
public string PackPrototypeId = string.Empty;
|
|
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Used by the server to determine how long the vending machine stays in the "Deny" state.
|
|
|
|
|
/// Used by the client to determine how long the deny animation should be played.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("denyDelay")]
|
|
|
|
|
public float DenyDelay = 2.0f;
|
2022-07-26 12:35:36 +12:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Used by the server to determine how long the vending machine stays in the "Eject" state.
|
|
|
|
|
/// The selected item is dispensed afer this delay.
|
|
|
|
|
/// Used by the client to determine how long the deny animation should be played.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("ejectDelay")]
|
|
|
|
|
public float EjectDelay = 1.2f;
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[ViewVariables]
|
|
|
|
|
public Dictionary<string, VendingMachineInventoryEntry> Inventory = new();
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[ViewVariables]
|
|
|
|
|
public Dictionary<string, VendingMachineInventoryEntry> EmaggedInventory = new();
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[ViewVariables]
|
|
|
|
|
public Dictionary<string, VendingMachineInventoryEntry> ContrabandInventory = new();
|
2022-05-09 19:22:58 -07:00
|
|
|
|
|
|
|
|
public bool Emagged;
|
|
|
|
|
public bool Contraband;
|
2022-08-31 14:12:09 +02:00
|
|
|
}
|
2019-08-14 10:49:28 +02:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class VendingMachineInventoryEntry
|
|
|
|
|
{
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public InventoryType Type;
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public string ID;
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
public uint Amount;
|
|
|
|
|
public VendingMachineInventoryEntry(InventoryType type, string id, uint amount)
|
2019-08-14 10:49:28 +02:00
|
|
|
{
|
2022-08-31 14:12:09 +02:00
|
|
|
Type = type;
|
|
|
|
|
ID = id;
|
|
|
|
|
Amount = amount;
|
2019-08-14 10:49:28 +02:00
|
|
|
}
|
2022-08-31 14:12:09 +02:00
|
|
|
}
|
2019-08-14 10:49:28 +02:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum InventoryType : byte
|
|
|
|
|
{
|
|
|
|
|
Regular,
|
|
|
|
|
Emagged,
|
|
|
|
|
Contraband
|
|
|
|
|
}
|
2019-08-14 10:49:28 +02:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum VendingMachineVisuals
|
|
|
|
|
{
|
|
|
|
|
VisualState
|
|
|
|
|
}
|
2022-05-09 19:22:58 -07:00
|
|
|
|
2022-08-31 14:12:09 +02:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum VendingMachineVisualState
|
|
|
|
|
{
|
|
|
|
|
Normal,
|
|
|
|
|
Off,
|
|
|
|
|
Broken,
|
|
|
|
|
Eject,
|
|
|
|
|
Deny,
|
2022-05-09 19:22:58 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum ContrabandWireKey : byte
|
|
|
|
|
{
|
|
|
|
|
StatusKey,
|
|
|
|
|
TimeoutKey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum EjectWireKey : byte
|
|
|
|
|
{
|
|
|
|
|
StatusKey,
|
2019-08-14 10:49:28 +02:00
|
|
|
}
|
2022-06-23 00:52:28 -04:00
|
|
|
|
|
|
|
|
public sealed class VendingMachineSelfDispenseEvent : InstantActionEvent { };
|
2019-08-14 10:49:28 +02:00
|
|
|
}
|