Fix puddle spilling properly (#4812)

This commit is contained in:
Ygg01
2021-10-09 18:33:24 +02:00
committed by GitHub
parent 9bd0669b4d
commit d0c6d6ae6c
2 changed files with 14 additions and 5 deletions

View File

@@ -214,8 +214,14 @@ namespace Content.IntegrationTests.Tests.Fluids
// Check that the puddle is unpaused // Check that the puddle is unpaused
Assert.False(sPuddle.Owner.Paused); Assert.False(sPuddle.Owner.Paused);
// By now, the puddle should have evaporated and deleted. // Check that the puddle has evaporated some of its volume
Assert.True(sPuddle.Deleted); Assert.That(sPuddle.CurrentVolume, Is.LessThan(sPuddleStartingVolume));
// If its new volume is zero it should have been deleted
if (sPuddle.CurrentVolume == ReagentUnit.Zero)
{
Assert.True(sPuddle.Deleted);
}
}); });
} }
} }

View File

@@ -50,9 +50,12 @@ namespace Content.Shared.Chemistry.EntitySystems
foreach (var keyValue in component.Solutions) foreach (var keyValue in component.Solutions)
{ {
var solutionHolder = keyValue.Value; var solutionHolder = keyValue.Value;
solutionHolder.MaxVolume = solutionHolder.TotalVolume > solutionHolder.InitialMaxVolume if (solutionHolder.MaxVolume == ReagentUnit.Zero)
? solutionHolder.TotalVolume {
: solutionHolder.InitialMaxVolume; solutionHolder.MaxVolume = solutionHolder.TotalVolume > solutionHolder.InitialMaxVolume
? solutionHolder.TotalVolume
: solutionHolder.InitialMaxVolume;
}
UpdateAppearance(uid, solutionHolder); UpdateAppearance(uid, solutionHolder);
} }