-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;
/// <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.
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);
}
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;
// 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))
{
}
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;
}
}
+using Content.Shared.Localizations;
using Content.Shared.Random;
using Robust.Shared.Prototypes;
/// </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));
+ }
}
[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}
- 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
contrabandSeverity: Syndicate
flavor: medicine
color: "#435166"
+ plantMetabolism:
+ - !type:PlantMutateChemicals
+ randomPickBotanyReagent: EvilRandomFillSolution
metabolisms:
Poison:
effects: