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]
|
key = KEYMAP[action]
|
||||||
core.set_keys(key)
|
core.set_keys(key)
|
||||||
logging.debug(f"pressing: {key}")
|
logging.debug(f"pressing: {key}")
|
||||||
|
elif action == "null":
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
logging.error(f"unsupported action: {data}")
|
logging.error(f"unsupported action: {data}")
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ def clear_votes():
|
||||||
VOTES[key] = 0
|
VOTES[key] = 0
|
||||||
for user in USERS:
|
for user in USERS:
|
||||||
user.has_voted = False
|
user.has_voted = False
|
||||||
logging.info(f"votes cleared: {VOTES}")
|
|
||||||
|
|
||||||
|
|
||||||
def next_move():
|
def next_move():
|
||||||
|
@ -92,15 +91,11 @@ async def handler(websocket, path):
|
||||||
VOTES[action] += 1
|
VOTES[action] += 1
|
||||||
user.last_message = time.time()
|
user.last_message = time.time()
|
||||||
user.has_voted = True
|
user.has_voted = True
|
||||||
logging.debug(f"key received: {action} ({VOTES[action]}), from {user}")
|
|
||||||
else:
|
else:
|
||||||
logging.error(f"unsupported action: {data}")
|
logging.error(f"unsupported action: {data}")
|
||||||
|
|
||||||
if "admin" in data:
|
if "admin" in data:
|
||||||
admin = data["admin"]
|
admin = data["admin"]
|
||||||
|
|
||||||
print(admin)
|
|
||||||
|
|
||||||
if admin == "save":
|
if admin == "save":
|
||||||
await EMULATOR.send('{"admin":"save"}')
|
await EMULATOR.send('{"admin":"save"}')
|
||||||
elif admin == "load":
|
elif admin == "load":
|
||||||
|
@ -115,7 +110,6 @@ async def handler(websocket, path):
|
||||||
if EMULATOR and websocket == EMULATOR:
|
if EMULATOR and websocket == EMULATOR:
|
||||||
move = next_move()
|
move = next_move()
|
||||||
await EMULATOR.send(f'{{"action":"{move}"}}')
|
await EMULATOR.send(f'{{"action":"{move}"}}')
|
||||||
logging.info(f"vote sent: {move}")
|
|
||||||
clear_votes()
|
clear_votes()
|
||||||
else:
|
else:
|
||||||
logging.error(f"user is not EMULATOR: {user}")
|
logging.error(f"user is not EMULATOR: {user}")
|
||||||
|
|
Loading…
Reference in a new issue