- doors aren't ignored when checking visibility during waypoint generation or when finding a starting node for a path

- AICharacter will mark their path unreachable if their path is blocked by a door they cant open (may happen if someone closes the door after calculating the path)
- fixed exception when creating a Steering component when there's no active GameSession (i.e. in the editor)
This commit is contained in:
Regalis
2016-10-27 21:18:45 +03:00
parent 81ed90abf4
commit 48c07cfce5
6 changed files with 36 additions and 14 deletions
@@ -185,6 +185,11 @@ namespace Barotrauma
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
Color.LightGreen);
spriteBatch.DrawString(GUI.SmallFont,
pathSteering.CurrentPath.Nodes[i].ID.ToString(),
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10),
Color.LightGreen);
}
}
}
@@ -258,6 +258,12 @@ namespace Barotrauma
if (closestButton != null)
{
if (!closestButton.HasRequiredItems(character, false) && shouldBeOpen)
{
currentPath.Unreachable = true;
return;
}
closestButton.Item.Pick(character, false, true);
break;
}
@@ -172,7 +172,12 @@ namespace Barotrauma
start, node.Waypoint.SimPosition, null,
Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionStairs | Physics.CollisionPlatform);
if (body != null && body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
if (body != null)
{
if (body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
if (body.UserData is Item && body.FixtureList[0].CollisionCategories.HasFlag(Physics.CollisionWall)) continue;
}
}
closestDist = dist;