add a method to get the heuristic at the goal

this alows the ETA to work with goals not ending with a heuristic of 0

GoalComposite, GoalRunAway and GoalNear are still missing
This commit is contained in:
ZacSharp
2020-09-05 22:32:38 +02:00
parent 10e3a5afc4
commit 45dc8b949d
4 changed files with 25 additions and 1 deletions

View File

@@ -387,7 +387,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
if (current == start) {//can't check above because current and start can be equal even if currentPos and startPosition are not
return Optional.empty();
}
double eta = Math.abs(current) * ticksElapsedSoFar / Math.abs(start - current);
double eta = Math.abs(current - goal.heuristic()) * ticksElapsedSoFar / Math.abs(start - current);
return Optional.of(eta);
}