From 2476c32efd4ec85fafae42c556e9f1139f209f7e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 25 Jan 2019 20:52:25 +0100 Subject: [PATCH] Add SWITCH_PLAYER debugging command for switching player. --- server_/game.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server_/game.py b/server_/game.py index 6c283b5..5ba3ab2 100644 --- a/server_/game.py +++ b/server_/game.py @@ -335,6 +335,17 @@ class Game(game_common.CommonCommandsMixin): self.proceed() cmd_MOVE.argtypes = 'string' + def cmd_SWITCH_PLAYER(self): + player = self.world.get_player() + player.set_task('wait') + thing_ids = [t.id_ for t in self.world.things] + player_index = thing_ids.index(player.id_) + if player_index == len(thing_ids) - 1: + self.world.player_id = thing_ids[0] + else: + self.world.player_id = thing_ids[player_index + 1] + self.proceed() + def cmd_WAIT(self): """Set player task to 'wait', finish player turn.""" self.world.get_player().set_task('wait') -- 2.30.2