Merge branch 'master' of ctpug.org.za:tabakrolletjie
authorSimon Cross <hodgestar@gmail.com>
Fri, 9 Sep 2016 21:48:34 +0000 (23:48 +0200)
committerSimon Cross <hodgestar@gmail.com>
Fri, 9 Sep 2016 21:48:34 +0000 (23:48 +0200)
data/stations/station-beta.json
tabakrolletjie/lights.py
tabakrolletjie/scenes/day.py

index 2736397e39c8d56f851c9fad7aacb0c619ae4a33..6a6b6bc26902447a6b963d1d1f84a507e8c4de00 100644 (file)
@@ -1,8 +1,8 @@
 {
   "config": {
-    "name": "Station Alpha",
+    "name": "Station Beta",
     "power": 100,
-    "seeds": 10
+    "seeds": 100
   },
   "obstacles": [
     {
index 34160f006de713ce58163cf54307f0995047cc12..12b3fe07a07898483930c8fb90f08ea2c5ba47ec 100644 (file)
@@ -102,7 +102,8 @@ class BaseLight(object):
     COLOURS = {
         "red": (255, 0, 0),
         "green": (0, 255, 0),
-        "blue": (0, 255, 255),
+        "blue": (0, 0, 255),
+        "cyan": (0, 255, 255),
         "yellow": (255, 255, 0),
         "white": (255, 255, 255),
     }
index 7860c87b44e4db2d09c7c11549215648a0ab0acb..1c518c526514a0ea8871dedf5e2d87e4f831caf4 100644 (file)
@@ -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,