Skip to content

Commit

Permalink
actuators: Migrate to rotate action
Browse files Browse the repository at this point in the history
  • Loading branch information
tchx84 committed Feb 22, 2024
1 parent b8f0f83 commit d84e6e3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/gameeky/server/game/actuators/rotates_i.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,25 @@

from .base import Actuator as BaseActuator

from ....common.definitions import Direction
from ....common.definitions import Action, Direction


class Actuator(BaseActuator):
name = "rotates_i"
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()

0 comments on commit d84e6e3

Please sign in to comment.