Unstable v0.19.1.0

This commit is contained in:
Juan Pablo Arce
2022-08-19 13:59:08 -03:00
parent 6b55adcdd9
commit 1219615d64
192 changed files with 3875 additions and 2648 deletions
@@ -343,14 +343,12 @@ namespace Barotrauma
Math.Max(Body.LinearVelocity.Y, ConvertUnits.ToSimUnits(Level.Loaded.BottomPos - (worldBorders.Y - worldBorders.Height))));
}
//hard limit for how far outside the level the sub can go
float maxDist = 200000.0f;
//the force of the current starts to increase exponentially after this point
float exponentialForceIncreaseDist = 150000.0f;
float distance = Position.X < 0 ? Math.Abs(Position.X) : Position.X - Level.Loaded.Size.X;
float distance = Position.X < -Level.OutsideBoundsCurrentMargin ?
Math.Abs(Position.X + Level.OutsideBoundsCurrentMargin) :
Position.X - (Level.Loaded.Size.X + Level.OutsideBoundsCurrentMargin);
if (distance > 0)
{
if (distance > maxDist)
if (distance > Level.OutsideBoundsCurrentHardLimit)
{
if (Position.X < 0)
{
@@ -361,9 +359,9 @@ namespace Barotrauma
Body.LinearVelocity = new Vector2(Math.Min(0, Body.LinearVelocity.X), Body.LinearVelocity.Y);
}
}
if (distance > exponentialForceIncreaseDist)
if (distance > Level.OutsideBoundsCurrentMarginExponential)
{
distance += (float)Math.Pow((distance - exponentialForceIncreaseDist) * 0.01f, 2.0f);
distance += (float)Math.Pow((distance - Level.OutsideBoundsCurrentMarginExponential) * 0.01f, 2.0f);
}
float force = distance * 0.5f;
totalForce += (Position.X < 0 ? Vector2.UnitX : -Vector2.UnitX) * force;