2022-06-04 19:17:48 +12:00
|
|
|
using Content.Server.Temperature.Components;
|
2021-11-20 16:47:53 -07:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2023-06-04 16:45:02 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-20 16:47:53 -07:00
|
|
|
|
|
|
|
|
namespace Content.Server.Chemistry.ReagentEffectConditions
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Requires the solution entity to be above or below a certain temperature.
|
|
|
|
|
/// Used for things like cryoxadone and pyroxadone.
|
|
|
|
|
/// </summary>
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class Temperature : ReagentEffectCondition
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField]
|
2021-11-20 16:47:53 -07:00
|
|
|
public float Min = 0;
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
[DataField]
|
2023-06-04 16:45:02 -04:00
|
|
|
public float Max = float.PositiveInfinity;
|
2021-11-20 16:47:53 -07:00
|
|
|
public override bool Condition(ReagentEffectArgs args)
|
|
|
|
|
{
|
2022-06-04 19:17:48 +12:00
|
|
|
if (args.EntityManager.TryGetComponent(args.SolutionEntity, out TemperatureComponent? temp))
|
2021-11-20 16:47:53 -07:00
|
|
|
{
|
|
|
|
|
if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-06-04 16:45:02 -04:00
|
|
|
|
|
|
|
|
public override string GuidebookExplanation(IPrototypeManager prototype)
|
|
|
|
|
{
|
|
|
|
|
return Loc.GetString("reagent-effect-condition-guidebook-body-temperature",
|
|
|
|
|
("max", float.IsPositiveInfinity(Max) ? (float) int.MaxValue : Max),
|
|
|
|
|
("min", Min));
|
|
|
|
|
}
|
2021-11-20 16:47:53 -07:00
|
|
|
}
|
|
|
|
|
}
|