using Content.Server._Sunrise.SolutionRegenerationSwitcher;
using Content.Server.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Chemistry.Components;
///
/// Passively increases a solution's quantity of a reagent.
///
[RegisterComponent, AutoGenerateComponentPause]
[Access(typeof(SolutionRegenerationSystem), typeof(SolutionRegenerationSwitcherSystem))] // Sunrise-Edit
public sealed partial class SolutionRegenerationComponent : Component
{
///
/// The name of the solution to add to.
///
[DataField("solution", required: true)]
public string SolutionName = string.Empty;
///
/// The solution to add reagents to.
///
[DataField]
public Entity? SolutionRef = null;
///
/// The reagent(s) to be regenerated in the solution.
///
[DataField(required: true)]
public Solution Generated = default!;
///
/// How long it takes to regenerate once.
///
[DataField]
public TimeSpan Duration = TimeSpan.FromSeconds(1);
///
/// The time when the next regeneration will occur.
///
[DataField("nextChargeTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextRegenTime = TimeSpan.FromSeconds(0);
// Sunrise-start
public void ChangeGenerated(ReagentQuantity reagent)
{
Generated.RemoveAllSolution();
Generated.AddReagent(reagent);
}
// Sunrise-end
}