From 2125ccf715544d3703cadf064a85331de8b053e4 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 27 Sep 2025 11:49:37 -0400 Subject: Automatically close client when clicking Quit --- apworld/client/client.gd | 4 ++++ apworld/client/main.gd | 1 + apworld/context.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/apworld/client/client.gd b/apworld/client/client.gd index 05b2b6c..286ad4b 100644 --- a/apworld/client/client.gd +++ b/apworld/client/client.gd @@ -227,6 +227,10 @@ func scoutLocations(loc_ids): sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) +func sendQuit(): + sendMessage([{"cmd": "Quit"}]) + + func hasItem(item_id): return _received_items.has(item_id) diff --git a/apworld/client/main.gd b/apworld/client/main.gd index 9d66358..8425d8c 100644 --- a/apworld/client/main.gd +++ b/apworld/client/main.gd @@ -137,6 +137,7 @@ func _connect_pressed(): func _back_pressed(): var ap = global.get_node("Archipelago") ap.disconnect_from_ap() + ap.client.sendQuit() get_tree().quit() diff --git a/apworld/context.py b/apworld/context.py index 2a2149f..41e833e 100644 --- a/apworld/context.py +++ b/apworld/context.py @@ -267,6 +267,8 @@ async def process_game_cmd(ctx: Lingo2GameContext, args: dict): async_start(ctx.client.disconnect(), name="client disconnect") elif cmd in ["Sync", "LocationChecks", "Say", "StatusUpdate", "LocationScouts"]: async_start(ctx.client.send_msgs([args]), name="client forward") + elif cmd == "Quit": + ctx.client.exit_event.set() async def run_game(): @@ -328,6 +330,7 @@ def client_main(*launch_args: str) -> None: logger.exception(e) await client_ctx.exit_event.wait() + client_ctx.ui.stop() await client_ctx.shutdown() Utils.init_logging("Lingo2Client", exception_logger="Client") -- cgit 1.4.1