point_info_list = self._space.point_query(
pos, max_distance, pymunk.ShapeFilter(mask=LIGHT_CATEGORY))
lights = [p.shape.body.light for p in point_info_list]
- return [light for light in lights if light.on]
+ return [
+ light for light in lights
+ if light.on and light.ray_manager.reaches(pos)
+ ]
def light_query(self, shape):
"""Query the lights by shape"""
shape_info_list = self._space.shape_query(shape)
shape.filter = old_filter
lights = [p.shape.body.light for p in shape_info_list]
- return [light for light in lights if light.on]
+ return [
+ light for light in lights
+ if light.on and light.ray_manager.reaches(shape.body.position)
+ ]
def render_light(self, surface):
for light in self._lights: