1
0

SharedChemistryGuideDataSystem.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Content.Shared.Chemistry.Reagent;
  2. using Robust.Shared.Prototypes;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Chemistry;
  5. /// <summary>
  6. /// This handles the chemistry guidebook and caching it.
  7. /// </summary>
  8. public abstract class SharedChemistryGuideDataSystem : EntitySystem
  9. {
  10. [Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
  11. protected readonly Dictionary<string, ReagentGuideEntry> Registry = new();
  12. public IReadOnlyDictionary<string, ReagentGuideEntry> ReagentGuideRegistry => Registry;
  13. // Only ran on the server
  14. public abstract void ReloadAllReagentPrototypes();
  15. }
  16. [Serializable, NetSerializable]
  17. public sealed class ReagentGuideRegistryChangedEvent : EntityEventArgs
  18. {
  19. public ReagentGuideChangeset Changeset;
  20. public ReagentGuideRegistryChangedEvent(ReagentGuideChangeset changeset)
  21. {
  22. Changeset = changeset;
  23. }
  24. }
  25. [Serializable, NetSerializable]
  26. public sealed class ReagentGuideChangeset
  27. {
  28. public Dictionary<string,ReagentGuideEntry> GuideEntries;
  29. public HashSet<string> Removed;
  30. public ReagentGuideChangeset(Dictionary<string, ReagentGuideEntry> guideEntries, HashSet<string> removed)
  31. {
  32. GuideEntries = guideEntries;
  33. Removed = removed;
  34. }
  35. }