Vending machine changes (#8060)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Flipp Syder
2022-05-09 19:22:58 -07:00
committed by GitHub
parent 8257635811
commit 8f223586d4
12 changed files with 240 additions and 57 deletions

View File

@@ -11,8 +11,25 @@ namespace Content.Shared.VendingMachines
[NetworkedComponent()]
public class SharedVendingMachineComponent : Component
{
[ViewVariables]
public List<VendingMachineInventoryEntry> Inventory = new();
[ViewVariables] public List<VendingMachineInventoryEntry> Inventory = new();
[ViewVariables] public List<VendingMachineInventoryEntry> EmaggedInventory = new();
[ViewVariables] public List<VendingMachineInventoryEntry> ContrabandInventory = new();
public List<VendingMachineInventoryEntry> AllInventory
{
get
{
var inventory = new List<VendingMachineInventoryEntry>(Inventory);
if (Emagged) inventory.AddRange(EmaggedInventory);
if (Contraband) inventory.AddRange(ContrabandInventory);
return inventory;
}
}
public bool Emagged;
public bool Contraband;
[Serializable, NetSerializable]
public enum VendingMachineVisuals
@@ -33,9 +50,11 @@ namespace Content.Shared.VendingMachines
[Serializable, NetSerializable]
public sealed class VendingMachineEjectMessage : BoundUserInterfaceMessage
{
public readonly InventoryType Type;
public readonly string ID;
public VendingMachineEjectMessage(string id)
public VendingMachineEjectMessage(InventoryType type, string id)
{
Type = type;
ID = id;
}
}
@@ -64,12 +83,14 @@ namespace Content.Shared.VendingMachines
[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(string id, uint amount)
public VendingMachineInventoryEntry(InventoryType type, string id, uint amount)
{
Type = type;
ID = id;
Amount = amount;
}
@@ -82,5 +103,26 @@ namespace Content.Shared.VendingMachines
Advertisement,
Limiter
}
[Serializable, NetSerializable]
public enum InventoryType : byte
{
Regular,
Emagged,
Contraband
}
}
[Serializable, NetSerializable]
public enum ContrabandWireKey : byte
{
StatusKey,
TimeoutKey
}
[Serializable, NetSerializable]
public enum EjectWireKey : byte
{
StatusKey,
}
}