From 9166ecb29d9c8083e5b12117ec77027c09aecdac Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 18 Dec 2020 15:09:10 -0300 Subject: Be verbose, do more attempts, execute LOADER while server is doing other stuff. This is because LOADER will try to download news and this might be slow. LOADER will only begin after game data was started to be fetched from internet --- game/01_init.rpy | 5 ++--- game/02_init.rpy | 13 ++++++------- game/script.rpy | 14 +++++++++++--- 3 files changed, 19 insertions(+), 13 deletions(-) (limited to 'game') diff --git a/game/01_init.rpy b/game/01_init.rpy index ea71f99..9d45917 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -251,8 +251,8 @@ init -3 python: # URL3 Function def GAME_UPDATER(): - global tr_load - tr_load=False + global tr_uptodate + tr_uptodate=False # If no version is provided, we are using default files # Default files version is "1" (Should never happen) @@ -321,6 +321,5 @@ init -3 python: # Handled by GAME_LOADER tr_uptodate=True - tr_load=True return tr_load diff --git a/game/02_init.rpy b/game/02_init.rpy index 4df1927..f4c98f1 100644 --- a/game/02_init.rpy +++ b/game/02_init.rpy @@ -113,18 +113,17 @@ init -1 python: def GAME_LOADER(): global allunitsbase, allunits, allquests, allstory, allworld, alltaverns - global allnews, tr_load - tr_load=False + global allnews, tr_uptodate, tr_memcheck # Wait until everything is up to date while not tr_uptodate: sdelay() # Load unit data - allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text) - # f=open(get_path_if_exists("units.json"), "r") - # allunitsbase=json.load(f) - # f.close() + #allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text) + f=open(get_path_if_exists("units.json"), "r") + allunitsbase=json.load(f) + f.close() # Reorder unit data allunits={} @@ -156,6 +155,7 @@ init -1 python: alltaverns=json.load(f) f.close() + stdout("PREPARING FOR NEWS") # Load server news try: allnews=json.loads(requests.get("http://"+HOST+'/news.json', timeout=5.0).text) @@ -164,7 +164,6 @@ init -1 python: pass stdout("[OK] Game data loaded to memory") - tr_load=True tr_memcheck=True return tr_load diff --git a/game/script.rpy b/game/script.rpy index 7615715..0e0ed5d 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -96,18 +96,24 @@ label login: jump quit # Successful login? Update client data and begin routines + $ stdout("Login successful.") # Load game to memory python: tr_load=False renpy.invoke_in_thread(GAME_LOADER) - while not tr_load: - sdelay() + #while not tr_load: + # sdelay() $ persistent.password=password $ dlcode-=5000 #$ ping_routine() - $ renpy.invoke_in_thread(irc_loop) + python: + try: + renpy.invoke_in_thread(irc_loop) + except: + stdout("IRC disabled") + pass # We're now logged in, load misc data (TODO: What if ERR_ is returned?) $ who = -1 @@ -123,6 +129,7 @@ label login: # Remove some temporary variables $ del password + $ stdout("Waiting for game data to be loaded to memory...") # Wait until everything is loaded python: @@ -135,6 +142,7 @@ label login: # Begin loop play music MUSIC_TOWN fadein 0.5 + $ stdout("Game started successfully!") # Show news (if they exist and you haven't logged in past day) if dlcode: -- cgit v1.2.3-70-g09d2