]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Vestine now Mutates Plants to Produce Vestine (#41731)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Fri, 5 Dec 2025 17:21:47 +0000 (09:21 -0800)
committerGitHub <noreply@github.com>
Fri, 5 Dec 2025 17:21:47 +0000 (17:21 +0000)
* ready freddy!

* remove that shit

* fsasfaf

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Botany/SeedPrototype.cs
Content.Server/Botany/Systems/BotanySystem.Produce.cs
Content.Server/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffectSystem.cs
Content.Shared/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffect.cs
Resources/Locale/en-US/guidebook/entity-effects/effects.ftl
Resources/Prototypes/Hydroponics/randomChemicals.yml
Resources/Prototypes/Reagents/toxins.yml

index 253eea2df9ff1a1a92c694ec7d3acef41d8a54ea..a01d96a87816993e2da8612bce0d9969f917df04 100644 (file)
@@ -1,9 +1,6 @@
-using Content.Server.Botany.Components;
-using Content.Server.Botany.Systems;
-using Content.Server.EntityEffects.Effects.Botany;
 using Content.Shared.Atmos;
 using Content.Shared.Database;
-using Content.Shared.EntityEffects;
+using Content.Shared.FixedPoint;
 using Content.Shared.Random;
 using Robust.Shared.Audio;
 using Robust.Shared.Prototypes;
@@ -61,18 +58,18 @@ public partial struct SeedChemQuantity
     /// <summary>
     /// Minimum amount of chemical that is added to produce, regardless of the potency
     /// </summary>
-    [DataField("Min")] public int Min;
+    [DataField("Min")] public FixedPoint2 Min = FixedPoint2.Epsilon;
 
     /// <summary>
     /// Maximum amount of chemical that can be produced after taking plant potency into account.
     /// </summary>
-    [DataField("Max")] public int Max;
+    [DataField("Max")] public FixedPoint2 Max;
 
     /// <summary>
     /// When chemicals are added to produce, the potency of the seed is divided with this value. Final chemical amount is the result plus the `Min` value.
     /// Example: PotencyDivisor of 20 with seed potency of 55 results in 2.75, 55/20 = 2.75. If minimum is 1 then final result will be 3.75 of that chemical, 55/20+1 = 3.75.
     /// </summary>
-    [DataField("PotencyDivisor")] public int PotencyDivisor;
+    [DataField("PotencyDivisor")] public float PotencyDivisor;
 
     /// <summary>
     /// Inherent chemical is one that is NOT result of mutation or crossbreeding. These chemicals are removed if species mutation is executed.
index 7d8f8652c728dd74c1201914ea1668006fe43a57..bba3c48b867dc9ea154ce045fed81ff6cb07aafe 100644 (file)
@@ -29,10 +29,10 @@ public sealed partial class BotanySystem
         solutionContainer.RemoveAllSolution();
         foreach (var (chem, quantity) in seed.Chemicals)
         {
-            var amount = FixedPoint2.New(quantity.Min);
+            var amount = quantity.Min;
             if (quantity.PotencyDivisor > 0 && seed.Potency > 0)
-                amount += FixedPoint2.New(seed.Potency / quantity.PotencyDivisor);
-            amount = FixedPoint2.New(MathHelper.Clamp(amount.Float(), quantity.Min, quantity.Max));
+                amount += seed.Potency / quantity.PotencyDivisor;
+            amount = FixedPoint2.Clamp(amount, quantity.Min, quantity.Max);
             solutionContainer.MaxVolume += amount;
             solutionContainer.AddReagent(chem, amount);
         }
index 120ae6e881a942c5f4b32f7f4d42a88526f6b470..d5589966b11ed6a96b7a11903a72bc5814172607 100644 (file)
@@ -2,6 +2,7 @@ using Content.Server.Botany;
 using Content.Server.Botany.Components;
 using Content.Shared.EntityEffects;
 using Content.Shared.EntityEffects.Effects.Botany;
+using Content.Shared.FixedPoint;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Random;
 
@@ -23,7 +24,7 @@ public sealed partial class PlantMutateChemicalsEntityEffectSystem : EntityEffec
         // Add a random amount of a random chemical to this set of chemicals
         var pick = _random.Pick(randomChems);
         var chemicalId = _random.Pick(pick.Reagents);
-        var amount = _random.Next(1, (int)pick.Quantity);
+        var amount = _random.NextFloat(0.1f, (float)pick.Quantity);
         var seedChemQuantity = new SeedChemQuantity();
         if (chemicals.ContainsKey(chemicalId))
         {
@@ -32,12 +33,12 @@ public sealed partial class PlantMutateChemicalsEntityEffectSystem : EntityEffec
         }
         else
         {
-            seedChemQuantity.Min = 1;
-            seedChemQuantity.Max = 1 + amount;
+            seedChemQuantity.Min = FixedPoint2.Epsilon;
+            seedChemQuantity.Max = FixedPoint2.Zero + amount;
             seedChemQuantity.Inherent = false;
         }
-        var potencyDivisor = (int)Math.Ceiling(100.0f / seedChemQuantity.Max);
-        seedChemQuantity.PotencyDivisor = potencyDivisor;
+        var potencyDivisor = 100f / seedChemQuantity.Max;
+        seedChemQuantity.PotencyDivisor = (float) potencyDivisor;
         chemicals[chemicalId] = seedChemQuantity;
     }
 }
index 6a3d13e0c64a6d13d187fcabdbb61627e555eb2a..df119c6e40d66ce36e5fde53ded3198847f6093c 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Shared.Localizations;
 using Content.Shared.Random;
 using Robust.Shared.Prototypes;
 
@@ -13,4 +14,29 @@ public sealed partial class PlantMutateChemicals : EntityEffectBase<PlantMutateC
     /// </summary>
     [DataField]
     public ProtoId<WeightedRandomFillSolutionPrototype> RandomPickBotanyReagent = "RandomPickBotanyReagent";
+
+    /// <inheritdoc/>
+    public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
+    {
+        var list = new List<string>();
+
+        // If your table doesn't exist, no guidebook for you!
+        if (!prototype.Resolve(RandomPickBotanyReagent, out var table))
+            return string.Empty;
+
+        foreach (var fill in table.Fills)
+        {
+            foreach (var reagent in fill.Reagents)
+            {
+                if (!prototype.Resolve(reagent, out var proto))
+                    continue;
+
+                list.Add(proto.LocalizedName);
+            }
+        }
+
+        var names = ContentLocalizationManager.FormatListToOr(list);
+
+        return Loc.GetString("entity-effect-guidebook-plant-mutate-chemicals", ("chance", Probability), ("name", names));
+    }
 }
index bbfaca7ee91ac5d38e4c9e47157bb78efce52bde..fccc6291a8fc5203072e78c3f079aa5eebb32f1c 100644 (file)
@@ -512,3 +512,9 @@ entity-effect-guidebook-plant-seeds-remove =
         [1] Removes the
         *[other] remove the
     } seeds of the plant
+
+entity-effect-guidebook-plant-mutate-chemicals =
+    { $chance ->
+        [1] Mutates
+        *[other] mutate
+    } a plant to produce {$name}
index bdafb60087aa3d7c9d6a7a6bb1bb0942c5a894f3..52f66ed78f3914a52cd40c139eaf7736a3de7e98 100644 (file)
     - TableSalt
     - Chlorine
     - Mercury
+
+- type: weightedRandomFillSolution
+  id: EvilRandomFillSolution
+  fills:
+  - quantity: 0.1 # Common but low quantity
+    weight: 20
+    reagents:
+    - Vestine
+  - quantity: 0.5 # High quantity but uncommon
+    weight: 10
+    reagents:
+    - Stimulants
+    - MuteToxin
+  - quantity: 0.5 # High quantity but very rare
+    weight: 1
+    reagents:
+    - Tazinide
+    - Lead
+    - Nocturine
+    - Lexorin
index 79f8e5cc2985d39bb772d9c3cbda403d35cf41da..baf39989b80b66b217a55c6aba0dc3e93b205273 100644 (file)
   contrabandSeverity: Syndicate
   flavor: medicine
   color: "#435166"
+  plantMetabolism:
+  - !type:PlantMutateChemicals
+    randomPickBotanyReagent: EvilRandomFillSolution
   metabolisms:
     Poison:
       effects: