Pull SelectableSurfActor out of vehicles.
authorSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 19:42:25 +0000 (21:42 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 5 Mar 2016 19:42:25 +0000 (21:42 +0200)
koperkapel/actors/orientatedsurf.py
koperkapel/vehicles/base.py

index ae79c43007d78a4ca28c19de52a352a53fd86655..284ac71f2e5779e48812b975e91e762fd47a6564 100644 (file)
@@ -39,3 +39,20 @@ class OrientatedSurfActor(SurfActor):
         self._base_surf = surf
         self._orig_surf = self._surf = rotate(surf, self._angle)
         self._update_pos()
+
+
+class SelectableSurfActor(OrientatedSurfActor):
+    def __init__(self, seat, selected_seat):
+        self._selected = False
+        self._seat = seat
+        self._selected_seat = selected_seat
+        super().__init__(surf=self._seat, angle=0)
+
+    @property
+    def selected(self):
+        return self._selected
+
+    @selected.setter
+    def selected(self, value):
+        self._selected = value
+        self.surf = self._selected_seat if value else self._seat
index 27e1b24d4f0633575ac9519260de5c05d8c1a002..ba21bbeb94857284f829ebbb8ccc1c731d84ee9e 100644 (file)
@@ -5,7 +5,7 @@ import random
 from itertools import chain, islice, repeat
 from pygame.constants import BLEND_RGBA_MULT
 from pgzero.loaders import images
-from ..actors.orientatedsurf import OrientatedSurfActor
+from ..actors.orientatedsurf import SelectableSurfActor
 from ..actors.animsurf import AnimatedSurfActor
 from ..weapons import default_weapons
 
@@ -129,24 +129,7 @@ class Seat:
         selected_seat = seat.copy()
         selected_seat.fill(
             self.vehicle.selected_seat_overlay_color, None, BLEND_RGBA_MULT)
-        return SeatActor(seat, selected_seat)
-
-
-class SeatActor(OrientatedSurfActor):
-    def __init__(self, seat, selected_seat):
-        self._selected = False
-        self._seat = seat
-        self._selected_seat = selected_seat
-        super().__init__(surf=self._seat, angle=0)
-
-    @property
-    def selected(self):
-        return self._selected
-
-    @selected.setter
-    def selected(self, value):
-        self._selected = value
-        self.surf = self._selected_seat if value else self._seat
+        return SelectableSurfActor(seat, selected_seat)
 
 
 def circle_of_seats(n_seats, **kw):