Minor optimizations: GUITextBlocks don't reposition and wrap the text when only the position of the text block changes (almost killed my laptop by spamming a bit too many messages to the debug console), less unnecessary floor raycasts

This commit is contained in:
Regalis
2017-04-06 21:58:19 +03:00
parent 7cb88e39e9
commit 00b7193b6b
2 changed files with 19 additions and 7 deletions
@@ -853,13 +853,19 @@ namespace Barotrauma
inWater = false;
headInWater = false;
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
float floorY = GetFloorY();
if (currentHull.Volume > currentHull.FullVolume * 0.95f ||
(waterSurface - floorY > HeadPosition * 0.95f && Collider.SimPosition.Y < waterSurface))
inWater = false;
if (inWater = currentHull.Volume > currentHull.FullVolume * 0.95f)
{
inWater = true;
}
else
{
float waterSurface = ConvertUnits.ToSimUnits(currentHull.Surface);
if (Collider.SimPosition.Y < waterSurface && waterSurface - GetFloorY() > HeadPosition * 0.95f)
{
inWater = true;
}
}
}
if (flowForce.LengthSquared() > 0.001f)