Removing orphans in PathFinder.GenerateNodes, fixed autopilot steering the wrong way if clicking an already selected destination tickbox
This commit is contained in:
@@ -61,6 +61,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nodeList = nodes.Values.ToList();
|
var nodeList = nodes.Values.ToList();
|
||||||
|
nodeList.RemoveAll(n => n.connections.Count == 0);
|
||||||
foreach (PathNode node in nodeList)
|
foreach (PathNode node in nodeList)
|
||||||
{
|
{
|
||||||
node.distances = new List<float>();
|
node.distances = new List<float>();
|
||||||
@@ -69,6 +70,7 @@ namespace Barotrauma
|
|||||||
node.distances.Add(Vector2.Distance(node.position, node.connections[i].position));
|
node.distances.Add(Vector2.Distance(node.position, node.connections[i].position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeList;
|
return nodeList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,12 +200,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Vector2 nodePos = node.Position;
|
Vector2 nodePos = node.Position;
|
||||||
|
|
||||||
//if node waypoint is one of submarine waypoints outside the sub, transform position
|
|
||||||
//if (node.Waypoint!=null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull==null)
|
|
||||||
//{
|
|
||||||
// nodePos -= node.Waypoint.Submarine.Position;
|
|
||||||
//}
|
|
||||||
|
|
||||||
float dist = Vector2.Distance(end, nodePos);
|
float dist = Vector2.Distance(end, nodePos);
|
||||||
if (dist < closestDist || endNode == null)
|
if (dist < closestDist || endNode == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -424,10 +424,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
maintainPosTickBox.Selected = false;
|
maintainPosTickBox.Selected = false;
|
||||||
posToMaintain = null;
|
posToMaintain = null;
|
||||||
|
tickBox.Selected = true;
|
||||||
|
|
||||||
UpdatePath();
|
UpdatePath();
|
||||||
|
|
||||||
tickBox.Selected = true;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user