Unstable v0.19.1.0
This commit is contained in:
@@ -1234,7 +1234,7 @@ namespace Barotrauma
|
||||
{
|
||||
//find the room which the limb is in
|
||||
//the room where the ragdoll is in is used as the "guess", meaning that it's checked first
|
||||
Hull limbHull = currentHull == null ? null : Hull.FindHull(limb.WorldPosition, currentHull);
|
||||
Hull newHull = currentHull == null ? null : Hull.FindHull(limb.WorldPosition, currentHull);
|
||||
|
||||
bool prevInWater = limb.InWater;
|
||||
limb.InWater = false;
|
||||
@@ -1243,38 +1243,37 @@ namespace Barotrauma
|
||||
{
|
||||
limb.InWater = false;
|
||||
}
|
||||
else if (limbHull == null)
|
||||
else if (newHull == null)
|
||||
{
|
||||
//limb isn't in any room -> it's in the water
|
||||
limb.InWater = true;
|
||||
if (limb.type == LimbType.Head) headInWater = true;
|
||||
if (limb.type == LimbType.Head) { headInWater = true; }
|
||||
}
|
||||
else if (limbHull.WaterVolume > 0.0f && Submarine.RectContains(limbHull.Rect, limb.Position))
|
||||
else if (newHull.WaterVolume > 0.0f && Submarine.RectContains(newHull.Rect, limb.Position))
|
||||
{
|
||||
if (limb.Position.Y < limbHull.Surface)
|
||||
if (limb.Position.Y < newHull.Surface)
|
||||
{
|
||||
limb.InWater = true;
|
||||
surfaceY = limbHull.Surface;
|
||||
surfaceY = newHull.Surface;
|
||||
if (limb.type == LimbType.Head)
|
||||
{
|
||||
headInWater = true;
|
||||
}
|
||||
}
|
||||
//the limb has gone through the surface of the water
|
||||
if (Math.Abs(limb.LinearVelocity.Y) > 5.0f && limb.InWater != prevInWater)
|
||||
if (Math.Abs(limb.LinearVelocity.Y) > 5.0f && limb.InWater != prevInWater && newHull == limb.Hull)
|
||||
{
|
||||
Splash(limb, limbHull);
|
||||
|
||||
Splash(limb, newHull);
|
||||
//if the Character dropped into water, create a wave
|
||||
if (limb.LinearVelocity.Y < 0.0f)
|
||||
{
|
||||
Vector2 impulse = limb.LinearVelocity * limb.Mass;
|
||||
int n = (int)((limb.Position.X - limbHull.Rect.X) / Hull.WaveWidth);
|
||||
limbHull.WaveVel[n] += MathHelper.Clamp(impulse.Y, -5.0f, 5.0f);
|
||||
int n = (int)((limb.Position.X - newHull.Rect.X) / Hull.WaveWidth);
|
||||
newHull.WaveVel[n] += MathHelper.Clamp(impulse.Y, -5.0f, 5.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
limb.Hull = newHull;
|
||||
limb.Update(deltaTime);
|
||||
}
|
||||
|
||||
@@ -1492,12 +1491,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
if (flowForce.LengthSquared() > 0.001f)
|
||||
{
|
||||
Collider.ApplyForce(flowForce);
|
||||
{
|
||||
Collider.ApplyForce(flowForce * (Collider.Mass / Mass));
|
||||
foreach (Limb limb in limbs)
|
||||
{
|
||||
if (!limb.InWater) { continue; }
|
||||
limb.body.ApplyForce(flowForce);
|
||||
limb.body.ApplyForce(flowForce * (limb.Mass / Mass * limbs.Length));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user