Cleaned up project with better structure.
This commit is contained in:
@@ -16,9 +16,10 @@ public class ExploreNode : ProgramNode
|
||||
if (pathPoints == null)
|
||||
{
|
||||
int safetyCounter = 0;
|
||||
int layerRange = Math.Max(GameData.lowestLayer, 1);
|
||||
while (true)
|
||||
{
|
||||
targetPosition = new Vector3I(GameData.rand.Next(GameData.layerSize), GameData.rand.Next(GameData.lowestLayer), GameData.rand.Next(GameData.layerSize));
|
||||
targetPosition = new Vector3I(GameData.rand.Next(GameData.layerSize), GameData.rand.Next(layerRange), GameData.rand.Next(GameData.layerSize));
|
||||
if (!GameData.map[targetPosition.Y].tiles[targetPosition.X, targetPosition.Z].wasVisited) break;
|
||||
safetyCounter++;
|
||||
if (safetyCounter > Math.Pow(GameData.layerSize, 2) * 2)
|
||||
@@ -29,7 +30,7 @@ public class ExploreNode : ProgramNode
|
||||
}
|
||||
}
|
||||
|
||||
pathPoints ??= [.. Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition)];
|
||||
pathPoints ??= new List<Vector3>(Pathfinding.GetPath(Pathfinding.GetClosestStartPoint(robot.Position), targetPosition));
|
||||
|
||||
if (pathPoints.Count <= 0)
|
||||
{
|
||||
@@ -50,6 +51,7 @@ public class ExploreNode : ProgramNode
|
||||
{
|
||||
tile.VisitTile();
|
||||
}
|
||||
|
||||
pathPoints.Remove(pathPoints[0]);
|
||||
if (pathPoints.Count <= 0)
|
||||
{
|
||||
@@ -84,16 +86,14 @@ public class ExploreNode : ProgramNode
|
||||
|
||||
public override void ReadParameters(NodeDisplay display)
|
||||
{
|
||||
//Currently does nothing
|
||||
}
|
||||
|
||||
public override void Setup(NodeDisplay display)
|
||||
{
|
||||
//Currently does nothing
|
||||
}
|
||||
|
||||
public override string Save()
|
||||
{
|
||||
return $"Name: {DisplayText}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user