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