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:
class Lamp(BaseLight):
FITTING_IMG = "lamp.png"
- def __init__(self, **kw):
- kw.pop("direction", None)
- kw.pop("spread", None)
- super(Lamp, self).__init__(**kw)
-
class SpotLight(BaseLight):
FITTING_IMG = "spotlight.png"
def __init__(self, **kw):
- kw.pop("direction", None)
- kw.pop("spread", None)
self.angular_velocity = kw.pop("angular_velocity", None)
super(SpotLight, self).__init__(**kw)