#nullable enable using System.Collections.Generic; using Content.Shared.Interfaces.Chemistry; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.ViewVariables; namespace Content.Shared.Chemistry { /// /// Prototype for chemical reaction definitions /// [Prototype("reaction")] public class ReactionPrototype : IPrototype { [DataField("reactants")] private Dictionary _reactants = new(); [DataField("products")] private Dictionary _products = new(); [DataField("effects", serverOnly: true)] private List _effects = new(); [ViewVariables] [DataField("id", required: true)] public string ID { get; } = default!; [DataField("name")] public string Name { get; } = string.Empty; /// /// Reactants required for the reaction to occur. /// public IReadOnlyDictionary Reactants => _reactants; /// /// Reagents created when the reaction occurs. /// public IReadOnlyDictionary Products => _products; /// /// Effects to be triggered when the reaction occurs. /// public IReadOnlyList Effects => _effects; // TODO SERV3: Empty on the client, (de)serialize on the server with module manager is server module [DataField("sound", serverOnly: true)] public string? Sound { get; private set; } = "/Audio/Effects/Chemistry/bubbles.ogg"; } /// /// Prototype for chemical reaction reactants. /// [DataDefinition] public class ReactantPrototype { [DataField("amount")] private ReagentUnit _amount = ReagentUnit.New(1); [DataField("catalyst")] private bool _catalyst; /// /// Minimum amount of the reactant needed for the reaction to occur. /// public ReagentUnit Amount => _amount; /// /// Whether or not the reactant is a catalyst. Catalysts aren't removed when a reaction occurs. /// public bool Catalyst => _catalyst; } }