* Oh the possibilities * Merge fixes * Forgot to remote LavaSystem oops * Changed EntityEffectArgs to EntityEffectBaseArgs and EntityEffectReagentArgs * Throw exception for unimplemented effectargs * Remove Json and overrideable datafields * Fix test issues * Actually fix the compiling issue * Fix comments and remove EntityEffectArgs (no longer used, replaced with EntityEffectBaseArgs)
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using Content.Shared.EntityEffects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.EntityEffects.EffectConditions;
|
|
|
|
/// <summary>
|
|
/// Requires the solution to be above or below a certain temperature.
|
|
/// Used for things like explosives.
|
|
/// </summary>
|
|
public sealed partial class SolutionTemperature : EntityEffectCondition
|
|
{
|
|
[DataField]
|
|
public float Min = 0.0f;
|
|
|
|
[DataField]
|
|
public float Max = float.PositiveInfinity;
|
|
public override bool Condition(EntityEffectBaseArgs args)
|
|
{
|
|
if (args is EntityEffectReagentArgs reagentArgs)
|
|
{
|
|
if (reagentArgs.Source == null)
|
|
return false;
|
|
if (reagentArgs.Source.Temperature < Min)
|
|
return false;
|
|
if (reagentArgs.Source.Temperature > Max)
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
// TODO: Someone needs to figure out how to do this for non-reagent effects.
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public override string GuidebookExplanation(IPrototypeManager prototype)
|
|
{
|
|
return Loc.GetString("reagent-effect-condition-guidebook-solution-temperature",
|
|
("max", float.IsPositiveInfinity(Max) ? (float) int.MaxValue : Max),
|
|
("min", Min));
|
|
}
|
|
}
|