mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
some QOL
This commit is contained in:
@@ -14,6 +14,10 @@ ModuleUpdate.update()
|
||||
import colorama
|
||||
import websockets
|
||||
import aioconsole
|
||||
try:
|
||||
import tqdm
|
||||
except:
|
||||
tqdm = None
|
||||
|
||||
import Items
|
||||
import Regions
|
||||
@@ -74,7 +78,7 @@ def color(text, *args):
|
||||
return color_code(*args) + text + color_code('reset')
|
||||
|
||||
|
||||
RECONNECT_DELAY = 30
|
||||
RECONNECT_DELAY = 5
|
||||
|
||||
ROM_START = 0x000000
|
||||
WRAM_START = 0xF50000
|
||||
@@ -415,7 +419,11 @@ async def snes_connect(ctx : Context, address):
|
||||
asyncio.create_task(snes_autoreconnect(ctx))
|
||||
|
||||
async def snes_autoreconnect(ctx: Context):
|
||||
await asyncio.sleep(RECONNECT_DELAY)
|
||||
if tqdm:
|
||||
for _ in tqdm.trange(100, unit='%', leave=False):
|
||||
await asyncio.sleep(RECONNECT_DELAY/100)
|
||||
else:
|
||||
await asyncio.sleep(RECONNECT_DELAY)
|
||||
if ctx.snes_reconnect_address and ctx.snes_socket is None:
|
||||
await snes_connect(ctx, ctx.snes_reconnect_address)
|
||||
|
||||
@@ -601,7 +609,11 @@ async def server_loop(ctx : Context, address = None):
|
||||
asyncio.create_task(server_autoreconnect(ctx))
|
||||
|
||||
async def server_autoreconnect(ctx: Context):
|
||||
await asyncio.sleep(RECONNECT_DELAY)
|
||||
if tqdm:
|
||||
for _ in tqdm.trange(100, unit='%', leave=False):
|
||||
await asyncio.sleep(RECONNECT_DELAY/100)
|
||||
else:
|
||||
await asyncio.sleep(RECONNECT_DELAY)
|
||||
if ctx.server_address and ctx.server_task is None:
|
||||
ctx.server_task = asyncio.create_task(server_loop(ctx))
|
||||
|
||||
|
Reference in New Issue
Block a user