From db1f32c9e648ebad42ab04272eda299b33e2a4e2 Mon Sep 17 00:00:00 2001 From: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Date: Thu, 6 Nov 2025 13:34:53 -0800 Subject: [PATCH] Fix Entity Effect Scaling (Hopefully) for good and some other misc fixes (#41163) * Fix the last of the entity effects bugs * aaa * losing it --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> --- .../ReagentEntityConditionSystem.cs | 2 +- .../BaseSpawnEntityEntityEffect.cs | 3 -- .../Solution/AreaReactionEntityEffect.cs | 2 - .../Transform/EmpEntityEffectSystem.cs | 2 - .../Transform/ExplosionEntityEffect.cs | 2 - .../Transform/FlashEntityEffectSystem.cs | 2 - Content.Shared/EntityEffects/EntityEffect.cs | 2 +- .../SharedEntityEffectsSystem.cs | 38 +++++++++---------- .../Entities/Mobs/NPCs/miscellaneous.yml | 4 -- .../Prototypes/Entities/Mobs/NPCs/slimes.yml | 1 - .../Prototypes/Entities/Mobs/NPCs/space.yml | 1 - .../Entities/Mobs/Species/diona.yml | 2 - .../Entities/Mobs/Species/skeleton.yml | 1 - .../Entities/Mobs/Species/slime.yml | 1 - .../Entities/Objects/Misc/kudzu.yml | 1 - .../Reagents/Consumable/Drink/drinks.yml | 1 - Resources/Prototypes/Reagents/fun.yml | 2 - Resources/Prototypes/Reagents/gases.yml | 19 ---------- Resources/Prototypes/Reagents/medicine.yml | 1 - Resources/Prototypes/Reagents/toxins.yml | 4 -- 20 files changed, 21 insertions(+), 70 deletions(-) diff --git a/Content.Shared/EntityConditions/Conditions/ReagentEntityConditionSystem.cs b/Content.Shared/EntityConditions/Conditions/ReagentEntityConditionSystem.cs index dbe585e631..c1da05ae30 100644 --- a/Content.Shared/EntityConditions/Conditions/ReagentEntityConditionSystem.cs +++ b/Content.Shared/EntityConditions/Conditions/ReagentEntityConditionSystem.cs @@ -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. /// /// -public sealed partial class ReagentThresholdEntityConditionSystem : EntityConditionSystem +public sealed partial class ReagentEntityConditionSystem : EntityConditionSystem { protected override void Condition(Entity entity, ref EntityConditionEvent args) { diff --git a/Content.Shared/EntityEffects/Effects/EntitySpawning/BaseSpawnEntityEntityEffect.cs b/Content.Shared/EntityEffects/Effects/EntitySpawning/BaseSpawnEntityEntityEffect.cs index bd8d68813e..3f5d5b3b57 100644 --- a/Content.Shared/EntityEffects/Effects/EntitySpawning/BaseSpawnEntityEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/EntitySpawning/BaseSpawnEntityEntityEffect.cs @@ -28,9 +28,6 @@ public abstract partial class BaseSpawnEntityEntityEffect : EntityEffectBase< [DataField] public bool Predicted = true; - /// - public override bool Scaling => true; - public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) => Loc.GetString("entity-effect-guidebook-spawn-entity", ("chance", Probability), diff --git a/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs index 9d3dc38222..13175cfed1 100644 --- a/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Solution/AreaReactionEntityEffect.cs @@ -28,8 +28,6 @@ public sealed partial class AreaReactionEffect : EntityEffectBase [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) diff --git a/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs b/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs index 334223686b..2cbb6d6dad 100644 --- a/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs +++ b/Content.Shared/EntityEffects/Effects/Transform/EmpEntityEffectSystem.cs @@ -49,8 +49,6 @@ public sealed partial class Emp : EntityEffectBase [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)); diff --git a/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs index 2e32c434a3..907c4e321f 100644 --- a/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Transform/ExplosionEntityEffect.cs @@ -50,8 +50,6 @@ public sealed partial class Explosion : EntityEffectBase [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)); diff --git a/Content.Shared/EntityEffects/Effects/Transform/FlashEntityEffectSystem.cs b/Content.Shared/EntityEffects/Effects/Transform/FlashEntityEffectSystem.cs index 66d30945aa..df788e94d6 100644 --- a/Content.Shared/EntityEffects/Effects/Transform/FlashEntityEffectSystem.cs +++ b/Content.Shared/EntityEffects/Effects/Transform/FlashEntityEffectSystem.cs @@ -76,8 +76,6 @@ public sealed partial class Flash : EntityEffectBase [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)); } diff --git a/Content.Shared/EntityEffects/EntityEffect.cs b/Content.Shared/EntityEffects/EntityEffect.cs index 072ff8a61a..e34dbe63f3 100644 --- a/Content.Shared/EntityEffects/EntityEffect.cs +++ b/Content.Shared/EntityEffects/EntityEffect.cs @@ -25,7 +25,7 @@ public abstract partial class EntityEffect /// If true, then it allows the scale multiplier to go above 1. /// [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... /// diff --git a/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs b/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs index 7eed94a099..8270f8bf7c 100644 --- a/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs +++ b/Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs @@ -26,35 +26,35 @@ public sealed partial class SharedEntityEffectsSystem : EntitySystem, IEntityEff private void OnReactive(Entity 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; + 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); + if (entry.Reagents == null || entry.Reagents.Contains(args.Reagent.ID)) + ApplyEffects(entity, entry.Effects, scale); + } } } diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml b/Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml index 7b15cff5ce..cc9aff52af 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/miscellaneous.yml @@ -90,7 +90,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: groups: Brute: -0.15 @@ -98,7 +97,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: groups: Brute: -0.25 @@ -107,7 +105,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: groups: Brute: -1 @@ -116,7 +113,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: types: Heat: 1 diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml index 72c88da733..5a96810d94 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml @@ -80,7 +80,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: types: Heat: 0.05 #Same as slime species diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/space.yml b/Resources/Prototypes/Entities/Mobs/NPCs/space.yml index dadc79076e..c74663ec18 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/space.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/space.yml @@ -504,7 +504,6 @@ methods: [Touch, Ingestion, Injection] effects: - !type:HealthChange - scaling: true damage: types: Caustic: 1 diff --git a/Resources/Prototypes/Entities/Mobs/Species/diona.yml b/Resources/Prototypes/Entities/Mobs/Species/diona.yml index 5b6ef27a99..8b0246778d 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/diona.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/diona.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml index 222190d087..836d32046c 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/skeleton.yml @@ -82,7 +82,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 diff --git a/Resources/Prototypes/Entities/Mobs/Species/slime.yml b/Resources/Prototypes/Entities/Mobs/Species/slime.yml index 10e770833b..f8c7d64a9c 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/slime.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/slime.yml @@ -93,7 +93,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true damage: types: Heat: 0.05 diff --git a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml index 3b8196c30b..157a9616ab 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/kudzu.yml @@ -75,7 +75,6 @@ methods: [Touch] effects: - !type:HealthChange - scaling: true damage: types: Heat: 0.5 diff --git a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml index ac305e171f..b7827e272b 100644 --- a/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml +++ b/Resources/Prototypes/Reagents/Consumable/Drink/drinks.yml @@ -453,7 +453,6 @@ Gas: effects: - !type:HealthChange - scaling: true ignoreResistances: true conditions: - !type:MetabolizerTypeCondition diff --git a/Resources/Prototypes/Reagents/fun.yml b/Resources/Prototypes/Reagents/fun.yml index acbb928f6b..e7ccdf456a 100644 --- a/Resources/Prototypes/Reagents/fun.yml +++ b/Resources/Prototypes/Reagents/fun.yml @@ -191,7 +191,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: @@ -241,7 +240,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: diff --git a/Resources/Prototypes/Reagents/gases.yml b/Resources/Prototypes/Reagents/gases.yml index fc8bd68c0e..cf5fd74bea 100644 --- a/Resources/Prototypes/Reagents/gases.yml +++ b/Resources/Prototypes/Reagents/gases.yml @@ -11,13 +11,11 @@ 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: @@ -45,13 +42,11 @@ Gas: effects: - !type:Oxygenate - scaling: true conditions: - !type:MetabolizerTypeCondition type: [ Human, Animal, Rat, Plant, Feroxi ] # DeltaV # 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: @@ -103,7 +97,6 @@ Gas: effects: - !type:HealthChange - scaling: true ignoreResistances: true damage: types: @@ -149,7 +142,6 @@ Gas: effects: - !type:HealthChange - scaling: true ignoreResistances: true damage: types: @@ -173,7 +165,6 @@ Poison: effects: - !type:Oxygenate - scaling: true conditions: - !type:MetabolizerTypeCondition type: [ Plant ] @@ -182,14 +173,12 @@ - !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 ] @@ -198,7 +187,6 @@ Gas: effects: - !type:Oxygenate - scaling: true conditions: - !type:MetabolizerTypeCondition type: [ Plant ] @@ -210,14 +198,12 @@ 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 ] @@ -246,13 +232,11 @@ 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 ] @@ -260,7 +244,6 @@ Ammonia: 1.0 Nitrogen: -1.0 - !type:ModifyLungGas - scaling: true conditions: - !type:MetabolizerTypeCondition type: [ Slime ] @@ -373,7 +356,6 @@ Narcotic: effects: - !type:HealthChange - scaling: true ignoreResistances: true damage: types: @@ -400,7 +382,6 @@ effects: - !type:HealthChange minScale: 1 - scaling: true ignoreResistances: true damage: types: diff --git a/Resources/Prototypes/Reagents/medicine.yml b/Resources/Prototypes/Reagents/medicine.yml index 65840a75a4..3ddc290cea 100644 --- a/Resources/Prototypes/Reagents/medicine.yml +++ b/Resources/Prototypes/Reagents/medicine.yml @@ -1203,7 +1203,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: diff --git a/Resources/Prototypes/Reagents/toxins.yml b/Resources/Prototypes/Reagents/toxins.yml index e15fa76e70..1ab7849eef 100644 --- a/Resources/Prototypes/Reagents/toxins.yml +++ b/Resources/Prototypes/Reagents/toxins.yml @@ -157,7 +157,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: @@ -196,7 +195,6 @@ - !type:SatiateThirst factor: -1.5 - !type:HealthChange - scaling: true ignoreResistances: true damage: types: @@ -219,7 +217,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: @@ -269,7 +266,6 @@ methods: [ Touch ] effects: - !type:HealthChange - scaling: true ignoreResistances: false damage: types: