From 60761309876655e5b913dacf81db3661d8813a2c Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 23 Apr 2023 18:20:03 +1000 Subject: [PATCH] Janitor QoL (#15626) --- .../EntitySystems/PuddleSystem.Evaporation.cs | 2 +- .../Fluids/EntitySystems/PuddleSystem.cs | 21 +++++++++++++++---- Content.Shared/Fluids/AbsorbentComponent.cs | 2 +- .../Objects/Specific/Janitorial/janitor.yml | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs index 65eacba315..46a66beab4 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.Evaporation.cs @@ -49,7 +49,7 @@ public sealed partial class PuddleSystem continue; var reagentTick = evaporation.EvaporationAmount * EvaporationCooldown.TotalSeconds; - puddleSolution.RemoveReagent(EvaporationReagent, reagentTick); + _solutionContainerSystem.TryRemoveReagent(uid, puddleSolution, EvaporationReagent, reagentTick); // Despawn if we're done if (puddleSolution.Volume == FixedPoint2.Zero) diff --git a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs index 6dc6a64f8f..c444afa834 100644 --- a/Content.Server/Fluids/EntitySystems/PuddleSystem.cs +++ b/Content.Server/Fluids/EntitySystems/PuddleSystem.cs @@ -96,9 +96,9 @@ public sealed partial class PuddleSystem : SharedPuddleSystem var puddleQuery = GetEntityQuery(); + // For overflows, we never go to a fully evaporative tile just to avoid continuously having to mop it. + // First we overflow to neighbors with overflow capacity - // Then we go to free tiles - // Then we go to anything else. if (args.Neighbors.Count > 0) { _random.Shuffle(args.Neighbors); @@ -107,7 +107,8 @@ public sealed partial class PuddleSystem : SharedPuddleSystem foreach (var neighbor in args.Neighbors) { if (!puddleQuery.TryGetComponent(neighbor, out var puddle) || - !_solutionContainerSystem.TryGetSolution(neighbor, puddle.SolutionName, out var neighborSolution)) + !_solutionContainerSystem.TryGetSolution(neighbor, puddle.SolutionName, out var neighborSolution) || + CanFullyEvaporate(neighborSolution)) { continue; } @@ -136,10 +137,20 @@ public sealed partial class PuddleSystem : SharedPuddleSystem } } + // Then we go to free tiles -> only overflow if we can go up to capacity at least. if (args.NeighborFreeTiles.Count > 0 && args.Updates > 0) { + // We'll only spill if we have the minimum threshold per tile. + var spillCount = (int) Math.Floor(overflow.Volume.Float() / component.OverflowVolume.Float()); + + if (spillCount == 0) + { + return; + } + _random.Shuffle(args.NeighborFreeTiles); - var spillAmount = overflow.Volume / args.NeighborFreeTiles.Count; + spillCount = Math.Min(args.NeighborFreeTiles.Count, spillCount); + var spillAmount = overflow.Volume / spillCount; foreach (var tile in args.NeighborFreeTiles) { @@ -155,6 +166,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem return; } + // Then we go to anything else. if (overflow.Volume > FixedPoint2.Zero && args.Neighbors.Count > 0 && args.Updates > 0) { var spillPerNeighbor = overflow.Volume / args.Neighbors.Count; @@ -165,6 +177,7 @@ public sealed partial class PuddleSystem : SharedPuddleSystem // This is to avoid diluting solutions too much. if (!puddleQuery.TryGetComponent(neighbor, out var puddle) || !_solutionContainerSystem.TryGetSolution(neighbor, puddle.SolutionName, out var neighborSolution) || + CanFullyEvaporate(neighborSolution) || neighborSolution.Volume >= puddle.OverflowVolume) { continue; diff --git a/Content.Shared/Fluids/AbsorbentComponent.cs b/Content.Shared/Fluids/AbsorbentComponent.cs index b68f2d8b97..4966c8c5f6 100644 --- a/Content.Shared/Fluids/AbsorbentComponent.cs +++ b/Content.Shared/Fluids/AbsorbentComponent.cs @@ -18,7 +18,7 @@ public sealed class AbsorbentComponent : Component /// How much solution we can transfer in one interaction. /// [DataField("pickupAmount")] - public FixedPoint2 PickupAmount = FixedPoint2.New(60); + public FixedPoint2 PickupAmount = FixedPoint2.New(100); [DataField("pickupSound")] public SoundSpecifier PickupSound = new SoundPathSpecifier("/Audio/Effects/Fluids/watersplash.ogg") diff --git a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml index 9a4c09a684..2f058caa28 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml @@ -26,9 +26,9 @@ - type: SolutionContainerManager solutions: absorbed: - maxVol: 60 + maxVol: 100 - type: UseDelay - delay: 1.5 + delay: 1 - type: Tag tags: - DroneUsable #No bucket because it holds chems, they can drag the cart or use a drain