1
0

TechnologyDatabaseComponent.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Content.Shared.Lathe;
  2. using Content.Shared.Research.Prototypes;
  3. using Content.Shared.Research.Systems;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
  7. namespace Content.Shared.Research.Components;
  8. [RegisterComponent, NetworkedComponent, Access(typeof(SharedResearchSystem), typeof(SharedLatheSystem)), AutoGenerateComponentState]
  9. public sealed partial class TechnologyDatabaseComponent : Component
  10. {
  11. /// <summary>
  12. /// A main discipline that locks out other discipline technology past a certain tier.
  13. /// </summary>
  14. [AutoNetworkedField]
  15. [DataField("mainDiscipline", customTypeSerializer: typeof(PrototypeIdSerializer<TechDisciplinePrototype>))]
  16. public string? MainDiscipline;
  17. [AutoNetworkedField]
  18. [DataField("currentTechnologyCards")]
  19. public List<string> CurrentTechnologyCards = new();
  20. /// <summary>
  21. /// Which research disciplines are able to be unlocked
  22. /// </summary>
  23. [AutoNetworkedField]
  24. [DataField("supportedDisciplines", customTypeSerializer: typeof(PrototypeIdListSerializer<TechDisciplinePrototype>))]
  25. public List<string> SupportedDisciplines = new();
  26. /// <summary>
  27. /// The ids of all the technologies which have been unlocked.
  28. /// </summary>
  29. [AutoNetworkedField]
  30. [DataField("unlockedTechnologies", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
  31. public List<string> UnlockedTechnologies = new();
  32. /// <summary>
  33. /// The ids of all the lathe recipes which have been unlocked.
  34. /// This is maintained alongside the TechnologyIds
  35. /// </summary>
  36. /// todo: if you unlock all the recipes in a tech, it doesn't count as unlocking the tech. sadge
  37. [AutoNetworkedField]
  38. [DataField("unlockedRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
  39. public List<string> UnlockedRecipes = new();
  40. }
  41. /// <summary>
  42. /// Event raised on the database whenever its
  43. /// technologies or recipes are modified.
  44. /// </summary>
  45. /// <remarks>
  46. /// This event is forwarded from the
  47. /// server to all of it's clients.
  48. /// </remarks>
  49. [ByRefEvent]
  50. public readonly record struct TechnologyDatabaseModifiedEvent;
  51. /// <summary>
  52. /// Event raised on a database after being synchronized
  53. /// with the values from another database.
  54. /// </summary>
  55. [ByRefEvent]
  56. public readonly record struct TechnologyDatabaseSynchronizedEvent;