CargoBountyData.cs 953 B

12345678910111213141516171819202122232425262728293031
  1. using Robust.Shared.Serialization;
  2. using Content.Shared.Cargo.Prototypes;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Shared.Cargo;
  5. /// <summary>
  6. /// A data structure for storing currently available bounties.
  7. /// </summary>
  8. [DataDefinition, NetSerializable, Serializable]
  9. public readonly partial record struct CargoBountyData
  10. {
  11. /// <summary>
  12. /// A unique id used to identify the bounty
  13. /// </summary>
  14. [DataField, ViewVariables(VVAccess.ReadWrite)]
  15. public string Id { get; init; } = string.Empty;
  16. /// <summary>
  17. /// The prototype containing information about the bounty.
  18. /// </summary>
  19. [ViewVariables(VVAccess.ReadWrite)]
  20. [DataField(required: true)]
  21. public ProtoId<CargoBountyPrototype> Bounty { get; init; } = string.Empty;
  22. public CargoBountyData(CargoBountyPrototype bounty, int uniqueIdentifier)
  23. {
  24. Bounty = bounty.ID;
  25. Id = $"{bounty.IdPrefix}{uniqueIdentifier:D3}";
  26. }
  27. }