using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Atmos.Rotting;
///
/// This makes mobs eventually start rotting when they die.
/// It may be expanded to food at some point, but it's just for mobs right now.
///
[RegisterComponent]
public sealed partial class PerishableComponent : Component
{
///
/// How long it takes after death to start rotting.
///
[DataField("rotAfter"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan RotAfter = TimeSpan.FromMinutes(10);
///
/// How much rotting has occured
///
[DataField("rotAccumulator"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan RotAccumulator = TimeSpan.Zero;
///
/// Gasses are released, this is when the next gas release update will be.
///
[DataField("rotNextUpdate", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan NextPerishUpdate = TimeSpan.Zero;
///
/// How often the rotting ticks.
/// Feel free to tweak this if there are perf concerns.
///
[DataField("perishUpdateRate"), ViewVariables(VVAccess.ReadWrite)]
public TimeSpan PerishUpdateRate = TimeSpan.FromSeconds(5);
///
/// How many moles of gas released per second, per unit of mass.
///
[DataField("molsPerSecondPerUnitMass"), ViewVariables(VVAccess.ReadWrite)]
public float MolsPerSecondPerUnitMass = 0.0025f;
}
[ByRefEvent]
public record struct IsRottingEvent(bool Handled = false);