mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Hope I'm not forgetting anything... * They call me the sender the way I'm sending it. * remove commented out YAML * last of the slop * fix test fails * first batch of test fails * no more test fails * make cryo pods work again. * Make cryo work better-er * I didn't like that a firesuit helmet was so effective on its own so I decided to be a dick about it. * review.com * oop * actually real quick do this * fix YAML issues * IHeatContainer my beloved <3 * borger * not networked :( * jackets * burgeewqjfrwjkhaskfjfsahjkfsahjkfsahjkfsajhkfsa * utter yaml nonsense * phishing --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
52 lines
2 KiB
C#
52 lines
2 KiB
C#
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Temperature.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.EntityConditions.Conditions;
|
|
|
|
/// <summary>
|
|
/// Returns true if this entity has an amount of reagent in it within a specified minimum and maximum.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityConditionSystem{T, TCondition}"/>
|
|
public sealed partial class TemperatureEntityConditionSystem : EntityConditionSystem<TemperatureComponent, TemperatureCondition>
|
|
{
|
|
protected override void Condition(Entity<TemperatureComponent> entity, ref EntityConditionEvent<TemperatureCondition> args)
|
|
{
|
|
if (entity.Comp.Temperature >= args.Condition.Min && entity.Comp.Temperature <= args.Condition.Max)
|
|
args.Result = true;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns true if this solution entity has an amount of reagent in it within a specified minimum and maximum.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EntityConditionSystem{T, TCondition}"/>
|
|
public sealed partial class SolutionTemperatureEntityConditionSystem : EntityConditionSystem<SolutionComponent, TemperatureCondition>
|
|
{
|
|
protected override void Condition(Entity<SolutionComponent> entity, ref EntityConditionEvent<TemperatureCondition> args)
|
|
{
|
|
if (entity.Comp.Solution.Temperature >= args.Condition.Min && entity.Comp.Solution.Temperature <= args.Condition.Max)
|
|
args.Result = true;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc cref="EntityCondition"/>
|
|
public sealed partial class TemperatureCondition : EntityConditionBase<TemperatureCondition>
|
|
{
|
|
/// <summary>
|
|
/// Minimum allowed temperature
|
|
/// </summary>
|
|
[DataField]
|
|
public float Min = 0;
|
|
|
|
/// <summary>
|
|
/// Maximum allowed temperature
|
|
/// </summary>
|
|
[DataField]
|
|
public float Max = float.PositiveInfinity;
|
|
|
|
public override string EntityConditionGuidebookText(IPrototypeManager prototype) =>
|
|
Loc.GetString("entity-condition-guidebook-body-temperature",
|
|
("max", float.IsPositiveInfinity(Max) ? (float) int.MaxValue : Max),
|
|
("min", Min));
|
|
}
|