Revert "revert: remove enable_mount option from CoordinatePatrol"

This reverts commit 9af6ac4a51.
This commit is contained in:
王鹏
2026-04-11 15:00:10 +08:00
parent 9af6ac4a51
commit dc1b3a4368

View File

@@ -28,6 +28,7 @@ class CoordinatePatrol:
mount_key="x", mount_key="x",
mount_hold_sec=1.6, mount_hold_sec=1.6,
mount_retry_after_sec=2.0, mount_retry_after_sec=2.0,
enable_mount=True,
): ):
""" """
Args: Args:
@@ -36,6 +37,7 @@ class CoordinatePatrol:
angle_threshold_deg: 朝向容差(度),超过此值才按 A/D 转向,默认 ANGLE_THRESHOLD_DEG angle_threshold_deg: 朝向容差(度),超过此值才按 A/D 转向,默认 ANGLE_THRESHOLD_DEG
angle_deadzone_deg: 转向死区(度),此范围内不按 A/D、只按 W默认 ANGLE_DEADZONE_DEG angle_deadzone_deg: 转向死区(度),此范围内不按 A/D、只按 W默认 ANGLE_DEADZONE_DEG
mount_key / mount_hold_sec / mount_retry_after_sec: 未上马时先上马(与 game_state_config / GUI 一致) mount_key / mount_hold_sec / mount_retry_after_sec: 未上马时先上马(与 game_state_config / GUI 一致)
enable_mount: False 时跳过上马操作
""" """
self.waypoints = waypoints self.waypoints = waypoints
self.current_index = 0 self.current_index = 0
@@ -47,6 +49,7 @@ class CoordinatePatrol:
self.last_turn_end_time = 0 # 最近一次结束 A/D 转向的时间,供卡死检测排除原地转向 self.last_turn_end_time = 0 # 最近一次结束 A/D 转向的时间,供卡死检测排除原地转向
self.stuck_handler = StuckHandler() self.stuck_handler = StuckHandler()
self._next_mount_allowed = 0.0 self._next_mount_allowed = 0.0
self.enable_mount = bool(enable_mount)
self.mount_key = str(mount_key).strip() or "x" self.mount_key = str(mount_key).strip() or "x"
self.mount_hold_sec = float(mount_hold_sec) self.mount_hold_sec = float(mount_hold_sec)
self.mount_retry_after_sec = float(mount_retry_after_sec) self.mount_retry_after_sec = float(mount_retry_after_sec)
@@ -60,6 +63,8 @@ class CoordinatePatrol:
""" """
if "mounted" not in state: if "mounted" not in state:
return True return True
if not self.enable_mount:
return True
if state.get("mounted"): if state.get("mounted"):
return True return True
# game_state.death_state: 0 存活 / 1 尸体 / 2 灵魂 — 幽灵无法/不需上马,不得拦走路 # game_state.death_state: 0 存活 / 1 尸体 / 2 灵魂 — 幽灵无法/不需上马,不得拦走路