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>
This commit is contained in:
Princess Cheeseballs
2025-12-05 09:21:47 -08:00
committed by GitHub
parent ce0126b725
commit 8054071c32
7 changed files with 68 additions and 15 deletions

View 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.

View 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);
}

View 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;
}
}

View 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));
}
}

View 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}

View File

@@ -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

View File

@@ -639,6 +639,9 @@
contrabandSeverity: Syndicate
flavor: medicine
color: "#435166"
plantMetabolism:
- !type:PlantMutateChemicals
randomPickBotanyReagent: EvilRandomFillSolution
metabolisms:
Poison:
effects: