1
0

CurrencyPrototype.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Content.Shared.FixedPoint;
  2. using Robust.Shared.Prototypes;
  3. using Robust.Shared.Serialization;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  5. namespace Content.Shared.Store;
  6. /// <summary>
  7. /// Prototype used to define different types of currency for generic stores.
  8. /// Mainly used for antags, such as traitors, nukies, and revenants
  9. /// This is separate to the cargo ordering system.
  10. /// </summary>
  11. [Prototype]
  12. [DataDefinition, Serializable, NetSerializable]
  13. public sealed partial class CurrencyPrototype : IPrototype
  14. {
  15. [ViewVariables]
  16. [IdDataField]
  17. public string ID { get; private set; } = default!;
  18. /// <summary>
  19. /// The Loc string used for displaying the currency in the store ui.
  20. /// doesn't necessarily refer to the full name of the currency, only
  21. /// that which is displayed to the user.
  22. /// </summary>
  23. [DataField("displayName")]
  24. public string DisplayName { get; private set; } = string.Empty;
  25. /// <summary>
  26. /// The physical entity of the currency
  27. /// </summary>
  28. [DataField("cash", customTypeSerializer: typeof(PrototypeIdValueDictionarySerializer<FixedPoint2, EntityPrototype>))]
  29. public Dictionary<FixedPoint2, string>? Cash { get; private set; }
  30. /// <summary>
  31. /// Whether or not this currency can be withdrawn from a shop by a player. Requires a valid entityId.
  32. /// </summary>
  33. [DataField("canWithdraw")]
  34. public bool CanWithdraw { get; private set; } = true;
  35. }