diff options
-rw-r--r-- | game/defs.rpy | 11 | ||||
-rw-r--r-- | game/script.rpy | 10 |
2 files changed, 20 insertions, 1 deletions
diff --git a/game/defs.rpy b/game/defs.rpy index ae53c57..226f7a4 100644 --- a/game/defs.rpy +++ b/game/defs.rpy @@ -20,7 +20,7 @@ init -3 python: renpy.add_python_directory("python-extra") - import requests, zlib, base64, sys, copy, uuid + import requests, zlib, base64, sys, copy, uuid, time import websock as wsock # set PYTHON_VERSION variable (should be 2713, 3605 could fail) @@ -310,6 +310,7 @@ init -3 python: # Download server news # Handled by GAME_LOADER + tr_uptodate=True tr_load=True return tr_load @@ -486,6 +487,13 @@ init -1 python: global allnews, tr_load tr_load=False + # Wait until everything is up to date + while not tr_uptodate: + try: + renpy.pause(0.02) + except: + time.sleep(0.02) + # Load unit data allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text) # f=open(get_path_if_exists("units.json"), "r") @@ -531,6 +539,7 @@ init -1 python: 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 bf0c10b..daac0cd 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -75,6 +75,8 @@ label start: tr_busy=True tr_val="" tr_load=False + tr_uptodate=False + tr_memcheck=False session_id=uuid.uuid4().hex #"We shall now begin testing a websocket" @@ -243,6 +245,14 @@ label login: # Remove some temporary variables $ del password + # Wait until everything is loaded + python: + while not tr_memcheck: + try: + renpy.pause(0.02) + except: + time.sleep(0.02) + if (email): $ del email jump prologue |