TechnologyPrototype.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.Utility;
  3. namespace Content.Shared.Research.Prototypes;
  4. /// <summary>
  5. /// This is a prototype for a technology that can be unlocked.
  6. /// </summary>
  7. [Prototype]
  8. public sealed partial class TechnologyPrototype : IPrototype
  9. {
  10. /// <inheritdoc/>
  11. [IdDataField]
  12. public string ID { get; private set; } = default!;
  13. /// <summary>
  14. /// The name of the technology.
  15. /// Supports locale strings
  16. /// </summary>
  17. [DataField(required: true)]
  18. public LocId Name = string.Empty;
  19. /// <summary>
  20. /// An icon used to visually represent the technology in UI.
  21. /// </summary>
  22. [DataField(required: true)]
  23. public SpriteSpecifier Icon = default!;
  24. /// <summary>
  25. /// What research discipline this technology belongs to.
  26. /// </summary>
  27. [DataField(required: true)]
  28. public ProtoId<TechDisciplinePrototype> Discipline;
  29. /// <summary>
  30. /// What tier research is this?
  31. /// The tier governs how much lower-tier technology
  32. /// needs to be unlocked before this one.
  33. /// </summary>
  34. [DataField(required: true)]
  35. public int Tier;
  36. /// <summary>
  37. /// Hidden tech is not ever available at the research console.
  38. /// </summary>
  39. [DataField]
  40. public bool Hidden;
  41. /// <summary>
  42. /// How much research is needed to unlock.
  43. /// </summary>
  44. [DataField]
  45. public int Cost = 10000;
  46. /// <summary>
  47. /// A list of <see cref="TechnologyPrototype"/>s that need to be unlocked in order to unlock this technology.
  48. /// </summary>
  49. [DataField]
  50. public List<ProtoId<TechnologyPrototype>> TechnologyPrerequisites = new();
  51. /// <summary>
  52. /// A list of <see cref="LatheRecipePrototype"/>s that are unlocked by this technology
  53. /// </summary>
  54. [DataField]
  55. public List<ProtoId<LatheRecipePrototype>> RecipeUnlocks = new();
  56. /// <summary>
  57. /// A list of non-standard effects that are done when this technology is unlocked.
  58. /// </summary>
  59. [DataField]
  60. public IReadOnlyList<GenericUnlock> GenericUnlocks = new List<GenericUnlock>();
  61. }
  62. [DataDefinition]
  63. public partial record struct GenericUnlock()
  64. {
  65. /// <summary>
  66. /// What event is raised when this is unlocked?
  67. /// Used for doing non-standard logic.
  68. /// </summary>
  69. [DataField]
  70. public object? PurchaseEvent = null;
  71. /// <summary>
  72. /// A player facing tooltip for what the unlock does.
  73. /// Supports locale strings.
  74. /// </summary>
  75. [DataField]
  76. public string UnlockDescription = string.Empty;
  77. }