diff options
Diffstat (limited to 'game')
-rw-r--r-- | game/04_init.rpy | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/game/04_init.rpy b/game/04_init.rpy index 86a269a..99359f6 100644 --- a/game/04_init.rpy +++ b/game/04_init.rpy @@ -141,17 +141,16 @@ init python: def send_packet(packet, args=""): global tr_cmd, tr_busy, tr_load schedule_packet() - tr_cmd=[packet, args] + send_packet_now(packet, args) tr_val = wait_packet() return - # This is not really required, just makes we use two threads - # instead of one? tr_busy is handled by shcedule_packet() which is - # summoned by send_packet() already, so it should not be needed - # I guess it could be handful to auto-restart connection laterâ„¢? + # In past, this would keep running, in hopes of catching the program quit + # and being able to kill the threads... But well, it worked poorly. + # Still called "supervisor" but all it does now is init. # sslopt={"cert_reqs": CERT_NONE}) def supervisor(use_ssl): - global tr_load, tr_val, tr_busy, tr_cmd, ws + global ws stdout(_("Opening new socket...")) if use_ssl: ws = GameClient("wss://"+HOST+":61000") @@ -160,25 +159,6 @@ init python: ws.connect() renpy.invoke_in_thread(ws.run_forever) # May be problematic stdout("Connection established!") - - # Begin loop - while True: - try: - if tr_cmd[0] != "": - #schedule_packet() - send_packet_now(tr_cmd[0], tr_cmd[1]) - tr_cmd=["", ""] - # Main thread is the one waiting, not us - time.sleep(0.02) - pass - except NameError: - print("NameError, perhaps the program has terminated?") - break - try: - ws.close() - except: - pass - - # Close the supervisor module + # The supervisor module is now uneeded as thread was cast return |