using Content.Shared.Alert;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Temperature.Components;
///
/// Handles taking damage from being excessively hot/cold.
/// Also handles alerts about being too hot or too cold.
///
[RegisterComponent]
public sealed partial class TemperatureDamageComponent : Component
{
///
/// The temperature above which the entity will start taking damage from being too hot.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float HeatDamageThreshold = 360f;
///
/// The temperature below which the entity will start taking damage from being too cold.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float ColdDamageThreshold = 260f;
///
/// Overrides HeatDamageThreshold if the entity's within a parent with the ContainerTemperatureDamageThresholdsComponent component.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float? ParentHeatDamageThreshold;
///
/// Overrides ColdDamageThreshold if the entity's within a parent with the ContainerTemperatureDamageThresholdsComponent component.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public float? ParentColdDamageThreshold;
///
/// The base damage that this entity will take if it's too cold.
/// Will be scaled according to how cold it is.
/// The scaling maxes out at times this damage per second.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier ColdDamage = new();
///
/// The base damage that this entity will take per second if it's too hot.
/// Will be scaled according to how hot it is.
/// The scaling maxes out at times this damage per second.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier HeatDamage = new();
///
/// Temperature won't do more than this multiple of the base overheating/overcooling damage per seond.
///
///
/// Okay it genuinely reaches this basically immediately for a plasma fire.
///
[DataField, ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 DamageCap = FixedPoint2.New(8);
///
/// Used to keep track of when damage starts/stops. Useful for logs.
///
[DataField]
public bool TakingDamage;
///
/// The id of the alert thrown when the entity is too hot.
///
[DataField]
public ProtoId HotAlert = "Hot";
///
/// The id of the alert thrown when the entity is too cold.
///
[DataField]
public ProtoId ColdAlert = "Cold";
///
/// The last time this entity processed temperature damage.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan LastUpdate;
///
/// The time interval between temperature damage ticks for this entity.
///
[DataField]
public TimeSpan UpdateInterval = TimeSpan.FromSeconds(1.0);
}