diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-16 14:57:59 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-16 14:57:59 -0300 |
commit | 8bb0297d0234b726ade29ab5fade14afb038536c (patch) | |
tree | b31f3edab61e5df24988062ca08a6b09d499ea7a | |
parent | 400b0d7c07765b592979dbe550877d9dcec37de8 (diff) | |
download | client-8bb0297d0234b726ade29ab5fade14afb038536c.tar.gz client-8bb0297d0234b726ade29ab5fade14afb038536c.tar.bz2 client-8bb0297d0234b726ade29ab5fade14afb038536c.tar.xz client-8bb0297d0234b726ade29ab5fade14afb038536c.zip |
Well, renpy.pause() sometimes fail, so create an alias function (sdelay)
And hope it works :p
-rw-r--r-- | game/defs.rpy | 20 | ||||
-rw-r--r-- | game/script.rpy | 11 |
2 files changed, 17 insertions, 14 deletions
diff --git a/game/defs.rpy b/game/defs.rpy index 226f7a4..53c6cd9 100644 --- a/game/defs.rpy +++ b/game/defs.rpy @@ -121,6 +121,15 @@ init -3 python: renpy.write_log("[GAME] %s" % message) return + # Smart wait + def sdelay(): + try: + renpy.pause(0.02) + except: + time.sleep(0.02) + return + + # Global classes # We need to override standard list method. Original by Triptych (stackoverflow) class dlist(list): @@ -440,7 +449,7 @@ init -1 python: global tr_load, tr_val, tr_busy # TODO: if tr_busy already true, wait until it is made false while tr_busy: - renpy.pause(0.02) + sdelay() # Book processing space for ourselves tr_busy=True @@ -459,8 +468,8 @@ init -1 python: renpy.show("spinner", at_list=[truecenter]) renpy.invoke_in_thread(send_packet_now, packet, args) while not tr_load: - renpy.pause(0.1) # FIXME: This can cause errors in mobile - timeout+=0.1 + sdelay() # FIXME: This can cause errors in mobile? + timeout+=0.02 if timeout >= TIMEOUT_INTERVAL: # FIXME: What if a screen is already being displayed? BUG @@ -489,10 +498,7 @@ init -1 python: # Wait until everything is up to date while not tr_uptodate: - try: - renpy.pause(0.02) - except: - time.sleep(0.02) + sdelay() # Load unit data allunitsbase=json.loads(requests.get("http://"+HOST+'/units.json').text) diff --git a/game/script.rpy b/game/script.rpy index daac0cd..6147efe 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -115,7 +115,7 @@ label start: renpy.invoke_in_thread(ws.run_forever) while not tr_load: - renpy.pause(0.02) + sdelay() $ stdout("Connection established!") @@ -124,7 +124,7 @@ label start: tr_load=False renpy.invoke_in_thread(GAME_UPDATER) while not tr_load: - renpy.pause(0.02) + sdelay() hide spinner @@ -223,7 +223,7 @@ label login: tr_load=False renpy.invoke_in_thread(GAME_LOADER) while not tr_load: - renpy.pause(0.02) + sdelay() $ persistent.password=password $ dlcode-=5000 @@ -248,10 +248,7 @@ label login: # Wait until everything is loaded python: while not tr_memcheck: - try: - renpy.pause(0.02) - except: - time.sleep(0.02) + sdelay() if (email): $ del email |