- characters aren't teleported through gaps if a wall doesn't have a hole there
- characters aren't teleported outside until they're far enough from hulls (prevents them from "jumping" outside as they're teleported partially inside the body of the sub) - arms are mirrored/flipped when turning in water
This commit is contained in:
@@ -1151,8 +1151,8 @@ namespace Barotrauma
|
||||
case LimbType.LeftArm:
|
||||
case LimbType.RightHand:
|
||||
case LimbType.RightArm:
|
||||
mirror = !inWater;
|
||||
flipAngle = !inWater;
|
||||
mirror = true;
|
||||
flipAngle = true;
|
||||
break;
|
||||
case LimbType.LeftThigh:
|
||||
case LimbType.LeftLeg:
|
||||
|
||||
@@ -560,17 +560,15 @@ namespace Barotrauma
|
||||
{
|
||||
if (newHull == null && currentHull.Submarine != null)
|
||||
{
|
||||
//if there's a hull right above and below the position, don't teleport outside the sub
|
||||
//(the character is most likely inside some small gap between hulls)
|
||||
if (Hull.FindHull(findPos + Vector2.UnitY * Submarine.GridSize.Y * 2.0f, currentHull) != null &&
|
||||
Hull.FindHull(findPos - Vector2.UnitY * Submarine.GridSize.Y * 2.0f, currentHull) != null) return;
|
||||
|
||||
if (Hull.FindHull(findPos + Vector2.UnitX * Submarine.GridSize.X * 2.0f, currentHull) != null &&
|
||||
Hull.FindHull(findPos - Vector2.UnitX * Submarine.GridSize.X * 2.0f, currentHull) != null) return;
|
||||
|
||||
for (int i = -1; i < 2; i += 2)
|
||||
{
|
||||
//don't teleport outside the sub if right next to a hull
|
||||
if (Hull.FindHull(findPos + new Vector2(Submarine.GridSize.X * 2.0f * i, 0.0f), currentHull) != null) return;
|
||||
if (Hull.FindHull(findPos + new Vector2(0.0f, Submarine.GridSize.Y * 2.0f * i), currentHull) != null) return;
|
||||
}
|
||||
|
||||
Vector2 ragdollSpeed = refLimb.LinearVelocity == Vector2.Zero ? Vector2.Zero : Vector2.Normalize(refLimb.LinearVelocity);
|
||||
SetPosition(refLimb.SimPosition + ragdollSpeed + ConvertUnits.ToSimUnits(currentHull.Submarine.Position));
|
||||
SetPosition(refLimb.SimPosition + ConvertUnits.ToSimUnits(currentHull.Submarine.Position));
|
||||
character.CursorPosition += currentHull.Submarine.Position;
|
||||
}
|
||||
else if (currentHull == null && newHull != null && newHull.Submarine != null)
|
||||
@@ -703,9 +701,6 @@ namespace Barotrauma
|
||||
splashSoundTimer = 0.5f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//1.0 when the limb is parallel to the surface of the water
|
||||
// = big splash and a large impact
|
||||
float parallel = (float)Math.Abs(Math.Sin(limb.Rotation));
|
||||
|
||||
@@ -971,8 +971,9 @@ namespace Barotrauma
|
||||
foreach (Item item in inventory.Items)
|
||||
{
|
||||
if (item == null || item.body == null || item.body.Enabled) continue;
|
||||
item.Submarine = Submarine;
|
||||
|
||||
item.SetTransform(SimPosition, 0.0f);
|
||||
item.Submarine = Submarine;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -450,6 +450,13 @@ namespace Barotrauma
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
if (gap.Open == 0.0f || gap.IsRoomToRoom) continue;
|
||||
|
||||
if (gap.ConnectedWall != null)
|
||||
{
|
||||
int sectionIndex = gap.ConnectedWall.FindSectionIndex(gap.Position);
|
||||
if (sectionIndex > -1 && !gap.ConnectedWall.SectionBodyDisabled(sectionIndex)) continue;
|
||||
}
|
||||
|
||||
if (gap.isHorizontal)
|
||||
{
|
||||
if (targetPos.Y < gap.WorldRect.Y && targetPos.Y > gap.WorldRect.Y - gap.WorldRect.Height &&
|
||||
|
||||
Reference in New Issue
Block a user