Tons of AI + pathfinding bugfixes:

- waypoints are created between docked subs and removed when they undock
- fixed start waypoint being left out of steering paths
- NPCs won't close doors/hatches on themselves
- NPCs won't let go of ladders until their feet are above the lower edge of the hull
- fixed FindDivingGear "loops": need to find a suit -> need to get to a suit -> need a suit to get to the suit -> need to find a suit...
- fixed characters constantly turning from side to side in small rooms
- recursive function for finding the button which opens a door (so a button doesn't have to be connected straight to a door for an NPC to be able to open it)
- AIObjectiveGetItem keeps searching for more suitable items even if a path to a matching item has been found
This commit is contained in:
Regalis
2016-07-08 20:53:11 +03:00
parent c8dae18135
commit a5111d33df
17 changed files with 397 additions and 125 deletions

View File

@@ -895,14 +895,20 @@ namespace Barotrauma
return sub;
}
public static bool Unloading
{
get;
private set;
}
public static void Unload()
{
Unloading = true;
Sound.OnGameEnd();
if (GameMain.LightManager != null) GameMain.LightManager.ClearLights();
foreach (Submarine sub in loaded)
{
sub.Remove();
@@ -919,6 +925,8 @@ namespace Barotrauma
Ragdoll.list.Clear();
GameMain.World.Clear();
Unloading = false;
}
public override void Remove()

View File

@@ -140,7 +140,7 @@ namespace Barotrauma
int iconY = (int)(Math.Floor(iconIndices[(int)spawnType]*IconSize / (float)iconTexture.Width))*IconSize;
int iconSize = ConnectedGap == null && Ladders == null ? IconSize : (int)(IconSize * 1.5f);
spriteBatch.Draw(iconTexture,
new Rectangle((int)(drawPos.X - iconSize/2), (int)(drawPos.Y - iconSize/2), iconSize, iconSize),
new Rectangle(iconX, iconY, IconSize,IconSize), clr);
@@ -176,7 +176,7 @@ namespace Barotrauma
{
editingHUD = CreateEditingHUD();
}
editingHUD.Update((float)Physics.step);
editingHUD.Draw(spriteBatch);
@@ -321,7 +321,7 @@ namespace Barotrauma
}
float minDist = 150.0f;
float heightFromFloor = 100.0f;
float heightFromFloor = 110.0f;
foreach (Hull hull in Hull.hullList)
{
@@ -607,7 +607,11 @@ namespace Barotrauma
float dist = Vector2.Distance(wp.Position, Position);
if (closest == null || dist < closestDist)
{
if (Submarine.CheckVisibility(SimPosition, wp.SimPosition) != null) continue;
var body = Submarine.CheckVisibility(SimPosition, wp.SimPosition, true);
if (body != null)
{
if (body.UserData is Structure) continue;
}
closestDist = dist;
closest = wp;
@@ -620,6 +624,8 @@ namespace Barotrauma
private void ConnectTo(WayPoint wayPoint2)
{
System.Diagnostics.Debug.Assert(this != wayPoint2);
if (!linkedTo.Contains(wayPoint2)) linkedTo.Add(wayPoint2);
if (!wayPoint2.linkedTo.Contains(this)) wayPoint2.linkedTo.Add(this);
}