]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
EntityEffectConditions changed to be inclusive of min/max (#36289)
authorāda <ss.adasts@gmail.com>
Wed, 30 Jul 2025 06:44:46 +0000 (01:44 -0500)
committerGitHub <noreply@github.com>
Wed, 30 Jul 2025 06:44:46 +0000 (23:44 -0700)
* soo hungry going back for more lipolicide

* too much lipolicide.....

* fixes

* it moved

* typo

---------

Co-authored-by: iaada <iaada@users.noreply.github.com>
Content.Server/EntityEffects/EntityEffectSystem.cs
Content.Shared/EntityEffects/EffectConditions/SolutionTemperature.cs
Content.Shared/EntityEffects/EffectConditions/TotalDamage.cs
Content.Shared/EntityEffects/EffectConditions/TotalHunger.cs

index 54270ca53d5fe23d1a2e0286ce6d2e67f4e34589..1277c8df594d0ec44fe808126a920d7195dac80f 100644 (file)
@@ -133,7 +133,7 @@ public sealed class EntityEffectSystem : EntitySystem
         args.Result = false;
         if (TryComp(args.Args.TargetEntity, out TemperatureComponent? temp))
         {
-            if (temp.CurrentTemperature > args.Condition.Min && temp.CurrentTemperature < args.Condition.Max)
+            if (temp.CurrentTemperature >= args.Condition.Min && temp.CurrentTemperature <= args.Condition.Max)
                 args.Result = true;
         }
     }
index a9629401a0579baa3759a378c24c50df2da5ce73..e2febd8f4838cd51c3628f13d754eccfd5f737f7 100644 (file)
@@ -13,17 +13,14 @@ public sealed partial class SolutionTemperature : EntityEffectCondition
 
     [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;
+            return reagentArgs?.Source != null &&
+                   reagentArgs.Source.Temperature >= Min &&
+                   reagentArgs.Source.Temperature <= Max;
         }
 
         // TODO: Someone needs to figure out how to do this for non-reagent effects.
index 62b3e037e1c959531bf48e04d469db9998f64377..a4baeb634a1e3a144bfc9993167cc4cd214b65e2 100644 (file)
@@ -18,8 +18,7 @@ public sealed partial class TotalDamage : EntityEffectCondition
         if (args.EntityManager.TryGetComponent(args.TargetEntity, out DamageableComponent? damage))
         {
             var total = damage.TotalDamage;
-            if (total > Min && total < Max)
-                return true;
+            return total >= Min && total <= Max;
         }
 
         return false;
index b4f1a1af898502b17ad7a9c5caf0ea537b2f8c4c..cbeb334c473881a126a36a61d6442634a29578e4 100644 (file)
@@ -18,8 +18,7 @@ public sealed partial class Hunger : EntityEffectCondition
         if (args.EntityManager.TryGetComponent(args.TargetEntity, out HungerComponent? hunger))
         {
             var total = args.EntityManager.System<HungerSystem>().GetHunger(hunger);
-            if (total > Min && total < Max)
-                return true;
+            return total >= Min && total <= Max;
         }
 
         return false;