Fix sinks and toilets not draining (#33691)
* Fix AutoDrain Per the system comments, AutoDrain is designed to automatically move puddles into the drain (like a floor drain). Drains without AutoDrain are still supposed to gradually empty the buffer, but not remove puddles (like sinks and toilets). However, a logic error in the original implementation causes drains with AutoDrain set to false to simply not work. Hence sinks never emptied. * Update documentation
This commit is contained in:
@@ -134,13 +134,6 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
}
|
||||
drain.Accumulator -= drain.DrainFrequency;
|
||||
|
||||
// Disable ambient sound from emptying manually
|
||||
if (!drain.AutoDrain)
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(uid, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!managerQuery.TryGetComponent(uid, out var manager))
|
||||
continue;
|
||||
|
||||
@@ -160,6 +153,8 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
// This will ensure that UnitsPerSecond is per second...
|
||||
var amount = drain.UnitsPerSecond * drain.DrainFrequency;
|
||||
|
||||
if (drain.AutoDrain)
|
||||
{
|
||||
_puddles.Clear();
|
||||
_lookup.GetEntitiesInRange(Transform(uid).Coordinates, drain.Range, _puddles);
|
||||
|
||||
@@ -197,6 +192,7 @@ public sealed class DrainSystem : SharedDrainSystem
|
||||
QueueDel(puddle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_solutionContainerSystem.UpdateChemicals(drain.Solution.Value);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public sealed partial class DrainComponent : Component
|
||||
public float Accumulator = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Does this drain automatically absorb surrouding puddles? Or is it a drain designed to empty
|
||||
/// solutions in it manually?
|
||||
/// If true, automatically transfers solutions from nearby puddles and drains them. True for floor drains;
|
||||
/// false for things like toilets and sinks.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public bool AutoDrain = true;
|
||||
|
||||
Reference in New Issue
Block a user