Add patrol prepare route support
This commit is contained in:
@@ -278,7 +278,7 @@ class CoordinatePatrol:
|
||||
|
||||
return
|
||||
|
||||
def navigate_to_point(self, state, target_pos, arrival_threshold=None):
|
||||
def navigate_to_point(self, state, target_pos, arrival_threshold=None, stop_on_arrival=True):
|
||||
"""
|
||||
优化版:平滑导航,支持边走边转。
|
||||
"""
|
||||
@@ -309,11 +309,12 @@ class CoordinatePatrol:
|
||||
# 2. 距离判断
|
||||
dist = self.get_distance(current_pos, target_pos)
|
||||
if dist < threshold:
|
||||
# 到点后停止前进:松开 W,避免到达后仍持续向前移动
|
||||
# (该函数被 death/logistics 等模块用于“到点就交互/停止”。)
|
||||
# 到点后默认停止前进,供 death/logistics 等“到点就交互/停止”的流程复用。
|
||||
# 准备路线可传 stop_on_arrival=False,实现平滑过点。
|
||||
pydirectinput.keyUp("a")
|
||||
pydirectinput.keyUp("d")
|
||||
pydirectinput.keyUp("w")
|
||||
if stop_on_arrival:
|
||||
pydirectinput.keyUp("w")
|
||||
self.reset_stuck()
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user