Carry over other mutations when doing species mutation (#20551)

This commit is contained in:
drteaspoon420
2023-10-01 20:52:45 +03:00
committed by GitHub
parent a0699cf788
commit b5117f613b
2 changed files with 102 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ using Robust.Shared.Random;
using Content.Shared.Chemistry.Reagent;
using System.Linq;
using Content.Shared.Atmos;
using FastAccessors;
namespace Content.Server.Botany;
@@ -269,6 +270,7 @@ public sealed class MutationSystem : EntitySystem
{
seedChemQuantity.Min = 1;
seedChemQuantity.Max = 1 + amount;
seedChemQuantity.Inherent = false;
}
int potencyDivisor = (int) Math.Ceiling(100.0f / seedChemQuantity.Max);
seedChemQuantity.PotencyDivisor = potencyDivisor;
@@ -295,10 +297,7 @@ public sealed class MutationSystem : EntitySystem
return;
}
var oldSeed = seed.Clone();
seed = protoSeed.Clone();
seed.Potency = oldSeed.Potency;
seed.Yield = oldSeed.Yield;
seed = seed.SpeciesChange(protoSeed);
}
private Color RandomColor(Color color, int bits, int totalbits, float mult)
@@ -330,12 +329,14 @@ public sealed class MutationSystem : EntitySystem
{
val[otherChem.Key] = Random(0.5f) ? otherChem.Value : val[otherChem.Key];
}
// if target plant doesn't have this chemical, has 50% chance to add it.
// if target plant doesn't have this chemical, has 50% chance to add it.
else
{
if (Random(0.5f))
{
val.Add(otherChem.Key, otherChem.Value);
var fixedChem = otherChem.Value;
fixedChem.Inherent = false;
val.Add(otherChem.Key, fixedChem);
}
}
}