From: Christian Heller Date: Fri, 25 Jan 2019 19:52:25 +0000 (+0100) Subject: Add SWITCH_PLAYER debugging command for switching player. X-Git-Url: https://plomlompom.com/repos/?p=plomrogue2-experiments;a=commitdiff_plain;h=2476c32efd4ec85fafae42c556e9f1139f209f7e Add SWITCH_PLAYER debugging command for switching player. --- 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')