From: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Date: Fri, 5 Dec 2025 17:21:47 +0000 (-0800) Subject: Vestine now Mutates Plants to Produce Vestine (#41731) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=8054071c325d730d3c0f112c93f174a896897df7;p=space-station-14.git Vestine now Mutates Plants to Produce Vestine (#41731) * ready freddy! * remove that shit * fsasfaf --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> --- diff --git a/Content.Server/Botany/SeedPrototype.cs b/Content.Server/Botany/SeedPrototype.cs index 253eea2df9..a01d96a878 100644 --- a/Content.Server/Botany/SeedPrototype.cs +++ b/Content.Server/Botany/SeedPrototype.cs @@ -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 /// /// Minimum amount of chemical that is added to produce, regardless of the potency /// - [DataField("Min")] public int Min; + [DataField("Min")] public FixedPoint2 Min = FixedPoint2.Epsilon; /// /// Maximum amount of chemical that can be produced after taking plant potency into account. /// - [DataField("Max")] public int Max; + [DataField("Max")] public FixedPoint2 Max; /// /// 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. /// - [DataField("PotencyDivisor")] public int PotencyDivisor; + [DataField("PotencyDivisor")] public float PotencyDivisor; /// /// Inherent chemical is one that is NOT result of mutation or crossbreeding. These chemicals are removed if species mutation is executed. diff --git a/Content.Server/Botany/Systems/BotanySystem.Produce.cs b/Content.Server/Botany/Systems/BotanySystem.Produce.cs index 7d8f8652c7..bba3c48b86 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Produce.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Produce.cs @@ -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); } diff --git a/Content.Server/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffectSystem.cs b/Content.Server/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffectSystem.cs index 120ae6e881..d5589966b1 100644 --- a/Content.Server/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffectSystem.cs +++ b/Content.Server/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffectSystem.cs @@ -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; } } diff --git a/Content.Shared/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffect.cs b/Content.Shared/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffect.cs index 6a3d13e0c6..df119c6e40 100644 --- a/Content.Shared/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffect.cs +++ b/Content.Shared/EntityEffects/Effects/Botany/PlantMutateChemicalsEntityEffect.cs @@ -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 [DataField] public ProtoId RandomPickBotanyReagent = "RandomPickBotanyReagent"; + + /// + public override string EntityEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) + { + var list = new List(); + + // 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)); + } } diff --git a/Resources/Locale/en-US/guidebook/entity-effects/effects.ftl b/Resources/Locale/en-US/guidebook/entity-effects/effects.ftl index bbfaca7ee9..fccc6291a8 100644 --- a/Resources/Locale/en-US/guidebook/entity-effects/effects.ftl +++ b/Resources/Locale/en-US/guidebook/entity-effects/effects.ftl @@ -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} diff --git a/Resources/Prototypes/Hydroponics/randomChemicals.yml b/Resources/Prototypes/Hydroponics/randomChemicals.yml index bdafb60087..52f66ed78f 100644 --- a/Resources/Prototypes/Hydroponics/randomChemicals.yml +++ b/Resources/Prototypes/Hydroponics/randomChemicals.yml @@ -121,3 +121,23 @@ - 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 diff --git a/Resources/Prototypes/Reagents/toxins.yml b/Resources/Prototypes/Reagents/toxins.yml index 79f8e5cc29..baf39989b8 100644 --- a/Resources/Prototypes/Reagents/toxins.yml +++ b/Resources/Prototypes/Reagents/toxins.yml @@ -639,6 +639,9 @@ contrabandSeverity: Syndicate flavor: medicine color: "#435166" + plantMetabolism: + - !type:PlantMutateChemicals + randomPickBotanyReagent: EvilRandomFillSolution metabolisms: Poison: effects: