mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
* ready freddy! * remove that shit * fsasfaf --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using Content.Server.Botany.Components;
|
|
using Content.Shared.EntityEffects;
|
|
using Content.Shared.Examine;
|
|
using Content.Shared.FixedPoint;
|
|
|
|
namespace Content.Server.Botany.Systems;
|
|
|
|
public sealed partial class BotanySystem
|
|
{
|
|
[Dependency] private readonly SharedEntityEffectsSystem _entityEffects = default!;
|
|
|
|
public void ProduceGrown(EntityUid uid, ProduceComponent produce)
|
|
{
|
|
if (!TryGetSeed(produce, out var seed))
|
|
return;
|
|
|
|
foreach (var mutation in seed.Mutations)
|
|
{
|
|
if (mutation.AppliesToProduce)
|
|
_entityEffects.TryApplyEffect(uid, mutation.Effect);
|
|
}
|
|
|
|
if (!_solutionContainerSystem.EnsureSolution(uid,
|
|
produce.SolutionName,
|
|
out var solutionContainer,
|
|
FixedPoint2.Zero))
|
|
return;
|
|
|
|
solutionContainer.RemoveAllSolution();
|
|
foreach (var (chem, quantity) in seed.Chemicals)
|
|
{
|
|
var amount = quantity.Min;
|
|
if (quantity.PotencyDivisor > 0 && seed.Potency > 0)
|
|
amount += seed.Potency / quantity.PotencyDivisor;
|
|
amount = FixedPoint2.Clamp(amount, quantity.Min, quantity.Max);
|
|
solutionContainer.MaxVolume += amount;
|
|
solutionContainer.AddReagent(chem, amount);
|
|
}
|
|
}
|
|
|
|
public void OnProduceExamined(EntityUid uid, ProduceComponent comp, ExaminedEvent args)
|
|
{
|
|
if (comp.Seed == null)
|
|
return;
|
|
|
|
using (args.PushGroup(nameof(ProduceComponent)))
|
|
{
|
|
foreach (var m in comp.Seed.Mutations)
|
|
{
|
|
// Don't show mutations that have no effect on produce (sentience)
|
|
if (!m.AppliesToProduce)
|
|
continue;
|
|
|
|
if (m.Description != null)
|
|
args.PushMarkup(Loc.GetString(m.Description));
|
|
}
|
|
}
|
|
}
|
|
}
|