self._lights.append(light)
light.add(self._space)
+ def remove_light(self, light):
+ self._lights.remove(light)
+ light.remove(self._space)
+
def battery_dead(self):
self._battery_dead = True
for light in self._lights:
self.ray_manager.set_space(space)
self.ray_manager.update_shapes()
+ def remove(self, space):
+ if self.body.space is not None:
+ space.remove(self.body, *self.body.shapes)
+
def _cached_surface(self, name, surface):
surf = self._surface_cache.get(name)
if surf is None:
tools.append(tool)
x += step
+ tools.append(ImageButton(
+ '32', 'remove.png', name='remove light', pos=(x, y)))
+ x += step
+
tools.append(ImageButton(
'32', 'default_cursor.png', name='reset tool', pos=(x, y)))
gamestate.station["lights"].append(cfg)
self._lights.add_light(cfg)
+ def _remove_light(self, ev):
+ light = self._lights.nearest(ev.pos, surfpos=True, max_distance=25.0)
+ if light:
+ self._lights.remove_light(light)
+
def event(self, ev, gamestate):
if self._ending:
return
self._set_cursor(
'seed', transform=Alpha(alpha=172))
self._clear_light_toolbar()
+ elif self._tool.name == 'remove light':
+ self._set_cursor(
+ 'remove', transform=Alpha(alpha=172))
+ self._clear_light_toolbar()
elif self._tool.name == 'light':
self._unset_cursor()
self._draw_light_toolbar(
if self._tool:
if self._tool.name == "seed":
self._place_seed(gamestate, ev)
+ elif self._tool.name == "remove light":
+ self._remove_light(ev)
elif self._tool.name == "light" and self._light_colors:
self._place_light(
gamestate, self._tool.light_config,