(self)
| 973 | self.simulation_time = timestamp.elapsed_seconds |
| 974 | |
| 975 | def _split_actors(self): |
| 976 | vehicles = [] |
| 977 | traffic_lights = [] |
| 978 | speed_limits = [] |
| 979 | walkers = [] |
| 980 | |
| 981 | for actor_with_transform in self.actors_with_transforms: |
| 982 | actor = actor_with_transform[0] |
| 983 | if 'vehicle' in actor.type_id: |
| 984 | vehicles.append(actor_with_transform) |
| 985 | elif 'traffic_light' in actor.type_id: |
| 986 | traffic_lights.append(actor_with_transform) |
| 987 | elif 'speed_limit' in actor.type_id: |
| 988 | speed_limits.append(actor_with_transform) |
| 989 | elif 'walker' in actor.type_id: |
| 990 | walkers.append(actor_with_transform) |
| 991 | |
| 992 | info_text = [] |
| 993 | if self.hero_actor is not None and len(vehicles) > 1: |
| 994 | location = self.hero_transform.location |
| 995 | vehicle_list = [x[0] for x in vehicles if x[0].id != self.hero_actor.id] |
| 996 | |
| 997 | def distance(v): return location.distance(v.get_location()) |
| 998 | for n, vehicle in enumerate(sorted(vehicle_list, key=distance)): |
| 999 | if n > 15: |
| 1000 | break |
| 1001 | vehicle_type = get_actor_display_name(vehicle, truncate=22) |
| 1002 | info_text.append('% 5d %s' % (vehicle.id, vehicle_type)) |
| 1003 | module_manager.get_module(MODULE_HUD).add_info( |
| 1004 | 'NEARBY VEHICLES', |
| 1005 | info_text) |
| 1006 | |
| 1007 | return (vehicles, traffic_lights, speed_limits, walkers) |
| 1008 | |
| 1009 | def _render_traffic_lights(self, surface, list_tl, world_to_pixel): |
| 1010 | self.affected_traffic_light = None |
no test coverage detected