1
0

VendingMachineRestockComponent.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Content.Shared.DoAfter;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Serialization;
  6. namespace Content.Shared.VendingMachines;
  7. [RegisterComponent, NetworkedComponent, Access(typeof(SharedVendingMachineSystem))]
  8. public sealed partial class VendingMachineRestockComponent : Component
  9. {
  10. /// <summary>
  11. /// The time (in seconds) that it takes to restock a machine.
  12. /// </summary>
  13. [ViewVariables(VVAccess.ReadWrite)]
  14. [DataField("restockDelay")]
  15. public TimeSpan RestockDelay = TimeSpan.FromSeconds(5.0f);
  16. /// <summary>
  17. /// What sort of machine inventory does this restock?
  18. /// This is checked against the VendingMachineComponent's pack value.
  19. /// </summary>
  20. [ViewVariables(VVAccess.ReadWrite)]
  21. [DataField("canRestock", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<VendingMachineInventoryPrototype>))]
  22. public HashSet<string> CanRestock = new();
  23. /// <summary>
  24. /// Sound that plays when starting to restock a machine.
  25. /// </summary>
  26. [ViewVariables(VVAccess.ReadWrite)]
  27. [DataField("soundRestockStart")]
  28. public SoundSpecifier SoundRestockStart = new SoundPathSpecifier("/Audio/Machines/vending_restock_start.ogg")
  29. {
  30. Params = new AudioParams
  31. {
  32. Volume = -2f,
  33. Variation = 0.2f
  34. }
  35. };
  36. /// <summary>
  37. /// Sound that plays when finished restocking a machine.
  38. /// </summary>
  39. [ViewVariables(VVAccess.ReadWrite)]
  40. [DataField("soundRestockDone")]
  41. public SoundSpecifier SoundRestockDone = new SoundPathSpecifier("/Audio/Machines/vending_restock_done.ogg");
  42. }
  43. [Serializable, NetSerializable]
  44. public sealed partial class RestockDoAfterEvent : SimpleDoAfterEvent
  45. {
  46. }