Ensure color_pos is always -1 when the lights go out, so behaviour is always consistent
authorNeil <neil@dip.sun.ac.za>
Tue, 13 Sep 2016 15:18:15 +0000 (17:18 +0200)
committerNeil <neil@dip.sun.ac.za>
Tue, 13 Sep 2016 15:18:15 +0000 (17:18 +0200)
tabakrolletjie/lights.py

index cda60022a5d5aa227d7a9401ad119ca31ff2ba67..22da021bdbe015e156e1b1b2c03118290fe47290 100644 (file)
@@ -159,7 +159,7 @@ class BaseLight(object):
             self.colour_pos = colours.index(start_colour)
             self.colour = start_colour
         self.on = on
-        if not on and len(colours) > 1:
+        if not on:
             self.colour_pos = -1
         self.intensity = intensity
         self.body = pymunk.Body(0, 0, pymunk.body.Body.STATIC)
@@ -294,6 +294,7 @@ class BaseLight(object):
 
     def off(self):
         self.on = False
+        self.colour_pos = -1
 
     def toggle(self):
         self.colour_pos += 1