From: Neil Date: Fri, 9 Sep 2016 21:46:58 +0000 (+0200) Subject: Limit how close lights can be placed to each other X-Git-Tag: tabakrolletjie-v1.0.0~141^2~1 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=24c8b4e46d411bcffece404c52135d00247d8acf;p=tabakrolletjie.git Limit how close lights can be placed to each other --- diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index 7860c87..1c518c5 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -100,10 +100,13 @@ class DayScene(BaseScene): def _place_spotlight(self, gamestate, colour, ev): if self._seeds > 5: - self._seeds -= 5 - self._update_toolbar(gamestate) pos = pymunk.pygame_util.from_pygame(ev.pos, pygame.display.get_surface()) + # Bail if we're too close to an existing light + if self._lights.nearest(pos, max_distance=25): + return + self._seeds -= 5 + self._update_toolbar(gamestate) cfg = { "type": "spotlight", "colour": colour,