From 989e2f57c0e52e3742fa55a77ed8ab3bbd8f9bb8 Mon Sep 17 00:00:00 2001 From: Jacob Moss Date: Mon, 9 Jul 2018 11:00:34 +0100 Subject: [PATCH] Auto stash before merge of "worker_bots" and "fix_vagrant_bug" --- aimmo-game/simulation/avatar/avatar_wrapper.py | 3 ++- aimmo-game/simulation/worker_manager.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/aimmo-game/simulation/avatar/avatar_wrapper.py b/aimmo-game/simulation/avatar/avatar_wrapper.py index 0d31f669d..81c1a0309 100644 --- a/aimmo-game/simulation/avatar/avatar_wrapper.py +++ b/aimmo-game/simulation/avatar/avatar_wrapper.py @@ -81,7 +81,8 @@ def decide_action(self, state_view): try: data = self._fetch_action(state_view) action = self._construct_action(data) - + print 'ACTION CHOSEN:' + print action.direction except (KeyError, ValueError) as err: LOGGER.info('Bad action data supplied: %s', err) except requests.exceptions.ConnectionError as e: diff --git a/aimmo-game/simulation/worker_manager.py b/aimmo-game/simulation/worker_manager.py index 13b748fb5..0981d85ce 100644 --- a/aimmo-game/simulation/worker_manager.py +++ b/aimmo-game/simulation/worker_manager.py @@ -36,11 +36,17 @@ def _remove_avatar(self, user_id): def remove_user_if_code_is_different(self, user): with self._lock: existing_code = self._user_codes.get(user['id'], None) + if existing_code is None: + return True if existing_code != user['code']: # Remove avatar from the game, so it stops being called for turns if existing_code is not None: - self._remove_avatar(user['id']) - return True + LOGGER.info("USER CODES:") + print self._user_codes[user['id']] + print user['code'] + self._user_codes[user['id']] = user['code'] + # self._remove_avatar(user['id']) + return False else: return False