1
0

ReactiveComponent.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Shared.Chemistry.Reagent;
  2. using Content.Shared.EntityEffects;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
  5. namespace Content.Shared.Chemistry.Reaction;
  6. [RegisterComponent]
  7. public sealed partial class ReactiveComponent : Component
  8. {
  9. /// <summary>
  10. /// A dictionary of reactive groups -> methods that work on them.
  11. /// </summary>
  12. [DataField("groups", readOnly: true, serverOnly: true,
  13. customTypeSerializer:
  14. typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
  15. public Dictionary<string, HashSet<ReactionMethod>>? ReactiveGroups;
  16. /// <summary>
  17. /// Special reactions that this prototype can specify, outside of any that reagents already apply.
  18. /// Useful for things like monkey cubes, which have a really prototype-specific effect.
  19. /// </summary>
  20. [DataField("reactions", true, serverOnly: true)]
  21. public List<ReactiveReagentEffectEntry>? Reactions;
  22. }
  23. [DataDefinition]
  24. public sealed partial class ReactiveReagentEffectEntry
  25. {
  26. [DataField("methods")]
  27. public HashSet<ReactionMethod> Methods = default!;
  28. [DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<ReagentPrototype>))]
  29. public HashSet<string>? Reagents = null;
  30. [DataField("effects", required: true)]
  31. public List<EntityEffect> Effects = default!;
  32. [DataField("groups", readOnly: true, serverOnly: true,
  33. customTypeSerializer:typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
  34. public Dictionary<string, HashSet<ReactionMethod>>? ReactiveGroups { get; private set; }
  35. }