Add new pathfinder maximum iterations setting

This commit is contained in:
fullwall 2018-03-15 16:46:57 +08:00
parent 5f062dbb3a
commit fd7b6c6fbf
3 changed files with 6 additions and 2 deletions

View File

@ -101,6 +101,7 @@ public class Settings {
MAX_PACKET_ENTRIES("npc.limits.max-packet-entries", 15),
MAX_SPEED("npc.limits.max-speed", 100),
MAX_TEXT_RANGE("npc.chat.options.max-text-range", 500),
MAXIMUM_ASTAR_ITERATIONS("npc.pathfinding.maximum-new-pathfinder-iterations", 50000),
MESSAGE_COLOUR("general.color-scheme.message", "<a>"),
NEW_PATHFINDER_OPENS_DOORS("npc.pathfinding.new-finder-open-doors", false),
NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75 * 1.75),

View File

@ -11,6 +11,7 @@ import org.bukkit.util.Vector;
import com.google.common.collect.Lists;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.ai.AbstractPathStrategy;
import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType;
@ -86,7 +87,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
VectorGoal goal = new VectorGoal(destination, (float) params.pathDistanceMargin());
setPlan(ASTAR.runFully(goal,
new VectorNode(goal, location, new ChunkBlockSource(location, params.range()), params.examiners()),
50000));
Setting.MAXIMUM_ASTAR_ITERATIONS.asInt()));
}
if (getCancelReason() != null || plan == null || plan.isComplete()) {
return true;

View File

@ -10,6 +10,7 @@ import org.bukkit.util.Vector;
import com.google.common.collect.Lists;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.ai.AbstractPathStrategy;
import net.citizensnpcs.api.ai.NavigatorParameters;
import net.citizensnpcs.api.ai.TargetType;
@ -95,7 +96,8 @@ public class FlyingAStarNavigationStrategy extends AbstractPathStrategy {
parameters.examiner(new FlyingBlockExaminer());
}
setPlan(ASTAR.runFully(goal, new VectorNode(goal, location,
new ChunkBlockSource(location, parameters.range()), parameters.examiners()), 50000));
new ChunkBlockSource(location, parameters.range()), parameters.examiners()),
Setting.MAXIMUM_ASTAR_ITERATIONS.asInt()));
}
if (getCancelReason() != null || plan == null || plan.isComplete()) {
return true;