@@ -627,8 +627,11 @@ def _get_neighbour_position_action(
627627 ) -> Optional [Action ]:
628628 agent_x = police_entity .get_x ()
629629 agent_y = police_entity .get_y ()
630- position = police_entity .get_position ()
631- edge = target .get_edge_to (position )
630+ position = self .world_info .get_entity (police_entity .get_position ())
631+ if position is None :
632+ return None
633+
634+ edge = target .get_edge_to (position .get_id ())
632635 if edge is None :
633636 return None
634637
@@ -703,7 +706,7 @@ def _get_neighbour_position_action(
703706 if isinstance (target , Road ):
704707 road = cast (Road , target )
705708 if road .get_blockades () == []:
706- return ActionMove ([position , target .get_id ()])
709+ return ActionMove ([position . get_id () , target .get_id ()])
707710
708711 target_blockade : Optional [Blockade ] = None
709712 min_point_distance = sys .float_info .max
@@ -742,4 +745,4 @@ def _get_neighbour_position_action(
742745 self ._old_clear_y = clear_y
743746 return ActionClearArea (clear_x , clear_y )
744747
745- return ActionMove ([position , target .get_id ()])
748+ return ActionMove ([position . get_id () , target .get_id ()])
0 commit comments