2021-11-10 03:11:28 -07:00
|
|
|
using System.Collections.Generic;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2021-03-26 12:02:41 +01:00
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-11-22 02:17:35 -07:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
2021-11-10 03:11:28 -07:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
|
2021-03-26 12:02:41 +01:00
|
|
|
|
2021-11-22 02:17:35 -07:00
|
|
|
namespace Content.Shared.Chemistry.Reaction;
|
|
|
|
|
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ReactiveComponent : Component
|
2021-03-26 12:02:41 +01:00
|
|
|
{
|
2021-11-22 02:17:35 -07:00
|
|
|
/// <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;
|
2021-03-26 12:02:41 +01:00
|
|
|
|
2021-11-22 02:17:35 -07:00
|
|
|
/// <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;
|
|
|
|
|
}
|
2021-11-10 03:11:28 -07:00
|
|
|
|
2021-11-22 02:17:35 -07:00
|
|
|
[DataDefinition]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ReactiveReagentEffectEntry
|
2021-11-22 02:17:35 -07:00
|
|
|
{
|
|
|
|
|
[DataField("methods")]
|
|
|
|
|
public HashSet<ReactionMethod> Methods = default!;
|
2021-11-10 03:11:28 -07:00
|
|
|
|
2021-11-22 02:17:35 -07:00
|
|
|
[DataField("reagents", customTypeSerializer: typeof(PrototypeIdHashSetSerializer<ReagentPrototype>))]
|
|
|
|
|
public HashSet<string>? Reagents = null;
|
2021-11-10 03:11:28 -07:00
|
|
|
|
2021-11-22 02:17:35 -07:00
|
|
|
[DataField("effects", required: true)]
|
|
|
|
|
public List<ReagentEffect> Effects = default!;
|
|
|
|
|
[DataField("groups", required: true, readOnly: true, serverOnly: true,
|
|
|
|
|
customTypeSerializer:typeof(PrototypeIdDictionarySerializer<HashSet<ReactionMethod>, ReactiveGroupPrototype>))]
|
|
|
|
|
public Dictionary<string, HashSet<ReactionMethod>> ReactiveGroups { get; } = default!;
|
2021-03-26 12:02:41 +01:00
|
|
|
}
|