LIGHT_CATEGORY | FITTINGS_CATEGORY),
categories=FITTINGS_CATEGORY)
+# Just match lights, nothing else
+LIT_BY_FILTER = pymunk.ShapeFilter(mask=LIGHT_CATEGORY)
+
def screen_rays(pos):
""" An iterable that returns ordered rays from pos to the edge of the
lights = [p.shape.body.light for p in point_info_list]
return [light for light in lights if light.on]
+ def light_query(self, shape):
+ """Query the lights by shape"""
+ old_filter = shape.filter
+ # We need to restrict matches to only the lights
+ shape.filter = LIT_BY_FILTER
+ 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]
+
def render_light(self, surface):
for light in self._lights:
light.render_light(surface)