Skip to content

Commit

Permalink
Auto stash before merge of "worker_bots" and "fix_vagrant_bug"
Browse files Browse the repository at this point in the history
  • Loading branch information
mossjacob committed Jul 9, 2018
1 parent 05c24f5 commit 989e2f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion aimmo-game/simulation/avatar/avatar_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions aimmo-game/simulation/worker_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 989e2f5

Please sign in to comment.