Mopping and puddle tweaks (#13238)

fix undefined
Fixes https://github.com/space-wizards/space-station-14/issues/11830
This commit is contained in:
Leon Friedrich
2023-01-01 19:03:26 +13:00
committed by GitHub
parent 8a02f81c13
commit bce1f9fe89
10 changed files with 322 additions and 334 deletions

View File

@@ -1,8 +1,7 @@
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Fluids.Components;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Shared.Utility;
namespace Content.Server.Fluids.EntitySystems
{
@@ -14,7 +13,6 @@ namespace Content.Server.Fluids.EntitySystems
public override void Update(float frameTime)
{
base.Update(frameTime);
var queueDelete = new RemQueue<EvaporationComponent>();
foreach (var evaporationComponent in EntityManager.EntityQuery<EvaporationComponent>())
{
var uid = evaporationComponent.Owner;
@@ -38,21 +36,9 @@ namespace Content.Server.Fluids.EntitySystems
FixedPoint2.Min(FixedPoint2.New(1), solution.CurrentVolume)); // removes 1 unit, or solution current volume, whichever is lower.
}
if (solution.CurrentVolume <= 0)
{
EntityManager.QueueDeleteEntity(uid);
}
else if (solution.CurrentVolume <= evaporationComponent.LowerLimit // if puddle is too big or too small to evaporate.
|| solution.CurrentVolume >= evaporationComponent.UpperLimit)
{
evaporationComponent.EvaporationToggle = false; // pause evaporation
}
else evaporationComponent.EvaporationToggle = true; // unpause evaporation, e.g. if a puddle previously above evaporation UpperLimit was brought down below evaporation UpperLimit via mopping.
}
foreach (var evaporationComponent in queueDelete)
{
EntityManager.RemoveComponent(evaporationComponent.Owner, evaporationComponent);
evaporationComponent.EvaporationToggle =
solution.CurrentVolume > evaporationComponent.LowerLimit
&& solution.CurrentVolume < evaporationComponent.UpperLimit;
}
}