]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Returned functionality to industrial reagent grinders (#31903)
authorLucasTheDrgn <kirbyfan.95@gmail.com>
Sat, 7 Sep 2024 23:47:02 +0000 (19:47 -0400)
committerGitHub <noreply@github.com>
Sat, 7 Sep 2024 23:47:02 +0000 (17:47 -0600)
* Returned functionality to industrial reagent grinders without un-nerfing recyclers

* Limited industrial reagent grinder to only extractable solutions

Content.Server/Materials/MaterialReclaimerSystem.cs
Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.Capabilities.cs
Content.Shared/Materials/MaterialReclaimerComponent.cs
Resources/Prototypes/Entities/Structures/Machines/reagent_grinder.yml

index f6abcad7bc2c58da9827731ce6c1b8b0654f9350..d179284595dac1a20b17124db7d6a6ea1dc20ccb 100644 (file)
@@ -258,9 +258,22 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
         }
 
         // if the item we inserted has reagents, add it in.
-        if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))
+
+        if (reclaimerComponent.OnlyReclaimDrainable)
+        {
+            // Are we a recycler? Only use drainable solution.
+            if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))
+            {
+                totalChemicals.AddSolution(drainableSolution, _prototype);
+            }
+        }
+        else
         {
-            totalChemicals.AddSolution(drainableSolution, _prototype);
+            // Are we an industrial reagent grinder? Use extractable solution.
+            if (_solutionContainer.TryGetExtractableSolution(item, out _, out var extractableSolution))
+            {
+                totalChemicals.AddSolution(extractableSolution, _prototype);
+            }
         }
 
         if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
index ce0cfab0021a3755ffa3f22918a7b8e29976d4c9..ffdb6088759da1084f5ef54655848ea3f86cbbe6 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Shared.Chemistry.Components;
+using Content.Shared.Kitchen.Components;
 using Content.Shared.Chemistry.Components.SolutionManager;
 using Content.Shared.Chemistry.Reaction;
 using Content.Shared.FixedPoint;
@@ -34,6 +35,17 @@ public abstract partial class SharedSolutionContainerSystem
         return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.Solution, out soln, out solution);
     }
 
+    public bool TryGetExtractableSolution(Entity<ExtractableComponent?, SolutionContainerManagerComponent?> entity, [NotNullWhen(true)] out Entity<SolutionComponent>? soln, [NotNullWhen(true)] out Solution? solution)
+    {
+        if (!Resolve(entity, ref entity.Comp1, logMissing: false))
+        {
+            (soln, solution) = (default!, null);
+            return false;
+        }
+
+        return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.GrindableSolution, out soln, out solution);
+    }
+
     public bool TryGetDumpableSolution(Entity<DumpableSolutionComponent?, SolutionContainerManagerComponent?> entity, [NotNullWhen(true)] out Entity<SolutionComponent>? soln, [NotNullWhen(true)] out Solution? solution)
     {
         if (!Resolve(entity, ref entity.Comp1, logMissing: false))
index 372cd114abfc4cdd353d8e99ac68a23398e80553..f48a1cb47887afaeb847060c85677f4b6373b8ab 100644 (file)
@@ -69,6 +69,13 @@ public sealed partial class MaterialReclaimerComponent : Component
     [DataField]
     public string? SolutionContainerId;
 
+    /// <summary>
+    /// If the reclaimer should attempt to reclaim all solutions or just drainable ones
+    /// Difference between Recycler and Industrial Reagent Grinder
+    /// </summary>
+    [DataField]
+    public bool OnlyReclaimDrainable = true;
+
     /// <summary>
     /// a whitelist for what entities can be inserted into this reclaimer
     /// </summary>
index 28aa464d210c723fd881da66e1a10cdaae731bcd..39ab6a3276b9e251fd8b7ced09aaa2e9245cd7f2 100644 (file)
@@ -75,6 +75,8 @@
       tags:
       - HighRiskItem #ian meat
     efficiency: 0.9
+    onlyReclaimDrainable: false
+    solutionContainerId: output
   - type: Sprite
     sprite: Structures/Machines/recycling.rsi
     layers: