From d84e6e375355f7f7d3769fbd56820ec3827cacf0 Mon Sep 17 00:00:00 2001 From: Martin Abente Lahaye Date: Thu, 22 Feb 2024 14:28:13 -0300 Subject: [PATCH] actuators: Migrate to rotate action --- src/gameeky/server/game/actuators/rotates_i.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gameeky/server/game/actuators/rotates_i.py b/src/gameeky/server/game/actuators/rotates_i.py index 31ca4754..9d942f23 100644 --- a/src/gameeky/server/game/actuators/rotates_i.py +++ b/src/gameeky/server/game/actuators/rotates_i.py @@ -18,7 +18,7 @@ from .base import Actuator as BaseActuator -from ....common.definitions import Direction +from ....common.definitions import Action, Direction class Actuator(BaseActuator): @@ -26,12 +26,17 @@ class Actuator(BaseActuator): interactable = True activatable = False + __sequence__ = { + Direction.NORTH: Direction.EAST, + Direction.EAST: Direction.SOUTH, + Direction.SOUTH: Direction.WEST, + Direction.WEST: Direction.NORTH, + } + def tick(self) -> None: if self._interactee is None: return - directions = list(Direction) - index = directions.index(self._entity.direction) - self._entity.direction = directions[(index + 1) % len(directions)] + self._entity.perform(Action.ROTATE, self.__sequence__[self._entity.direction]) super().tick()