using Content.Shared.Atmos;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Trigger.Components.Effects;
///
/// Contains a GasMixture that will release its contents to the atmosphere when triggered.
///
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState, AutoGenerateComponentPause]
public sealed partial class ReleaseGasOnTriggerComponent : BaseXOnTriggerComponent
{
///
/// Whether this grenade is active and releasing gas.
/// Set to true when triggered, which starts gas release.
///
[DataField]
public bool Active;
///
/// The gas mixture that will be released to the current tile atmosphere when triggered.
///
[DataField]
public GasMixture Air;
///
/// Time at which the next release will occur.
/// This is automatically set when the grenade activates.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextReleaseTime = TimeSpan.Zero;
///
/// The cap at which this grenade can fill the exposed atmosphere to.
/// This component automatically removes itself when the pressure limit is reached.
///
/// If set to 101.325, the grenade will only fill the exposed
/// atmosphere up to 101.325 kPa.
/// If zero, this limit won't be respected.
[DataField]
public float PressureLimit;
///
/// How often the grenade will release gas.
///
[DataField]
public TimeSpan ReleaseInterval = TimeSpan.FromSeconds(1);
///
/// A float from 0 to 1, representing a partial portion of the moles
/// of the gas mixture that will be
/// released to the current tile atmosphere when triggered.
///
/// If undefined on the prototype, the entire molar amount will be transferred.
[DataField]
public float RemoveFraction = 1;
///
/// Stores the total moles initially in the grenade upon activation.
/// Used to calculate the moles released over time.
///
/// Set when the grenade is activated.
[DataField(readOnly: true)]
public float StartingTotalMoles;
}
///
/// Represents visual states for whatever visuals that need to be applied
/// on state changes.
///
[Serializable, NetSerializable]
public enum ReleaseGasOnTriggerVisuals : byte
{
Key,
}