using Content.Shared.Body.Components;
using Content.Server.Body.Systems;
using Content.Shared.Body.Prototypes;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Body.Components
{
///
/// Handles metabolizing various reagents with given effects.
///
[RegisterComponent, Access(typeof(MetabolizerSystem))]
public sealed partial class MetabolizerComponent : Component
{
///
/// The next time that reagents will be metabolized.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextUpdate;
///
/// How often to metabolize reagents.
///
///
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1);
///
/// Multiplier applied to for adjusting based on metabolic rate multiplier.
///
[DataField]
public float UpdateIntervalMultiplier = 1f;
///
/// Adjusted update interval based off of the multiplier value.
///
[ViewVariables]
public TimeSpan AdjustedUpdateInterval => UpdateInterval * UpdateIntervalMultiplier;
///
/// From which solution will this metabolizer attempt to metabolize chemicals
///
[DataField("solution")]
public string SolutionName = BloodstreamComponent.DefaultChemicalsSolutionName;
///
/// Does this component use a solution on it's parent entity (the body) or itself
///
///
/// Most things will use the parent entity (bloodstream).
///
[DataField]
public bool SolutionOnBody = true;
///
/// List of metabolizer types that this organ is. ex. Human, Slime, Felinid, w/e.
///
[DataField]
[Access(typeof(MetabolizerSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public HashSet>? MetabolizerTypes;
///
/// Should this metabolizer remove chemicals that have no metabolisms defined?
/// As a stop-gap, basically.
///
[DataField]
public bool RemoveEmpty;
///
/// How many reagents can this metabolizer process at once?
/// Used to nerf 'stacked poisons' where having 5+ different poisons in a syringe, even at low
/// quantity, would be muuuuch better than just one poison acting.
///
[DataField("maxReagents")]
public int MaxReagentsProcessable = 3;
///
/// A list of metabolism groups that this metabolizer will act on, in order of precedence.
///
[DataField("groups")]
public List? MetabolismGroups;
///
/// Offbrand: Set of reagents that are currently being metabolized
///
[DataField]
public HashSet> MetabolizingReagents = new();
///
/// Offbrand: Set of reagents that have been metabolized
///
[DataField]
public Dictionary, FixedPoint2> Metabolites = new();
///
/// Offbrand: Multiplier for how fast metabolites decay compared to normal rate
///
[DataField]
public FixedPoint2 MetaboliteDecayFactor = 2;
}
///
/// Contains data about how a metabolizer will metabolize a single group.
/// This allows metabolizers to remove certain groups much faster, or not at all.
///
[DataDefinition]
public sealed partial class MetabolismGroupEntry
{
[DataField(required: true)]
public ProtoId Id;
[DataField("rateModifier")]
public FixedPoint2 MetabolismRateModifier = 1.0;
}
}