CatStation/Content.Shared/Body/Systems/StomachSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

32 lines
1.4 KiB
C#

using Content.Shared.Body.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
namespace Content.Shared.Body.Systems;
public sealed partial class StomachSystem : EntitySystem
{
[Dependency] private SharedSolutionContainerSystem _solutionContainerSystem = default!;
public const string DefaultSolutionName = "stomach";
public bool CanTransferSolution(Entity<StomachComponent?, SolutionManagerComponent?> entity, Solution solution)
{
return Resolve(entity, ref entity.Comp1, logMissing: false)
&& _solutionContainerSystem.ResolveSolution((entity, entity.Comp2), DefaultSolutionName, ref entity.Comp1.Solution, out var stomachSolution)
// TODO: For now no partial transfers. Potentially change by design
&& stomachSolution.CanAddSolution(solution);
}
public bool TryTransferSolution(Entity<StomachComponent?, SolutionManagerComponent?> entity, Solution solution)
{
if (!Resolve(entity, ref entity.Comp1, logMissing: false)
|| !_solutionContainerSystem.ResolveSolution((entity, entity.Comp2), DefaultSolutionName, ref entity.Comp1.Solution)
|| !CanTransferSolution(entity, solution))
return false;
_solutionContainerSystem.TryAddSolution(entity.Comp1.Solution.Value, solution);
return true;
}
}