* Rename SolutionContainerCaps -> Capability * Move IExamine event to Chemistry System. * ECS the ISolutionChange into SolutionChangeEvent * Unify SolutionContainer into a single shared component * Replace ISolutionInteraction with SolutionContainerComponent * Move all methods from SolutionContainer to ChemistrySystem * Refactor EntitySystem calls to Dependencies * Refactor SolutionContainer to SolutionManager * Fix yamls * Fix test fails * Fix post merge issues * Fix various issues with SolutionManager * More fixes * Fix more components * Fix events not being directed * Fixes for Hypospray * Separate removal and iteration on Metabolism * Fix creampie problems * Address some of sloth's issues * Refactors for Systems * Refactored solution location * Fix tests * Address more sloth issues * Fix dependency * Fix merge conflicts * Add xmldocs for Capabilities components * Remove HasSolution/TryGetDefaultSolution and Add/Remove Drainable/Refillable * Replace Grindable/Juiceable with Extractable * Refactor field names * Fix Drainable * Fix some issues with spillable and injector * Fix issues with Grinder * Fix Beaker having duplicate solutions * Fix foaming * Address some MGS issues * Fix Uid issues * Fix errors in solution Tranfer * Fixed some extra values constant values * Cola is drinkable now
59 lines
2.2 KiB
C#
59 lines
2.2 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Content.Shared.Body.Networks;
|
|
using Content.Shared.Chemistry.Reagent;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
|
|
|
namespace Content.Server.Body.Metabolism
|
|
{
|
|
/// <summary>
|
|
/// Handles metabolizing various reagents with given effects.
|
|
/// </summary>
|
|
[RegisterComponent]
|
|
public class MetabolizerComponent : Component
|
|
{
|
|
public override string Name => "Metabolizer";
|
|
|
|
public float AccumulatedFrametime = 0.0f;
|
|
|
|
/// <summary>
|
|
/// How often to metabolize reagents, in seconds.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[DataField("updateFrequency")]
|
|
public float UpdateFrequency = 1.0f;
|
|
|
|
/// <summary>
|
|
/// From which solution will this metabolizer attempt to metabolize chemicals in its parent bodies' bloodstream,
|
|
/// as opposed to a solution container on the metabolizing entity itself.
|
|
/// </summary>
|
|
[DataField("solution")]
|
|
public string SolutionName { get; set; } = SharedBloodstreamComponent.DefaultSolutionName;
|
|
|
|
/// <summary>
|
|
/// A dictionary mapping reagent string IDs to a list of effects & associated metabolism rate.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[DataField("metabolisms", required: true, customTypeSerializer:typeof(PrototypeIdDictionarySerializer<ReagentEffectsEntry, ReagentPrototype>))]
|
|
public Dictionary<string, ReagentEffectsEntry> Metabolisms = default!;
|
|
}
|
|
|
|
[DataDefinition]
|
|
public class ReagentEffectsEntry
|
|
{
|
|
/// <summary>
|
|
/// Amount of reagent to metabolize, per metabolism cycle.
|
|
/// </summary>
|
|
[DataField("metabolismRate")]
|
|
public ReagentUnit MetabolismRate = ReagentUnit.New(1.0f);
|
|
|
|
/// <summary>
|
|
/// A list of effects to apply when these reagents are metabolized.
|
|
/// </summary>
|
|
[DataField("effects", required: true)]
|
|
public ReagentEffect[] Effects = default!;
|
|
}
|
|
}
|