clear goal option. fixes #22
This commit is contained in:
parent
e1c6006084
commit
4591895e49
@ -65,7 +65,7 @@ public class PathingBehavior extends Behavior {
|
||||
synchronized (pathPlanLock) {
|
||||
if (current.failed() || current.finished()) {
|
||||
current = null;
|
||||
if (goal.isInGoal(playerFeet())) {
|
||||
if (goal == null || goal.isInGoal(playerFeet())) {
|
||||
displayChatMessageRaw("All done. At " + goal);
|
||||
next = null;
|
||||
return;
|
||||
@ -118,7 +118,7 @@ public class PathingBehavior extends Behavior {
|
||||
// and we have no plan for what to do next
|
||||
return;
|
||||
}
|
||||
if (goal.isInGoal(current.getPath().getDest())) {
|
||||
if (goal == null || goal.isInGoal(current.getPath().getDest())) {
|
||||
// and this path dosen't get us all the way there
|
||||
return;
|
||||
}
|
||||
@ -205,7 +205,7 @@ public class PathingBehavior extends Behavior {
|
||||
}
|
||||
});
|
||||
if (talkAboutIt && current != null && current.getPath() != null) {
|
||||
if (goal.isInGoal(current.getPath().getDest())) {
|
||||
if (goal == null || goal.isInGoal(current.getPath().getDest())) {
|
||||
displayChatMessageRaw("Finished finding a path from " + start + " to " + goal + ". " + current.getPath().getNumNodesConsidered() + " nodes considered");
|
||||
} else {
|
||||
displayChatMessageRaw("Found path segment from " + start + " towards " + goal + ". " + current.getPath().getNumNodesConsidered() + " nodes considered");
|
||||
@ -233,6 +233,7 @@ public class PathingBehavior extends Behavior {
|
||||
IPathFinder pf = new AStarPathFinder(start, goal, previous.map(IPath::positions));
|
||||
return pf.calculate();
|
||||
} catch (Exception e) {
|
||||
displayChatMessageRaw("Exception: " + e);
|
||||
e.printStackTrace();
|
||||
return Optional.empty();
|
||||
}
|
||||
|
@ -60,7 +60,11 @@ public class ExampleBaritoneControl extends Behavior {
|
||||
goal = new GoalBlock(playerFeet());
|
||||
break;
|
||||
case 1:
|
||||
goal = new GoalYLevel(Integer.parseInt(params[0]));
|
||||
if (params[0].equals("clear") || params[0].equals("none")) {
|
||||
goal = null;
|
||||
} else {
|
||||
goal = new GoalYLevel(Integer.parseInt(params[0]));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
goal = new GoalXZ(Integer.parseInt(params[0]), Integer.parseInt(params[1]));
|
||||
|
Loading…
Reference in New Issue
Block a user