2022-04-16 17:32:35 +12:00
|
|
|
using Content.Server.Botany.Components;
|
2022-02-06 13:14:41 -07:00
|
|
|
using Content.Shared.FixedPoint;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Botany.Systems;
|
|
|
|
|
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class BotanySystem
|
2022-02-06 13:14:41 -07:00
|
|
|
{
|
|
|
|
|
public void ProduceGrown(EntityUid uid, ProduceComponent produce)
|
|
|
|
|
{
|
2022-04-16 17:32:35 +12:00
|
|
|
if (!TryGetSeed(produce, out var seed))
|
2022-02-06 13:14:41 -07:00
|
|
|
return;
|
|
|
|
|
|
2023-12-29 04:47:43 -08:00
|
|
|
var solutionContainer = _solutionContainerSystem.EnsureSolution(uid, produce.SolutionName, FixedPoint2.Zero, out _);
|
2023-03-06 04:11:13 +03:00
|
|
|
|
|
|
|
|
solutionContainer.RemoveAllSolution();
|
2022-02-06 13:14:41 -07:00
|
|
|
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);
|
2024-02-21 19:19:50 -05:00
|
|
|
amount = FixedPoint2.New(MathHelper.Clamp(amount.Float(), quantity.Min, quantity.Max));
|
2023-03-06 04:11:13 +03:00
|
|
|
solutionContainer.MaxVolume += amount;
|
|
|
|
|
solutionContainer.AddReagent(chem, amount);
|
2022-02-06 13:14:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|