diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-10 22:34:40 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-10 22:34:40 -0300 |
commit | c4b11763e4c426b1ea6b52a5239cc7a9ff787cfc (patch) | |
tree | 3aec503c97d2066dd94296da5240080bba8523d8 | |
parent | 502e289b65eae3d492f1ab9460af11b2153237d3 (diff) | |
download | renpy-c4b11763e4c426b1ea6b52a5239cc7a9ff787cfc.tar.gz renpy-c4b11763e4c426b1ea6b52a5239cc7a9ff787cfc.tar.bz2 renpy-c4b11763e4c426b1ea6b52a5239cc7a9ff787cfc.tar.xz renpy-c4b11763e4c426b1ea6b52a5239cc7a9ff787cfc.zip |
Rewrite a bit this fancy code.
Isolate the client launching code, terminate the session of the code explodes.
Of course, make logs about that terrible incident =/
-rw-r--r-- | game/client.rpy | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/game/client.rpy b/game/client.rpy index 2565edc..c105524 100644 --- a/game/client.rpy +++ b/game/client.rpy @@ -23,7 +23,8 @@ init 2 python: def launch_game(idx): global progress, responsive - # TODO: use the proper discord RPC image + ######################################################################## + ## Setup RPCUpdate(persistent.serverlist[idx]["Name"], persistent.serverlist[idx]["Back"]) HOST=persistent.serverlist[idx]["Host"] PORT=persistent.serverlist[idx]["Port"] @@ -31,8 +32,9 @@ init 2 python: OPT="-s %s -y evol2 -p %s" % (HOST, PORT) stdout("%s %s" % (CMD, OPT)) + ######################################################################## ## Obtain access token from vault - ## TODO: Only skip failure if not dev + ## Failures are skipped (!!) unless they are a 403 (FORBIDDEN) auth = {"vaultId": vaultId, "token": vaultToken, "world": persistent.serverlist[idx]["UUID"]} @@ -51,25 +53,35 @@ init 2 python: except: pass - ## Minimize to tray if set - if not renpy.mobile and persistent.iconify: - renpy.iconify() + ######################################################################## + ## Loop + try: + ## Minimize to tray if set + if not renpy.mobile and persistent.iconify: + renpy.iconify() - ## Launch your prefered game client, wait for it to finish - if renpy.windows: - app=execute("\"%s\" %s%s" % (CMD, OPT, PWD), shell=True) - else: - app=execute("%s %s%s" % (CMD, OPT, PWD), shell=True) - if app: + ## Launch your prefered game client, wait for it to finish + if renpy.windows: + app=execute("\"%s\" %s%s" % (CMD, OPT, PWD), shell=True) + else: + app=execute("%s %s%s" % (CMD, OPT, PWD), shell=True) + if app: + traceback.print_exc() + stdout("[CLIENT] An error happened: %d" % app) + #responsive = False + except: traceback.print_exc() - stdout("[CLIENT] An error happened: %d" % app) - #responsive = False + stdout("[FATAL] An error happened trying to launch the client D:") + responsive = False # NOTE: Now we would like to un-minimize ourselves # But we cannot =/ # There's a few tricks but not very nice... # https://stackoverflow.com/questions/45426203/minimize-window-with-python (Linux) # https://stackoverflow.com/questions/2791489/how-do-i-take-out-the-focus-or-minimize-a-window-with-python/2792059 (Windows) + + ######################################################################## + ## Cleanup progress=100 # Clean discord RPC and go back to world selection menu |