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:
@@ -4,6 +4,7 @@ using Content.Server.Materials.Components;
|
|||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Shared.Chemistry.EntitySystems;
|
using Content.Shared.Chemistry.EntitySystems;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
|
using Content.Shared.Popups;
|
||||||
using Robust.Server.Audio;
|
using Robust.Server.Audio;
|
||||||
|
|
||||||
namespace Content.Server.Materials;
|
namespace Content.Server.Materials;
|
||||||
@@ -13,6 +14,7 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem
|
|||||||
[Dependency] private readonly AudioSystem _audio = default!;
|
[Dependency] private readonly AudioSystem _audio = default!;
|
||||||
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
|
||||||
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -39,7 +41,16 @@ public sealed class ProduceMaterialExtractorSystem : EntitySystem
|
|||||||
var matAmount = solution.Value.Comp.Solution.Contents
|
var matAmount = solution.Value.Comp.Solution.Contents
|
||||||
.Where(r => ent.Comp.ExtractionReagents.Contains(r.Reagent.Prototype))
|
.Where(r => ent.Comp.ExtractionReagents.Contains(r.Reagent.Prototype))
|
||||||
.Sum(r => r.Quantity.Float());
|
.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);
|
_audio.PlayPvs(ent.Comp.ExtractSound, ent);
|
||||||
QueueDel(args.Used);
|
QueueDel(args.Used);
|
||||||
|
|||||||
1
Resources/Locale/en-US/materials/material-extractor.ftl
Normal file
1
Resources/Locale/en-US/materials/material-extractor.ftl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
material-extractor-comp-wrongreagent = {CAPITALIZE(THE($used))} does not have enough reagent for extraction!
|
||||||
Reference in New Issue
Block a user