Water flow logic tweaking:

- Less fluctuation, water doesn't constantly flow back and forth through gaps.
- Flowing water pushes characters around much more heavily, and the force is applied to the collider in addition to the limbs.
- Vertical gaps don't push characters up/down unless the character is roughly above/below the gap.

+ Renamed some fields in the hull and gap classes (Volume -> WaterVolume, FullVolume -> Volume, public fields start with a capital letter)
This commit is contained in:
Joonas Rikkonen
2017-10-10 00:34:54 +03:00
parent c444186426
commit f46dc5da28
26 changed files with 190 additions and 203 deletions
@@ -69,9 +69,7 @@ namespace Barotrauma
private string GetTotalHullVolume()
{
float totalVol = 0.0f;
Hull.hullList.ForEach(h => { totalVol += h.FullVolume; });
return "Total Hull Volume:\n" + totalVol;
return "Total Hull Volume:\n" + Hull.hullList.Sum(h => h.Volume);
}
private string GetSelectedHullVolume()
@@ -79,16 +77,17 @@ namespace Barotrauma
float buoyancyVol = 0.0f;
float selectedVol = 0.0f;
float neutralPercentage = 0.07f;
Hull.hullList.ForEach(h => {
buoyancyVol += h.FullVolume;
Hull.hullList.ForEach(h =>
{
buoyancyVol += h.Volume;
if (h.IsSelected)
{
selectedVol += h.FullVolume;
selectedVol += h.Volume;
}
});
buoyancyVol *= neutralPercentage;
string retVal = "Selected Hull Volume:\n" + selectedVol;
if (selectedVol>0.0f && buoyancyVol>0.0f)
if (selectedVol > 0.0f && buoyancyVol > 0.0f)
{
if (buoyancyVol / selectedVol < 1.0f)
{