ReagentDispenserComponent.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Content.Shared.Whitelist;
  2. using Content.Shared.Containers.ItemSlots;
  3. using Content.Server.Chemistry.EntitySystems;
  4. using Content.Shared.Chemistry;
  5. using Content.Shared.Chemistry.Dispenser;
  6. using Robust.Shared.Audio;
  7. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  8. namespace Content.Server.Chemistry.Components
  9. {
  10. /// <summary>
  11. /// A machine that dispenses reagents into a solution container from containers in its storage slots.
  12. /// </summary>
  13. [RegisterComponent]
  14. [Access(typeof(ReagentDispenserSystem))]
  15. public sealed partial class ReagentDispenserComponent : Component
  16. {
  17. /// <summary>
  18. /// String with the pack name that stores the initial fill of the dispenser. The initial
  19. /// fill is added to the dispenser on MapInit. Note that we don't use ContainerFill because
  20. /// we have to generate the storage slots at MapInit first, then fill them.
  21. /// </summary>
  22. [DataField("pack", customTypeSerializer:typeof(PrototypeIdSerializer<ReagentDispenserInventoryPrototype>))]
  23. [ViewVariables(VVAccess.ReadWrite)]
  24. public string? PackPrototypeId = default!;
  25. /// <summary>
  26. /// Maximum number of internal storage slots. Dispenser can't store (or dispense) more than
  27. /// this many chemicals (without unloading and reloading).
  28. /// </summary>
  29. [DataField("numStorageSlots")]
  30. public int NumSlots = 25;
  31. /// <summary>
  32. /// For each created storage slot for the reagent containers being dispensed, apply this
  33. /// entity whitelist. Makes sure weird containers don't fit in the dispenser and that beakers
  34. /// don't accidentally get slotted into the source slots.
  35. /// </summary>
  36. [DataField]
  37. public EntityWhitelist? StorageWhitelist;
  38. [DataField]
  39. public ItemSlot BeakerSlot = new();
  40. /// <summary>
  41. /// Prefix for automatically-generated slot name for storage, up to NumSlots.
  42. /// </summary>
  43. public static string BaseStorageSlotId = "ReagentDispenser-storageSlot";
  44. /// <summary>
  45. /// List of storage slots that were created at MapInit.
  46. /// </summary>
  47. [DataField]
  48. public List<string> StorageSlotIds = new List<string>();
  49. [DataField]
  50. public List<ItemSlot> StorageSlots = new List<ItemSlot>();
  51. [DataField("clickSound"), ViewVariables(VVAccess.ReadWrite)]
  52. public SoundSpecifier ClickSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
  53. [ViewVariables(VVAccess.ReadWrite)]
  54. public ReagentDispenserDispenseAmount DispenseAmount = ReagentDispenserDispenseAmount.U10;
  55. }
  56. }