mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-13 04:11:13 +03:00
* Everything except the YAML slop... * She solution on my manager till I sajfslkahfsjakfhaskjfshajksafhfsakhfasjfas * another 1000 lines * fix chem dispenser size * go my shnelf * Implicit ass * rider is being mean for some reason * dasdas * borger * better formatting go! * clothes/bloodstream * Cartons * cups and bottles * mmm soder * bar drinks * Spray bottles and some size tweaks with hindsight * 99 bottles of beer on the wall I hate YAML * push that shit * mmm burger * Sneed * sheets * condiments * mmm yummy * fridge yummyfood * meat... * sub 300 * burger... * bready * let them eat cake * does she know how to make a grilled cheese? * pizza pie! * misc shit * soup or salad * Food and drinks, vanquished * the cubes!!! * Almost free from YAML... * fix test fails and some yaml issues * fix prediction, almost done * fix all test fails * remove master merge artifacts and undo autonetworking * review and compatibility * graaah * unfuck master merge I hate github * merg conflicts * sfsa * ehoop * sadas * afsafsaasf * merge conflicts * fucked up the merge conflicts * merge conflict is fucked I might need to completely redo this branch * test fail * no calcium???? --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Linq;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Chemistry.Components.SolutionManager;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Chemistry.EntitySystems;
|
|
|
|
public sealed class SolutionPurgeSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SolutionPurgeComponent, MapInitEvent>(OnMapInit);
|
|
}
|
|
|
|
private void OnMapInit(Entity<SolutionPurgeComponent> ent, ref MapInitEvent args)
|
|
{
|
|
ent.Comp.NextPurgeTime = _timing.CurTime + ent.Comp.Duration;
|
|
Dirty(ent);
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
// TODO: SolutionPurgeComponent on Solution Entities!
|
|
var query = EntityQueryEnumerator<SolutionPurgeComponent, SolutionManagerComponent>();
|
|
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;
|
|
// Needs to be networked and dirtied so that the client can reroll it during prediction
|
|
Dirty(uid, purge);
|
|
|
|
if (_solutionContainer.TryGetSolution((uid, manager), purge.Solution, out var solution))
|
|
{
|
|
_solutionContainer.SplitSolutionWithout(solution.Value,
|
|
purge.Quantity,
|
|
purge.Preserve.Select(proto => proto.Id).ToArray());
|
|
}
|
|
}
|
|
}
|
|
}
|