Make bridge notification less spammy

This commit is contained in:
Fabian Dill 2021-04-04 01:19:54 +02:00
parent 250099f5fd
commit 4ab59d522d
1 changed files with 7 additions and 3 deletions

View File

@ -76,7 +76,8 @@ async def game_watcher(ctx: FactorioContext):
researches_done_file = os.path.join(script_folder, "research_done.json")
if os.path.exists(researches_done_file):
os.remove(researches_done_file)
from worlds.factorio.Technologies import lookup_id_to_name, tech_table
from worlds.factorio.Technologies import lookup_id_to_name
bridge_counter = 0
try:
while 1:
if os.path.exists(researches_done_file):
@ -92,8 +93,11 @@ async def game_watcher(ctx: FactorioContext):
await ctx.send_msgs([{"cmd": 'LocationChecks', "locations": tuple(research_data)}])
await asyncio.sleep(1)
else:
research_logger.info("Did not find Factorio Bridge file.")
await asyncio.sleep(5)
bridge_counter += 1
if bridge_counter >= 60:
research_logger.info("Did not find Factorio Bridge file, waiting for mod to run.")
bridge_counter = 1
await asyncio.sleep(1)
except Exception as e:
logging.exception(e)
logging.error("Aborted Factorio Server Bridge")