Skip to content

Commit

Permalink
Revert "Run all drain updates together"
Browse files Browse the repository at this point in the history
This reverts commit c67dba1.
  • Loading branch information
Partmedia committed Dec 15, 2024
1 parent f5f9e1a commit ee73146
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Content.Server/Fluids/EntitySystems/DrainSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public sealed class DrainSystem : SharedDrainSystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;

private float DrainRunPeriod = 1f; // 1 second to make multiplying by DrainFrequency correct
private float Accumulator;

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -111,14 +108,7 @@ private void Empty(EntityUid container, SpillableComponent spillable, EntityUid

public override void Update(float frameTime)
{
Accumulator += frameTime;
if (Accumulator < DrainRunPeriod)
{
return;
}
Accumulator -= DrainRunPeriod;

base.Update(DrainRunPeriod);
base.Update(frameTime);
var managerQuery = GetEntityQuery<SolutionContainerManagerComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
var puddleQuery = GetEntityQuery<PuddleComponent>();
Expand All @@ -127,6 +117,13 @@ public override void Update(float frameTime)
var query = EntityQueryEnumerator<DrainComponent>();
while (query.MoveNext(out var uid, out var drain))
{
drain.Accumulator += frameTime;
if (drain.Accumulator < drain.DrainFrequency)
{
continue;
}
drain.Accumulator -= drain.DrainFrequency;

// Disable ambient sound from emptying manually
if (!drain.AutoDrain)
{
Expand Down

0 comments on commit ee73146

Please sign in to comment.