Remove old direction and spread parameters.
[tabakrolletjie.git] / tabakrolletjie / lights.py
index f34d32d889c926a37fd0e1ab29e819a2cc016a5c..4c54a49f32f9143cc6367e79b94d4bc4651b6fc0 100644 (file)
@@ -65,7 +65,10 @@ class LightManager(object):
         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"""
@@ -75,7 +78,10 @@ class LightManager(object):
         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:
@@ -221,18 +227,11 @@ class BaseLight(object):
 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)