Autopilot waypoint skipping, AI finds and equips diving gear when the sub is flooding, progress on AI welding, equipping items in AIObjectiveGetItem, wire node coordinate bugfixes, EntityGrid.RemoveEntity fix
This commit is contained in:
@@ -50,9 +50,9 @@ namespace Barotrauma
|
||||
|
||||
public void RemoveEntity(MapEntity entity)
|
||||
{
|
||||
for (int x = 0; x <= entities.GetLength(0); x++)
|
||||
for (int x = 0; x < entities.GetLength(0); x++)
|
||||
{
|
||||
for (int y = 0; y <= entities.GetLength(1); y++)
|
||||
for (int y = 0; y < entities.GetLength(1); y++)
|
||||
{
|
||||
if (entities[x,y].Contains(entity)) entities[x, y].Remove(entity);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,14 @@ namespace Barotrauma
|
||||
get { return flowTargetHull; }
|
||||
}
|
||||
|
||||
public bool IsRoomToRoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return linkedTo.Count == 2;
|
||||
}
|
||||
}
|
||||
|
||||
public Gap(Rectangle newRect, Submarine submarine)
|
||||
: this(newRect, newRect.Width < newRect.Height, submarine)
|
||||
{ }
|
||||
|
||||
@@ -503,7 +503,8 @@ namespace Barotrauma
|
||||
if (Submarine.RectContains(useWorldCoordinates ? guess.WorldRect : guess.rect, position)) return guess;
|
||||
}
|
||||
|
||||
var entities = entityGrid.GetEntities(useWorldCoordinates ? position-Submarine.Loaded.Position : position);
|
||||
var entities = entityGrid.GetEntities(
|
||||
useWorldCoordinates && Submarine.Loaded!=null ? position-Submarine.Loaded.Position : position);
|
||||
|
||||
foreach (Hull hull in entities)
|
||||
{
|
||||
|
||||
@@ -181,6 +181,7 @@ namespace Barotrauma
|
||||
|
||||
for (int side = 0; side < 2; side++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
graphicsDevice.SetVertexBuffer(level.WrappingWalls[side, i].BodyVertices);
|
||||
|
||||
@@ -257,8 +257,8 @@ namespace Barotrauma
|
||||
|
||||
public static Vector2 VectorToWorldGrid(Vector2 position)
|
||||
{
|
||||
position.X = (float)Math.Floor(Convert.ToDouble(position.X / GridSize.X)) * GridSize.X;
|
||||
position.Y = (float)Math.Ceiling(Convert.ToDouble(position.Y / GridSize.Y)) * GridSize.Y;
|
||||
position.X = (float)Math.Floor(position.X / GridSize.X) * GridSize.X;
|
||||
position.Y = (float)Math.Ceiling(position.Y / GridSize.Y) * GridSize.Y;
|
||||
|
||||
return position;
|
||||
}
|
||||
@@ -329,6 +329,7 @@ namespace Barotrauma
|
||||
|
||||
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
||||
lastPickedFraction = closestFraction;
|
||||
|
||||
return closestBody;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,15 +330,19 @@ namespace Barotrauma
|
||||
if (cell == null)
|
||||
{
|
||||
Limb limb = f2.Body.UserData as Limb;
|
||||
if (limb!=null && limb.character.Submarine==null)
|
||||
if (limb!=null)
|
||||
{
|
||||
if (limb.character.Submarine != null) return false;
|
||||
|
||||
Vector2 normal2;
|
||||
FixedArray2<Vector2> points;
|
||||
contact.GetWorldManifold(out normal2, out points);
|
||||
|
||||
if (Submarine.PickBody(
|
||||
points[0] - limb.LinearVelocity * ((float)Physics.step) - ConvertUnits.ToSimUnits(submarine.Position) - submarine.Velocity * ((float)Physics.step) + normal2,
|
||||
points[0] - ConvertUnits.ToSimUnits(submarine.Position) - normal2, null, Physics.CollisionWall) != null)
|
||||
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 (pickedBody != null)
|
||||
{
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user