Files
tbd-station-14/Content.Shared/Chemistry/Reaction/ReactiveComponent.cs
SlamBamActionman b9fa941ca6 Turn ReagentEffects into generic EntityEffects (#28168)
* Oh the possibilities

* Merge fixes

* Forgot to remote LavaSystem oops

* Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs

* Throw exception for unimplemented effectargs

* Remove Json and overrideable datafields

* Fix test issues

* Actually fix the compiling issue

* Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
2024-06-30 13:43:43 +10:00

43 lines
1.7 KiB
C#

using Content.Shared.Chemistry.Reagent;
using Content.Shared.EntityEffects;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
namespace Content.Shared.Chemistry.Reaction;
[RegisterComponent]
public sealed partial class ReactiveComponent : Component
{
/// <summary>
/// A dictionary of reactive groups -> methods that work on them.
/// </summary>
[DataField("groups", readOnly: true, serverOnly: true,
customTypeSerializer:
typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
public Dictionary<string, HashSet<ReactionMethod>>? ReactiveGroups;
/// <summary>
/// Special reactions that this prototype can specify, outside of any that reagents already apply.
/// Useful for things like monkey cubes, which have a really prototype-specific effect.
/// </summary>
[DataField("reactions", true, serverOnly: true)]
public List<ReactiveReagentEffectEntry>? Reactions;
}
[DataDefinition]
public sealed partial class ReactiveReagentEffectEntry
{
[DataField("methods")]
public HashSet<ReactionMethod> Methods = default!;
[DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<ReagentPrototype>))]
public HashSet<string>? Reagents = null;
[DataField("effects", required: true)]
public List<EntityEffect> Effects = default!;
[DataField("groups", readOnly: true, serverOnly: true,
customTypeSerializer:typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
public Dictionary<string, HashSet<ReactionMethod>>? ReactiveGroups { get; private set; }
}