Files
tbd-station-14/Content.Server/Chemistry/EntitySystems/SolutionPurgeSystem.cs
Cojoke ef1fadf275 Replace instances of SolutionContainerSystem with SharedSolutionContainerSystem (#30084)
* Replace instances of SolutionContainerSystem with SharedSolutionContainerSystem

* guap

* More fixes

* Wait you can do that?

---------

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2024-09-02 13:26:04 +02:00

30 lines
1.1 KiB
C#

using Content.Server.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components.SolutionManager;
using Robust.Shared.Timing;
namespace Content.Server.Chemistry.EntitySystems;
public sealed class SolutionPurgeSystem : EntitySystem
{
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly IGameTiming _timing = default!;
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<SolutionPurgeComponent, SolutionContainerManagerComponent>();
while (query.MoveNext(out var uid, out var purge, out var manager))
{
if (_timing.CurTime < purge.NextPurgeTime)
continue;
// timer ignores if it's empty, it's just a fixed cycle
purge.NextPurgeTime += purge.Duration;
if (_solutionContainer.TryGetSolution((uid, manager), purge.Solution, out var solution))
_solutionContainer.SplitSolutionWithout(solution.Value, purge.Quantity, purge.Preserve.ToArray());
}
}
}