Fixed PlayUISound crashing the launcher, generatic ladder waypoints, AICharacter sync bugfix, chatbox resizing according to resolution
This commit is contained in:
@@ -109,7 +109,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConvertUnits.ToDisplayUnits(subBody.Position);
|
||||
return subBody.Position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -352,13 +352,48 @@ namespace Barotrauma
|
||||
FixedArray2<Vector2> points;
|
||||
contact.GetWorldManifold(out normal2, out points);
|
||||
|
||||
var pickedBody = Submarine.PickBody(
|
||||
points[0] - limb.LinearVelocity * ((float)Physics.step) - ConvertUnits.ToSimUnits(submarine.Position) - submarine.Velocity * ((float)Physics.step),
|
||||
points[0] - ConvertUnits.ToSimUnits(submarine.Position), null, Physics.CollisionWall);
|
||||
Vector2 targetPos = ConvertUnits.ToDisplayUnits(points[0] + limb.LinearVelocity * ((float)Physics.step));
|
||||
|
||||
if (pickedBody != null)
|
||||
Hull newHull = Hull.FindHull(targetPos, null);
|
||||
|
||||
if (newHull == null) return true;
|
||||
|
||||
var gaps = newHull.FindGaps();
|
||||
|
||||
bool gapFound = false;
|
||||
foreach (Gap gap in gaps)
|
||||
{
|
||||
|
||||
if (gap.isHorizontal)
|
||||
{
|
||||
if (targetPos.Y < gap.WorldRect.Y && targetPos.Y > gap.WorldRect.Y - gap.WorldRect.Height)
|
||||
{
|
||||
gapFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetPos.X > gap.WorldRect.X && targetPos.X < gap.WorldRect.Right)
|
||||
{
|
||||
gapFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if (Submarine.RectContains(gap.WorldRect, targetPos))
|
||||
//{
|
||||
// gapFound = true;
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
//var pickedBody = Submarine.PickBody(
|
||||
// points[0] - limb.LinearVelocity * ((float)Physics.step) - ConvertUnits.ToSimUnits(submarine.Position) - submarine.Velocity * ((float)Physics.step),
|
||||
// points[0] - ConvertUnits.ToSimUnits(submarine.Position), null, Physics.CollisionWall);
|
||||
|
||||
if (!gapFound)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -297,6 +297,7 @@ namespace Barotrauma
|
||||
wayPoint = new WayPoint(
|
||||
new Vector2(borders.X + borders.Width * i, y) + Submarine.HiddenSubPosition,
|
||||
SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
if (y == borders.Y - borders.Height)
|
||||
{
|
||||
wayPoint.ConnectTo(cornerWaypoint[1, i]);
|
||||
@@ -304,9 +305,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
wayPoint.ConnectTo(WayPoint.WayPointList[WayPointList.Count - 2]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wayPoint.ConnectTo(cornerWaypoint[0, i]);
|
||||
@@ -345,6 +344,30 @@ namespace Barotrauma
|
||||
|
||||
stairPoints[0].ConnectTo(stairPoints[1]);
|
||||
}
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var ladders = item.GetComponent<Items.Components.Ladder>();
|
||||
if (ladders == null) continue;
|
||||
|
||||
WayPoint[] ladderPoints = new WayPoint[2];
|
||||
|
||||
ladderPoints[0] = new WayPoint(new Vector2(item.Rect.Center.X, item.Rect.Y - item.Rect.Height + heightFromFloor), SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
ladderPoints[1] = new WayPoint(new Vector2(item.Rect.Center.X, item.Rect.Y - heightFromFloor), SpawnType.Path, Submarine.Loaded);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
for (int dir = -1; dir <= 1; dir += 2)
|
||||
{
|
||||
WayPoint closest = ladderPoints[i].FindClosest(dir, true, 30.0f);
|
||||
if (closest == null) continue;
|
||||
ladderPoints[i].ConnectTo(closest);
|
||||
}
|
||||
}
|
||||
|
||||
ladderPoints[0].ConnectTo(ladderPoints[1]);
|
||||
}
|
||||
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user