Files
wwdpublic/Content.Server/Botany/Systems/BotanySystem.Produce.cs
genderGeometries 6d902b62a6 Crop harvest int cast fix (#25453)
* deleted int cast on solution amount

* deleted int cast on solution amount for real

(cherry picked from commit 1360d57eea3938ee61899e03f0b5e2aefd425ea9)
2024-03-05 09:46:14 +01:00

27 lines
973 B
C#

using Content.Server.Botany.Components;
using Content.Shared.FixedPoint;
namespace Content.Server.Botany.Systems;
public sealed partial class BotanySystem
{
public void ProduceGrown(EntityUid uid, ProduceComponent produce)
{
if (!TryGetSeed(produce, out var seed))
return;
var solutionContainer = _solutionContainerSystem.EnsureSolution(uid, produce.SolutionName, FixedPoint2.Zero, out _);
solutionContainer.RemoveAllSolution();
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(MathHelper.Clamp(amount.Float(), quantity.Min, quantity.Max));
solutionContainer.MaxVolume += amount;
solutionContainer.AddReagent(chem, amount);
}
}
}