fix: removed useless logging
feat: emulator now ask for input every frame
This commit is contained in:
parent
68f7cf8878
commit
6356960672
|
@ -55,6 +55,8 @@ async def main():
|
|||
key = KEYMAP[action]
|
||||
core.set_keys(key)
|
||||
logging.debug(f"pressing: {key}")
|
||||
elif action == "null":
|
||||
pass
|
||||
else:
|
||||
logging.error(f"unsupported action: {data}")
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ def clear_votes():
|
|||
VOTES[key] = 0
|
||||
for user in USERS:
|
||||
user.has_voted = False
|
||||
logging.info(f"votes cleared: {VOTES}")
|
||||
|
||||
|
||||
def next_move():
|
||||
|
@ -92,15 +91,11 @@ async def handler(websocket, path):
|
|||
VOTES[action] += 1
|
||||
user.last_message = time.time()
|
||||
user.has_voted = True
|
||||
logging.debug(f"key received: {action} ({VOTES[action]}), from {user}")
|
||||
else:
|
||||
logging.error(f"unsupported action: {data}")
|
||||
|
||||
if "admin" in data:
|
||||
admin = data["admin"]
|
||||
|
||||
print(admin)
|
||||
|
||||
if admin == "save":
|
||||
await EMULATOR.send('{"admin":"save"}')
|
||||
elif admin == "load":
|
||||
|
@ -115,7 +110,6 @@ async def handler(websocket, path):
|
|||
if EMULATOR and websocket == EMULATOR:
|
||||
move = next_move()
|
||||
await EMULATOR.send(f'{{"action":"{move}"}}')
|
||||
logging.info(f"vote sent: {move}")
|
||||
clear_votes()
|
||||
else:
|
||||
logging.error(f"user is not EMULATOR: {user}")
|
||||
|
|
Loading…
Reference in a new issue