StationCargoOrderDatabaseComponent.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Content.Server.Station.Components;
  2. using Content.Shared.Cargo;
  3. using Content.Shared.Cargo.Components;
  4. using Content.Shared.Cargo.Prototypes;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. namespace Content.Server.Cargo.Components;
  8. /// <summary>
  9. /// Stores all of cargo orders for a particular station.
  10. /// </summary>
  11. [RegisterComponent]
  12. public sealed partial class StationCargoOrderDatabaseComponent : Component
  13. {
  14. /// <summary>
  15. /// Maximum amount of orders a station is allowed, approved or not.
  16. /// </summary>
  17. [ViewVariables(VVAccess.ReadWrite), DataField("capacity")]
  18. public int Capacity = 20;
  19. [ViewVariables(VVAccess.ReadWrite), DataField("orders")]
  20. public List<CargoOrderData> Orders = new();
  21. /// <summary>
  22. /// Used to determine unique order IDs
  23. /// </summary>
  24. public int NumOrdersCreated;
  25. // TODO: Can probably dump this
  26. /// <summary>
  27. /// The cargo shuttle assigned to this station.
  28. /// </summary>
  29. [DataField("shuttle")]
  30. public EntityUid? Shuttle;
  31. /// <summary>
  32. /// The paper-type prototype to spawn with the order information.
  33. /// </summary>
  34. [DataField]
  35. public EntProtoId PrinterOutput = "PaperCargoInvoice";
  36. }
  37. /// <summary>
  38. /// Event broadcast before a cargo order is fulfilled, allowing alternate systems to fulfill the order.
  39. /// </summary>
  40. [ByRefEvent]
  41. public record struct FulfillCargoOrderEvent(Entity<StationDataComponent> Station, CargoOrderData Order, Entity<CargoOrderConsoleComponent> OrderConsole)
  42. {
  43. public Entity<CargoOrderConsoleComponent> OrderConsole = OrderConsole;
  44. public Entity<StationDataComponent> Station = Station;
  45. public CargoOrderData Order = Order;
  46. public EntityUid? FulfillmentEntity;
  47. public bool Handled = false;
  48. }