Allow sign-bounded work destinations via any route

This commit is contained in:
Tanner committed 2026-11-14 17:35:23 +00:00
1 parent cdb90730bd
commit 2191f99a29
2 files changed
+25 -22

No files matched your search

+10 -11
View File
@@ -467,8 +467,8 @@ class World:
if distances[0] <= radius:
return all(distance <= radius for distance in distances)
# If the bot starts just outside a newly read boundary, let it return
# without allowing it to travel farther away from that sign.
# Cache trips that start just outside a work boundary may return
# toward it, but must not travel farther away or leave again.
start_distance = distances[0]
entered = False
for distance in distances[1:]:
@@ -602,8 +602,15 @@ class World:
return result
def path_to_place(self, start, place):
maze_solver = path.Pathfinder(self.g)
policies = self._active_work_policies()
for policy in policies:
if not self._inside_sign_policy(place, policy):
print('[sign policy] rejected work destination outside {}-block {} '
'around {}'.format(policy['distance'], policy['shape'],
policy['position']), flush=True)
return None
maze_solver = path.Pathfinder(self.g)
try:
solution = maze_solver.astar(start, place)
if not solution:
@@ -612,14 +619,6 @@ class World:
except path.AStarTimeout:
return None
policies = self._active_work_policies()
points = [tuple(start)] + [tuple(point) for point in navpath]
for policy in policies:
if not self._path_allowed_by_sign(points, policy):
print('[sign policy] rejected work path outside {}-block {} '
'around {}'.format(policy['distance'], policy['shape'],
policy['position']), flush=True)
return None
return navpath
def path_to_place_faked(self, start, place):