Set pathfinding range on strategy switch

This commit is contained in:
fullwall 2013-10-20 00:11:53 +08:00
parent 7229958dcf
commit c538a18471

View File

@ -143,6 +143,7 @@ public class CitizensNavigator implements Navigator, Runnable {
return; return;
} }
localParams = defaultParams.clone(); localParams = defaultParams.clone();
updatePathfindingRange();
PathStrategy newStrategy = new MCTargetStrategy(npc, target, aggressive, localParams); PathStrategy newStrategy = new MCTargetStrategy(npc, target, aggressive, localParams);
switchStrategyTo(newStrategy); switchStrategyTo(newStrategy);
} }
@ -161,6 +162,7 @@ public class CitizensNavigator implements Navigator, Runnable {
return; return;
} }
localParams = defaultParams.clone(); localParams = defaultParams.clone();
updatePathfindingRange();
PathStrategy newStrategy; PathStrategy newStrategy;
if (localParams.useNewPathfinder()) { if (localParams.useNewPathfinder()) {
newStrategy = new AStarNavigationStrategy(npc, target, localParams); newStrategy = new AStarNavigationStrategy(npc, target, localParams);