]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
make biogenerator not accept low-nutrient plants (#38427)
authorkosticia <kosticia46@gmail.com>
Mon, 14 Jul 2025 08:17:46 +0000 (11:17 +0300)
committerGitHub <noreply@github.com>
Mon, 14 Jul 2025 08:17:46 +0000 (01:17 -0700)
* anti-noob

* dsaswa

* Minor grammar change

---------

Co-authored-by: beck-thompson <beck314159@hotmail.com>
Content.Server/Materials/ProduceMaterialExtractorSystem.cs
Resources/Locale/en-US/materials/material-extractor.ftl [new file with mode: 0644]

index 5a4693049961158a661b2e90a2aa44799446ea43..251dea7fc656d9d211516fef3cf131c2cbc4f43a 100644 (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);
diff --git a/Resources/Locale/en-US/materials/material-extractor.ftl b/Resources/Locale/en-US/materials/material-extractor.ftl
new file mode 100644 (file)
index 0000000..baa4b98
--- /dev/null
@@ -0,0 +1 @@
+material-extractor-comp-wrongreagent = {CAPITALIZE(THE($used))} does not have enough reagent for extraction!