]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Prevent Vestine and all other Botany chemicals from affecting all seeds. (#41883)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Tue, 16 Dec 2025 23:30:15 +0000 (15:30 -0800)
committerGitHub <noreply@github.com>
Tue, 16 Dec 2025 23:30:15 +0000 (23:30 +0000)
* EnsureUniqueSeed

* mfw

aaaaaaaaaaaaa

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Botany/Systems/PlantHolderSystem.cs
Content.Server/EntityEffects/Effects/Botany/PlantAttributes/PlantAdjustPotencyEntityEffectSystem.cs
Content.Server/EntityEffects/Effects/Botany/PlantAttributes/PlantDestroySeedsEntityEffectSystem.cs
Content.Server/EntityEffects/Effects/Botany/PlantAttributes/PlantDiethylamineEntityEffectSystem.cs
Content.Server/EntityEffects/Effects/Botany/PlantAttributes/PlantRestoreSeedsEntityEffectSystem.cs
Content.Server/EntityEffects/Effects/Botany/PlantAttributes/RobustHarvestEntityEffectSystem.cs
Content.Shared/Chemistry/Reaction/ChemicalReactionSystem.cs
Content.Shared/EntityEffects/SharedEntityEffectsSystem.cs

index d5f331c157f3c1e0c24ab47b3836f66f6befd310..3959ffc47f41c814fc2409059410b41d0f342cd4 100644 (file)
@@ -53,6 +53,7 @@ public sealed class PlantHolderSystem : EntitySystem
 
     public const float HydroponicsSpeedMultiplier = 1f;
     public const float HydroponicsConsumptionMultiplier = 2f;
+    public readonly FixedPoint2 PlantMetabolismRate = FixedPoint2.New(1);
 
     private static readonly ProtoId<TagPrototype> HoeTag = "Hoe";
     private static readonly ProtoId<TagPrototype> PlantSampleTakerTag = "PlantSampleTaker";
@@ -885,13 +886,18 @@ public sealed class PlantHolderSystem : EntitySystem
 
         if (solution.Volume > 0 && component.MutationLevel < 25)
         {
-            foreach (var entry in component.SoilSolution.Value.Comp.Solution.Contents)
+            // Don't apply any effects to a non-unique seed ever! Remove this when botany code is sane...
+            EnsureUniqueSeed(uid, component);
+            foreach (var entry in solution.Contents)
             {
+                if (entry.Quantity < PlantMetabolismRate)
+                    continue;
+
                 var reagentProto = _prototype.Index<ReagentPrototype>(entry.Reagent.Prototype);
-                _entityEffects.ApplyEffects(uid, reagentProto.PlantMetabolisms.ToArray(), entry.Quantity.Float());
+                _entityEffects.ApplyEffects(uid, reagentProto.PlantMetabolisms.ToArray(), entry.Quantity);
             }
 
-            _solutionContainerSystem.RemoveEachReagent(component.SoilSolution.Value, FixedPoint2.New(1));
+            _solutionContainerSystem.RemoveEachReagent(component.SoilSolution.Value, PlantMetabolismRate);
         }
 
         CheckLevelSanity(uid, component);
index ebe5c83181c3542a5e6d34d03d9a00030087065e..f63d49f209a605b27c84f31c9acd7ed96a643932 100644 (file)
@@ -7,13 +7,11 @@ namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
 
 public sealed partial class PlantAdjustPotencyEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, PlantAdjustPotency>
 {
-    [Dependency] private readonly PlantHolderSystem _plantHolder = default!;
     protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<PlantAdjustPotency> args)
     {
         if (entity.Comp.Seed == null || entity.Comp.Dead)
             return;
 
-        _plantHolder.EnsureUniqueSeed(entity, entity.Comp);
         entity.Comp.Seed.Potency = Math.Max(entity.Comp.Seed.Potency + args.Effect.Amount, 1);
     }
 }
index 1661c501be151f42f952957d9981f028fa7119da..5139c43c0fc6a0e08bff8caed8d242f665037df7 100644 (file)
@@ -9,7 +9,6 @@ namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
 
 public sealed partial class PlantDestroySeedsEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, PlantDestroySeeds>
 {
-    [Dependency] private readonly PlantHolderSystem _plantHolder = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
 
     protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<PlantDestroySeeds> args)
@@ -20,7 +19,6 @@ public sealed partial class PlantDestroySeedsEntityEffectSystem : EntityEffectSy
         if (entity.Comp.Seed.Seedless)
             return;
 
-        _plantHolder.EnsureUniqueSeed(entity, entity.Comp);
         _popup.PopupEntity(
             Loc.GetString("botany-plant-seedsdestroyed"),
             entity,
index f6aebde465d24c77ce592e5b3b59cb43d37f3dfd..4da542df931d0a97ba36e1e47735d80f2941b1c1 100644 (file)
@@ -9,7 +9,6 @@ namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
 public sealed partial class PlantDiethylamineEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, PlantDiethylamine>
 {
     [Dependency] private readonly IRobustRandom _random = default!;
-    [Dependency] private readonly PlantHolderSystem _plantHolder = default!;
 
     protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<PlantDiethylamine> args)
     {
@@ -18,13 +17,11 @@ public sealed partial class PlantDiethylamineEntityEffectSystem : EntityEffectSy
 
         if (_random.Prob(0.1f))
         {
-            _plantHolder.EnsureUniqueSeed(entity, entity);
             entity.Comp.Seed!.Lifespan++;
         }
 
         if (_random.Prob(0.1f))
         {
-            _plantHolder.EnsureUniqueSeed(entity, entity);
             entity.Comp.Seed!.Endurance++;
         }
     }
index 4d724be2443671dc44fdacb2b9b8834924101bd8..a120a1eccde5654708857f419f78085e54c00b79 100644 (file)
@@ -8,7 +8,6 @@ namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
 
 public sealed partial class PlantRestoreSeedsEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, PlantRestoreSeeds>
 {
-    [Dependency] private readonly PlantHolderSystem _plantHolder = default!;
     [Dependency] private readonly PopupSystem _popup = default!;
 
     protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<PlantRestoreSeeds> args)
@@ -19,7 +18,6 @@ public sealed partial class PlantRestoreSeedsEntityEffectSystem : EntityEffectSy
         if (!entity.Comp.Seed.Seedless)
             return;
 
-        _plantHolder.EnsureUniqueSeed(entity, entity.Comp);
         _popup.PopupEntity(Loc.GetString("botany-plant-seedsrestored"), entity);
         entity.Comp.Seed.Seedless = false;
     }
index 68ea3319ef41e295b969f310e9338f5309e9612b..a957de82b4db55d0cd3198a2d1952b86802106be 100644 (file)
@@ -14,7 +14,6 @@ namespace Content.Server.EntityEffects.Effects.Botany.PlantAttributes;
 public sealed partial class RobustHarvestEntityEffectSystem : EntityEffectSystem<PlantHolderComponent, RobustHarvest>
 {
     [Dependency] private readonly IRobustRandom _random = default!;
-    [Dependency] private readonly PlantHolderSystem _plantHolder = default!;
 
     protected override void Effect(Entity<PlantHolderComponent> entity, ref EntityEffectEvent<RobustHarvest> args)
     {
@@ -23,7 +22,6 @@ public sealed partial class RobustHarvestEntityEffectSystem : EntityEffectSystem
 
         if (entity.Comp.Seed.Potency < args.Effect.PotencyLimit)
         {
-            _plantHolder.EnsureUniqueSeed(entity, entity.Comp);
             entity.Comp.Seed.Potency = Math.Min(entity.Comp.Seed.Potency + args.Effect.PotencyIncrease, args.Effect.PotencyLimit);
 
             if (entity.Comp.Seed.Potency > args.Effect.PotencySeedlessThreshold)
@@ -34,7 +32,6 @@ public sealed partial class RobustHarvestEntityEffectSystem : EntityEffectSystem
         else if (entity.Comp.Seed.Yield > 1 && _random.Prob(0.1f))
         {
             // Too much of a good thing reduces yield
-            _plantHolder.EnsureUniqueSeed(entity, entity.Comp);
             entity.Comp.Seed.Yield--;
         }
     }
index a995ef90f40a70ffb85ab56cc42d17b345d5ff64..bc168521f8c2e0d14b85f04953520b81cb99c838 100644 (file)
@@ -211,7 +211,7 @@ namespace Content.Shared.Chemistry.Reaction
             _adminLogger.Add(LogType.ChemicalReaction, reaction.Impact,
                 $"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(soln):metabolizer} at Pos:{(posFound ? $"{gridPos:coordinates}" : "[Grid or Map not Found]")}");
 
-            _entityEffects.ApplyEffects(soln, reaction.Effects, unitReactions.Float());
+            _entityEffects.ApplyEffects(soln, reaction.Effects, unitReactions);
 
             // Someday, some brave soul will thread through an optional actor
             // argument in from every call of OnReaction up, all just to pass
index 8270f8bf7c419d8a5f2457f53f1b685ef048583d..2da23a25023fc2f05c4ddb378c4a19080d43e854 100644 (file)
@@ -2,6 +2,7 @@ using Content.Shared.Administration.Logs;
 using Content.Shared.Chemistry;
 using Content.Shared.Chemistry.Reaction;
 using Content.Shared.EntityConditions;
+using Content.Shared.FixedPoint;
 using Content.Shared.Random.Helpers;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
@@ -58,6 +59,12 @@ public sealed partial class SharedEntityEffectsSystem : EntitySystem, IEntityEff
         }
     }
 
+    /// <inheritdoc cref="ApplyEffects(EntityUid,EntityEffect[],float,EntityUid?)"/>
+    public void ApplyEffects(EntityUid target, EntityEffect[] effects, FixedPoint2 scale, EntityUid? user = null)
+    {
+        ApplyEffects(target, effects, scale.Float());
+    }
+
     /// <summary>
     /// Applies a list of entity effects to a target entity.
     /// </summary>