Add supplies to restock vending machines. (#11506)

This commit is contained in:
Vordenburg
2023-01-01 18:42:56 -05:00
committed by GitHub
parent d9be09b034
commit 5553976d70
43 changed files with 1625 additions and 15 deletions

View File

@@ -0,0 +1,42 @@
using System.Threading;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
using Content.Shared.VendingMachines;
namespace Content.Server.VendingMachines.Restock
{
[RegisterComponent]
public sealed class VendingMachineRestockComponent : Component
{
public CancellationTokenSource? CancelToken;
/// <summary>
/// The time (in seconds) that it takes to restock a machine.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("restockDelay")]
public TimeSpan RestockDelay = TimeSpan.FromSeconds(8.0f);
/// <summary>
/// What sort of machine inventory does this restock?
/// This is checked against the VendingMachineComponent's pack value.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("canRestock", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<VendingMachineInventoryPrototype>))]
public HashSet<string> CanRestock = new();
/// <summary>
/// Sound that plays when starting to restock a machine.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("soundRestockStart")]
public SoundSpecifier SoundRestockStart = new SoundPathSpecifier("/Audio/Machines/vending_restock_start.ogg");
/// <summary>
/// Sound that plays when finished restocking a machine.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("soundRestockDone")]
public SoundSpecifier SoundRestockDone = new SoundPathSpecifier("/Audio/Machines/vending_restock_done.ogg");
}
}