diff --git a/Content.Server/Materials/ProduceMaterialExtractorSystem.cs b/Content.Server/Materials/ProduceMaterialExtractorSystem.cs index 5a46930499..251dea7fc6 100644 --- a/Content.Server/Materials/ProduceMaterialExtractorSystem.cs +++ b/Content.Server/Materials/ProduceMaterialExtractorSystem.cs @@ -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!; /// 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 index 0000000000..baa4b98bd1 --- /dev/null +++ b/Resources/Locale/en-US/materials/material-extractor.ftl @@ -0,0 +1 @@ +material-extractor-comp-wrongreagent = {CAPITALIZE(THE($used))} does not have enough reagent for extraction!