Turn ReagentEffects into generic EntityEffects (#28168)
* 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)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.EntityEffects;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.EntityEffects.EffectConditions;
|
||||
|
||||
/// <summary>
|
||||
/// Requires the target entity to be above or below a certain temperature.
|
||||
/// Used for things like cryoxadone and pyroxadone.
|
||||
/// </summary>
|
||||
public sealed partial class Temperature : EntityEffectCondition
|
||||
{
|
||||
[DataField]
|
||||
public float Min = 0;
|
||||
|
||||
[DataField]
|
||||
public float Max = float.PositiveInfinity;
|
||||
public override bool Condition(EntityEffectBaseArgs args)
|
||||
{
|
||||
if (args.EntityManager.TryGetComponent(args.TargetEntity, out TemperatureComponent? temp))
|
||||
{
|
||||
if (temp.CurrentTemperature > Min && temp.CurrentTemperature < Max)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user