Solution rejig (#12428)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Botany.Components;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
@@ -17,17 +18,17 @@ public sealed partial class BotanySystem
|
||||
sprite.LayerSetState(0, seed.PlantIconState);
|
||||
}
|
||||
|
||||
var solutionContainer = _solutionContainerSystem.EnsureSolution(uid, produce.SolutionName);
|
||||
|
||||
solutionContainer.RemoveAllSolution();
|
||||
Solution.ReagentQuantity[] reagents = new Solution.ReagentQuantity[seed.Chemicals.Count];
|
||||
int i = 0;
|
||||
foreach (var (chem, quantity) in seed.Chemicals)
|
||||
{
|
||||
var amount = FixedPoint2.New(quantity.Min);
|
||||
if (quantity.PotencyDivisor > 0 && seed.Potency > 0)
|
||||
amount += FixedPoint2.New(seed.Potency / quantity.PotencyDivisor);
|
||||
amount = FixedPoint2.New((int) MathHelper.Clamp(amount.Float(), quantity.Min, quantity.Max));
|
||||
solutionContainer.MaxVolume += amount;
|
||||
solutionContainer.AddReagent(chem, amount);
|
||||
reagents[i++] = new(chem, amount);
|
||||
}
|
||||
|
||||
_solutionContainerSystem.EnsureSolution(uid, produce.SolutionName, reagents);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user