mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 11:05:49 +01:00
Implement new navigatorparameters settings
This commit is contained in:
parent
2813508cc9
commit
997a14eb35
@ -68,6 +68,7 @@ public class Settings {
|
||||
DEFAULT_LOOK_CLOSE("npc.default.look-close.enabled", false),
|
||||
DEFAULT_LOOK_CLOSE_RANGE("npc.default.look-close.range", 5),
|
||||
DEFAULT_NPC_LIMIT("npc.limits.default-limit", 10),
|
||||
DEFAULT_PATHFINDER_UPDATE_PATH_RATE("npc.pathfinding.update-path-rate", 20),
|
||||
DEFAULT_PATHFINDING_RANGE("npc.default.pathfinding.range", 25F),
|
||||
DEFAULT_RANDOM_TALKER("npc.default.random-talker", true),
|
||||
DEFAULT_REALISTIC_LOOKING("npc.default.realistic-looking", false),
|
||||
@ -96,10 +97,10 @@ public class Settings {
|
||||
NEW_PATHFINDER_OPENS_DOORS("npc.pathfinding.new-finder-open-doors", false),
|
||||
NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75 * 1.75),
|
||||
NPC_COST("economy.npc.cost", 100D),
|
||||
NPC_SKIN_USE_LATEST("npc.skins.use-latest", true),
|
||||
NPC_SKIN_VIEW_DISTANCE("npc.skins.view-distance", 100D),
|
||||
NPC_SKIN_RETRY_DELAY("npc.skins.retry-delay", 120),
|
||||
NPC_SKIN_ROTATION_UPDATE_DEGREES("npc.skins.rotation-update-degrees", 90f),
|
||||
NPC_SKIN_USE_LATEST("npc.skins.use-latest", true),
|
||||
NPC_SKIN_VIEW_DISTANCE("npc.skins.view-distance", 100D),
|
||||
PACKET_UPDATE_DELAY("npc.packets.update-delay", 30),
|
||||
QUICK_SELECT("npc.selection.quick-select", false),
|
||||
REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true),
|
||||
|
@ -40,6 +40,7 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
.range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat())
|
||||
.defaultAttackStrategy(MCTargetStrategy.DEFAULT_ATTACK_STRATEGY)
|
||||
.attackRange(Setting.NPC_ATTACK_DISTANCE.asDouble())
|
||||
.updatePathRate(Setting.DEFAULT_PATHFINDER_UPDATE_PATH_RATE.asInt())
|
||||
.stationaryTicks(Setting.DEFAULT_STATIONARY_TICKS.asInt()).stuckAction(TeleportStuckAction.INSTANCE)
|
||||
.examiner(new MinecraftBlockExaminer()).useNewPathfinder(Setting.USE_NEW_PATHFINDER.asBoolean());
|
||||
private PathStrategy executing;
|
||||
|
@ -118,7 +118,7 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
}
|
||||
if (!aggro && distanceSquared() < parameters.distanceMargin()) {
|
||||
stop();
|
||||
} else if (updateCounter++ > 20) {
|
||||
} else if (updateCounter++ > parameters.updatePathRate()) {
|
||||
setPath();
|
||||
updateCounter = 0;
|
||||
}
|
||||
@ -130,7 +130,7 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
} else if (strategy != parameters.defaultAttackStrategy()) {
|
||||
parameters.defaultAttackStrategy().handle((LivingEntity) handle.getBukkitEntity(), getTarget());
|
||||
}
|
||||
attackTicks = ATTACK_DELAY_TICKS;
|
||||
attackTicks = parameters.attackDelayTicks();
|
||||
}
|
||||
if (attackTicks > 0) {
|
||||
attackTicks--;
|
||||
@ -198,7 +198,6 @@ public class MCTargetStrategy implements PathStrategy, EntityTarget {
|
||||
void stop();
|
||||
}
|
||||
|
||||
private static final int ATTACK_DELAY_TICKS = 20;
|
||||
static final AttackStrategy DEFAULT_ATTACK_STRATEGY = new AttackStrategy() {
|
||||
@Override
|
||||
public boolean handle(LivingEntity attacker, LivingEntity bukkitTarget) {
|
||||
|
Loading…
Reference in New Issue
Block a user