Returned functionality to industrial reagent grinders (#31903)

* Returned functionality to industrial reagent grinders without un-nerfing recyclers

* Limited industrial reagent grinder to only extractable solutions
This commit is contained in:
LucasTheDrgn
2024-09-07 19:47:02 -04:00
committed by GitHub
parent c5f19fd2ed
commit b51d9382c0
4 changed files with 36 additions and 2 deletions

View File

@@ -258,10 +258,23 @@ public sealed class MaterialReclaimerSystem : SharedMaterialReclaimerSystem
} }
// if the item we inserted has reagents, add it in. // if the item we inserted has reagents, add it in.
if (reclaimerComponent.OnlyReclaimDrainable)
{
// Are we a recycler? Only use drainable solution.
if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution)) if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))
{ {
totalChemicals.AddSolution(drainableSolution, _prototype); totalChemicals.AddSolution(drainableSolution, _prototype);
} }
}
else
{
// 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) || if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
!_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume) || !_solutionContainer.TryTransferSolution(outputSolution.Value, totalChemicals, totalChemicals.Volume) ||

View File

@@ -1,4 +1,5 @@
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Content.Shared.Kitchen.Components;
using Content.Shared.Chemistry.Components.SolutionManager; using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reaction; using Content.Shared.Chemistry.Reaction;
using Content.Shared.FixedPoint; 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); 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) 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)) if (!Resolve(entity, ref entity.Comp1, logMissing: false))

View File

@@ -69,6 +69,13 @@ public sealed partial class MaterialReclaimerComponent : Component
[DataField] [DataField]
public string? SolutionContainerId; 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> /// <summary>
/// a whitelist for what entities can be inserted into this reclaimer /// a whitelist for what entities can be inserted into this reclaimer
/// </summary> /// </summary>

View File

@@ -75,6 +75,8 @@
tags: tags:
- HighRiskItem #ian meat - HighRiskItem #ian meat
efficiency: 0.9 efficiency: 0.9
onlyReclaimDrainable: false
solutionContainerId: output
- type: Sprite - type: Sprite
sprite: Structures/Machines/recycling.rsi sprite: Structures/Machines/recycling.rsi
layers: layers: