- CrewCommander key can be changed
- Improved logic for teleporting character in/out the sub - changed Turret.AIOperate to use the new coordinate system - neutralballastlevel option in steering - crewmanager UI works properly with different numbers of crew members - fixed obstructvision "twitching" when moving in/out the sub - resetting steering velocity when AI is waiting - GetItem AIObjective ignores items outside the sub - crew has the "dismissed" order by default -
This commit is contained in:
@@ -72,6 +72,8 @@ namespace Barotrauma
|
||||
|
||||
public List<MapEntity> GetEntities(Vector2 position)
|
||||
{
|
||||
if (!MathUtils.IsValid(position)) new List<MapEntity>();
|
||||
|
||||
if (Submarine.Loaded != null) position -= Submarine.HiddenSubPosition;
|
||||
|
||||
if (position.X < limits.X || position.Y > limits.Y ||
|
||||
@@ -81,7 +83,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Point indices = GetIndices(position);
|
||||
|
||||
|
||||
return entities[indices.X, indices.Y];
|
||||
}
|
||||
|
||||
|
||||
@@ -553,15 +553,8 @@ namespace Barotrauma
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
if (gap.Open < 0.01f) continue;
|
||||
if (gap.linkedTo.Count == 0) continue;
|
||||
|
||||
var gapHull = gap.linkedTo[0] as Hull;
|
||||
if (gapHull == this) gaps.Add(gap);
|
||||
|
||||
if (gap.linkedTo.Count < 2) continue;
|
||||
|
||||
gapHull = gap.linkedTo[1] as Hull;
|
||||
if (gapHull == this) gaps.Add(gap);
|
||||
if (gap.linkedTo.Contains(this)) gaps.Add(gap);
|
||||
}
|
||||
|
||||
return gaps;
|
||||
|
||||
@@ -212,26 +212,28 @@ namespace Barotrauma
|
||||
{
|
||||
if (targetPosition != null && targetPosition != Position)
|
||||
{
|
||||
//Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||
|
||||
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
||||
if (dist > 1000.0f)
|
||||
{
|
||||
Vector2 moveAmount = ConvertUnits.ToSimUnits((Vector2)targetPosition) - body.Position;
|
||||
Vector2 displayerMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
|
||||
body.SetTransform(body.Position + moveAmount, 0.0f);
|
||||
if (Character.Controlled != null) Character.Controlled.CursorPosition += displayerMoveAmount;
|
||||
|
||||
GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
GameMain.GameScreen.Cam.Position += displayerMoveAmount;
|
||||
targetPosition = null;
|
||||
}
|
||||
else if (dist > 50.0f)
|
||||
{
|
||||
Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position);
|
||||
moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f));
|
||||
Vector2 displayerMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
|
||||
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
||||
|
||||
GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount * deltaTime);
|
||||
GameMain.GameScreen.Cam.Position += displayerMoveAmount * deltaTime;
|
||||
if (Character.Controlled != null) Character.Controlled.CursorPosition += displayerMoveAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -351,7 +353,7 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 normal = Vector2.Normalize(body.Position - limb.SimPosition);
|
||||
|
||||
normal *= limb.Mass/100.0f;
|
||||
normal *= Math.Min(limb.Mass,100)/100.0f;
|
||||
|
||||
ApplyImpact(normal, contact);
|
||||
}
|
||||
@@ -382,20 +384,34 @@ namespace Barotrauma
|
||||
FixedArray2<Vector2> points;
|
||||
contact.GetWorldManifold(out normal2, out points);
|
||||
|
||||
Vector2 targetPos = ConvertUnits.ToDisplayUnits(points[0] + limb.LinearVelocity * ((float)Physics.step));
|
||||
Vector2 normalizedVel = limb.character.AnimController.RefLimb.LinearVelocity == Vector2.Zero ?
|
||||
Vector2.Zero : Vector2.Normalize(limb.character.AnimController.RefLimb.LinearVelocity);
|
||||
|
||||
Vector2 targetPos = ConvertUnits.ToDisplayUnits(points[0] + normalizedVel);
|
||||
|
||||
Hull newHull = Hull.FindHull(targetPos, null);
|
||||
|
||||
if (newHull == null) return true;
|
||||
if (newHull == null)
|
||||
{
|
||||
targetPos = ConvertUnits.ToDisplayUnits(points[0] - normalizedVel);
|
||||
|
||||
newHull = Hull.FindHull(targetPos, null);
|
||||
|
||||
if (newHull == null) return true;
|
||||
}
|
||||
|
||||
var gaps = newHull.FindGaps();
|
||||
|
||||
targetPos = limb.character.WorldPosition;
|
||||
|
||||
bool gapFound = false;
|
||||
foreach (Gap gap in gaps)
|
||||
foreach (Gap gap in Gap.GapList)
|
||||
{
|
||||
if (gap.Open == 0.0f || gap.IsRoomToRoom) continue;
|
||||
if (gap.isHorizontal)
|
||||
{
|
||||
if (targetPos.Y < gap.WorldRect.Y && targetPos.Y > gap.WorldRect.Y - gap.WorldRect.Height)
|
||||
if (targetPos.Y < gap.WorldRect.Y && targetPos.Y > gap.WorldRect.Y - gap.WorldRect.Height &&
|
||||
Math.Abs(gap.WorldRect.Center.X-targetPos.X)<200.0f)
|
||||
{
|
||||
gapFound = true;
|
||||
break;
|
||||
@@ -403,7 +419,8 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetPos.X > gap.WorldRect.X && targetPos.X < gap.WorldRect.Right)
|
||||
if (targetPos.X > gap.WorldRect.X && targetPos.X < gap.WorldRect.Right &&
|
||||
Math.Abs(gap.WorldRect.Y - gap.WorldRect.Height/2 - targetPos.Y) < 200.0f)
|
||||
{
|
||||
gapFound = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user