(db658d442) Keep oxygen percentage at the same level when resizing hulls in the sub editor (otherwise scaling up a hull will cause it to have less oxygen and vice versa)
This commit is contained in:
@@ -79,6 +79,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
float prevOxygenPercentage = OxygenPercentage;
|
||||||
base.Rect = value;
|
base.Rect = value;
|
||||||
|
|
||||||
if (Submarine == null || !Submarine.Loading)
|
if (Submarine == null || !Submarine.Loading)
|
||||||
@@ -87,6 +88,7 @@ namespace Barotrauma
|
|||||||
Gap.UpdateHulls();
|
Gap.UpdateHulls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OxygenPercentage = prevOxygenPercentage;
|
||||||
surface = drawSurface = rect.Y - rect.Height + WaterVolume / rect.Width;
|
surface = drawSurface = rect.Y - rect.Height + WaterVolume / rect.Width;
|
||||||
Pressure = surface;
|
Pressure = surface;
|
||||||
}
|
}
|
||||||
@@ -162,7 +164,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public float OxygenPercentage
|
public float OxygenPercentage
|
||||||
{
|
{
|
||||||
get { return oxygen / Volume * 100.0f; }
|
get { return Volume <= 0.0f ? 100.0f : oxygen / Volume * 100.0f; }
|
||||||
set { Oxygen = (value / 100.0f) * Volume; }
|
set { Oxygen = (value / 100.0f) * Volume; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user