make biogenerator not accept low-nutrient plants (#38427)

* anti-noob

* dsaswa

* Minor grammar change

---------

Co-authored-by: beck-thompson <beck314159@hotmail.com>
This commit is contained in:
kosticia
2025-07-14 11:17:46 +03:00
committed by GitHub
parent c60910dfa6
commit d9545dd380
2 changed files with 13 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ using Content.Server.Materials.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Robust.Server.Audio;
namespace Content.Server.Materials;
@@ -13,6 +14,7 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
/// <inheritdoc/>
public override void Initialize()
@@ -39,7 +41,16 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem
var matAmount = solution.Value.Comp.Solution.Contents
.Where(r => ent.Comp.ExtractionReagents.Contains(r.Reagent.Prototype))
.Sum(r => r.Quantity.Float());
_materialStorage.TryChangeMaterialAmount(ent, ent.Comp.ExtractedMaterial, (int) matAmount);
var changed = (int)matAmount;
if (changed == 0)
{
_popup.PopupEntity(Loc.GetString("material-extractor-comp-wrongreagent", ("used", args.Used)), args.User, args.User);
return;
}
_materialStorage.TryChangeMaterialAmount(ent, ent.Comp.ExtractedMaterial, changed);
_audio.PlayPvs(ent.Comp.ExtractSound, ent);
QueueDel(args.Used);