]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix Entity Effect Scaling (Hopefully) for good and some other misc fixes (#41163)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Thu, 6 Nov 2025 21:34:53 +0000 (13:34 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Nov 2025 21:34:53 +0000 (21:34 +0000)
* Fix the last of the entity effects bugs

* aaa

* losing it

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
21 files changed:
Content.Shared/EntityConditions/Conditions/ReagentEntityConditionSystem.cs
Content.Shared/EntityEffects/Effects/EntitySpawning/BaseSpawnEntityEntityEffect.cs
Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs
Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs
Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs
Content.Shared/EntityEffects/Effects/Transform/FlashEntityEffectSystem.cs
Content.Shared/EntityEffects/EntityEffect.cs
Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs
Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml
Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml
Resources/Prototypes/Entities/Mobs/NPCs/space.yml
Resources/Prototypes/Entities/Mobs/Species/diona.yml
Resources/Prototypes/Entities/Mobs/Species/skeleton.yml
Resources/Prototypes/Entities/Mobs/Species/slime.yml
Resources/Prototypes/Entities/Objects/Misc/kudzu.yml
Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml
Resources/Prototypes/Reagents/botany.yml
Resources/Prototypes/Reagents/fun.yml
Resources/Prototypes/Reagents/gases.yml
Resources/Prototypes/Reagents/medicine.yml
Resources/Prototypes/Reagents/toxins.yml

index dbe585e6317cbe6b60bbf9a327de4addc0b536fa..c1da05ae30ff6202275386a5887ad72c9c09f664 100644 (file)
@@ -9,7 +9,7 @@ namespace Content.Shared.EntityConditions.Conditions;
 /// 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 ReagentThresholdEntityConditionSystem : EntityConditionSystem<SolutionComponent, ReagentCondition>
+public sealed partial class ReagentEntityConditionSystem : EntityConditionSystem<SolutionComponent, ReagentCondition>
 {
     protected override void Condition(Entity<SolutionComponent> entity, ref EntityConditionEvent<ReagentCondition> args)
     {
index bd8d68813e38598caa682a10c97c4982c0609545..3f5d5b3b57b6b5b84e6f5891a2436b5d0caaf5e1 100644 (file)
@@ -28,9 +28,6 @@ public abstract partial class BaseSpawnEntityEntityEffect<T> : EntityEffectBase<
     [DataField]
     public bool Predicted = true;
 
-    /// <inheritdoc cref="EntityEffect.Scaling"/>
-    public override bool Scaling => true;
-
     public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
         => Loc.GetString("entity-effect-guidebook-spawn-entity",
             ("chance", Probability),
index 9d3dc3822246d90ea61002806da86cfd7a048c1f..13175cfed1cb35ed4922dd3eefb39e311c7b80f1 100644 (file)
@@ -28,8 +28,6 @@ public sealed partial class AreaReactionEffect : EntityEffectBase<AreaReactionEf
     /// </summary>
     [DataField(required: true)] public SoundSpecifier Sound = default!;
 
-    public override bool Scaling => true;
-
     public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
         => Loc.GetString("entity-effect-guidebook-area-reaction",
             ("duration", Duration)
index 334223686b45ba089123924575b73b4b4340e6ec..2cbb6d6dad0ff4a66138fa0b7757e95a30beb897 100644 (file)
@@ -49,8 +49,6 @@ public sealed partial class Emp : EntityEffectBase<Emp>
     [DataField]
     public TimeSpan Duration = TimeSpan.FromSeconds(15);
 
-    public override bool Scaling => true;
-
     public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
         => Loc.GetString("entity-effect-guidebook-emp-reaction-effect", ("chance", Probability));
 
index 2e32c434a3015f7418e39ac880e9468cc6a94a58..907c4e321f9c137a36286486f3ee1b53b02ce397 100644 (file)
@@ -50,8 +50,6 @@ public sealed partial class Explosion : EntityEffectBase<Explosion>
     [DataField]
     public float TileBreakScale = 1f;
 
-    public override bool Scaling => true;
-
     public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
         => Loc.GetString("entity-effect-guidebook-explosion", ("chance", Probability));
 
index 66d30945aa65eaf838c92d4e20b3b98e0435341d..df788e94d61b1f5ee5f081b85cab606afb003ef6 100644 (file)
@@ -76,8 +76,6 @@ public sealed partial class Flash : EntityEffectBase<Flash>
     [DataField]
     public SoundSpecifier? Sound = new SoundPathSpecifier("/Audio/Weapons/flash.ogg");
 
-    public override bool Scaling => true;
-
     public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
         => Loc.GetString("entity-effect-guidebook-flash-reaction-effect", ("chance", Probability));
 }
index 072ff8a61a7f1bbdb8bca68ddab8fccffb692c4a..e34dbe63f3438d5f8f9e787ff5e087ea1e33988f 100644 (file)
@@ -25,7 +25,7 @@ public abstract partial class EntityEffect
     /// If true, then it allows the scale multiplier to go above 1.
     /// </summary>
     [DataField]
-    public virtual bool Scaling { get; private set; }
+    public virtual bool Scaling { get; private set; } = true;
 
     // TODO: This should be an entity condition but guidebook relies on it heavily for formatting...
     /// <summary>
index 7eed94a0996db16ddd72c30758a53aa6d88d863e..8270f8bf7c419d8a5f2457f53f1b685ef048583d 100644 (file)
@@ -26,35 +26,35 @@ public sealed partial class SharedEntityEffectsSystem : EntitySystem, IEntityEff
 
     private void OnReactive(Entity<ReactiveComponent> entity, ref ReactionEntityEvent args)
     {
-        if (args.Reagent.ReactiveEffects == null || entity.Comp.ReactiveGroups == null)
-            return;
-
         var scale = args.ReagentQuantity.Quantity.Float();
 
-        foreach (var (key, val) in args.Reagent.ReactiveEffects)
+        if (args.Reagent.ReactiveEffects != null && entity.Comp.ReactiveGroups != null)
         {
-            if (!val.Methods.Contains(args.Method))
-                continue;
+            foreach (var (key, val) in args.Reagent.ReactiveEffects)
+            {
+                if (!val.Methods.Contains(args.Method))
+                    continue;
 
-            if (!entity.Comp.ReactiveGroups.TryGetValue(key, out var group))
-                continue;
+                if (!entity.Comp.ReactiveGroups.TryGetValue(key, out var group))
+                    continue;
 
-            if (!group.Contains(args.Method))
-                continue;
+                if (!group.Contains(args.Method))
+                    continue;
 
-            ApplyEffects(entity, val.Effects, scale);
+                ApplyEffects(entity, val.Effects, scale);
+            }
         }
 
-        if (entity.Comp.Reactions == null)
-            return;
-
-        foreach (var entry in entity.Comp.Reactions)
+        if (entity.Comp.Reactions != null)
         {
-            if (!entry.Methods.Contains(args.Method))
-                continue;
-
-            if (entry.Reagents == null || entry.Reagents.Contains(args.Reagent.ID))
-                ApplyEffects(entity, entry.Effects, scale);
+            foreach (var entry in entity.Comp.Reactions)
+            {
+                if (!entry.Methods.Contains(args.Method))
+                    continue;
+
+                if (entry.Reagents == null || entry.Reagents.Contains(args.Reagent.ID))
+                    ApplyEffects(entity, entry.Effects, scale);
+            }
         }
     }
 
index dd3fd5d4308e6c94e963f488aad88e0ab581a8ae..64fa4e22924d48adf349a5f63bdacb863badd0bf 100644 (file)
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           groups:
             Brute: -0.15
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           groups:
             Brute: -0.25
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           groups:
             Brute: -1
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Heat: 1
index a239ede7b06c2ac224d335c702b794c92d7f7539..95cf95bcbcd5b6395a8e1bb7a20fc8dbbca7debd 100644 (file)
@@ -79,7 +79,6 @@
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Heat: 0.05 #Same as slime species
index 69a1b932457d885512be8d13ae04efd0a01d6c84..4dc0778efb5a218dd0179060e7b9ff1fc55e6a37 100644 (file)
       methods: [Touch, Ingestion, Injection]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Caustic: 1
index fa992ded0baca7ad746a22cdb4f417a6751bcc2c..6cad3bdfc59a8d7f7ffebadcdfed9f11cfbd415f 100644 (file)
@@ -48,7 +48,6 @@
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Blunt: 0.05
@@ -63,7 +62,6 @@
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Poison: 0.125
index ca6301b0a4c78915e0e530bb0306c947368be0f0..fb4dd0cdd6adf4d4a41e9f61f686c77ca8523674 100644 (file)
@@ -81,7 +81,6 @@
       methods: [ Touch ]
       effects: # TODO: when magic is around - make a milk transformation to a skeleton monster
       - !type:HealthChange
-        scaling: true
         damage:
           groups:
             Burn: -1 # healing obviously up to discussion
index 9526b490e3243d4305a584afd9073037148d68a7..1ca590d49658f6d65cb27dd1383e7defe47b7cb1 100644 (file)
@@ -87,7 +87,6 @@
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         damage:
           types:
             Heat: 0.05
index 3b8196c30ba329a646c2069afb0bb4e728b4579d..157a9616ab1e0673a936c82bd30ec30fdc9bbce2 100644 (file)
@@ -75,7 +75,6 @@
         methods: [Touch]
         effects:
         - !type:HealthChange
-          scaling: true
           damage:
             types:
               Heat: 0.5
index d21de700316210a20e6dc53a5debbd38247a3c77..d80dc5f8b318afc803958de6ad49e546f7ac7fdb 100644 (file)
     Gas:
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: true
         conditions:
         - !type:MetabolizerTypeCondition
index eb5ceba470345b283a999a5e3ffa80cdeae80095..c2698b2b29dfb771c962af1af8901d78bfc9a225 100644 (file)
         - !type:ReagentCondition
           reagent: Ammonia
           min: 1
-        scaling: true
         ignoreResistances: true
         damage:
           groups:
index f6bddeee2d413afb964d2f048d2d633429a57e94..781e816ac48e7056c00f2f001d47fba578689f76 100644 (file)
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types:
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types:
index 6a0b2578776ced762cdbc480e6ef7228d4ed3fd7..b7e82d0960bfa0197f2601922733271494fe8f3c 100644 (file)
     Poison:
       effects:
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Human, Animal, Rat, Plant ]
       # Convert Oxygen into CO2.
       - !type:ModifyLungGas
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox ]
@@ -29,7 +27,6 @@
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox ]
-        scaling: true
         ignoreResistances: true
         damage:
           types:
     Gas:
       effects:
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Human, Animal, Rat, Plant ]
       # Convert Oxygen into CO2.
       - !type:ModifyLungGas
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox ]
@@ -63,7 +58,6 @@
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox ]
-        scaling: true
         ignoreResistances: true
         damage:
           types:
     Gas:
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: true
         damage:
           types:
     Gas:
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: true
         damage:
           types:
     Poison:
       effects:
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Plant ]
         - !type:MetabolizerTypeCondition
           type: [ Plant, Vox ]
           inverted: true
-        scaling: true
         ignoreResistances: true
         damage:
           types:
             Poison:
               0.4
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Plant ]
     Gas:
       effects:
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Plant ]
           inverted: true
         # Don't want people to get toxin damage from the gas they just
         # exhaled, right?
-        scaling: true
         ignoreResistances: true
         damage:
           types:
             Poison:
               0.8
       - !type:Oxygenate # carbon dioxide displaces oxygen from the bloodstream, causing asphyxiation
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Plant ]
     Gas:
       effects:
       - !type:Oxygenate
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox, Slime ]
       # Converts Nitrogen into Ammonia
       - !type:ModifyLungGas
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Vox ]
           Ammonia: 1.0
           Nitrogen: -1.0
       - !type:ModifyLungGas
-        scaling: true
         conditions:
         - !type:MetabolizerTypeCondition
           type: [ Slime ]
     Narcotic:
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: true
         damage:
           types:
       effects:
       - !type:HealthChange
         minScale: 1
-        scaling: true
         ignoreResistances: true
         damage:
           types:
index 9569faf01d45aecc8e2d16372324518ca2efce43..84b5535802b481bc541becfe0b3b212d69e7da8c 100644 (file)
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types:
index ea7437aa7b57ffd5fe26d7f9267475bfd24b12db..4a7527032523c381db05a1b92016f334d1de7f1f 100644 (file)
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types:
       - !type:SatiateThirst
         factor: -1.5
       - !type:HealthChange
-        scaling: true
         ignoreResistances: true
         damage:
           types:
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types:
       methods: [ Touch ]
       effects:
       - !type:HealthChange
-        scaling: true
         ignoreResistances: false
         damage:
           types: