From 7039cee223813f57dbea9c2cf2094c19f6f83db0 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Wed, 8 Mar 2023 00:50:32 -0500 Subject: [PATCH] [+] q or ^c to quit --- tngame/telnet.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tngame/telnet.py b/tngame/telnet.py index e151bcb..ad1a9ce 100644 --- a/tngame/telnet.py +++ b/tngame/telnet.py @@ -88,7 +88,6 @@ async def shell(reader: TelnetReaderUnicode, writer: TelnetWriterUnicode): # Update snow particles def update_snow(dt: float): - log.info(f'Updating snow particles: {dt}') nonlocal snow buf = "" @@ -177,14 +176,13 @@ async def shell(reader: TelnetReaderUnicode, writer: TelnetWriterUnicode): # Handle input function async def on_input(inp: str): nonlocal x, y - log.info(repr(inp)) # Switch case match inp: case '\x1b[C': # Right await move(1) case '\x1b[D': # Left await move(-1) - case '\x1b': # Escape + case '\x1b' | 'q' | '\x03': # Escape or q or Ctrl+C writer.write('\r\nBye!\r\n') writer.close() return True @@ -197,8 +195,8 @@ async def shell(reader: TelnetReaderUnicode, writer: TelnetWriterUnicode): async def listen_update(): while True: await update() - # 30 fps - await asyncio.sleep(1 / 30) + # 20 fps + await asyncio.sleep(1 / 20) # Listen input function async def listen_input():