diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-27 11:49:37 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-27 11:49:37 -0400 |
commit | 2125ccf715544d3703cadf064a85331de8b053e4 (patch) | |
tree | f5c784727d3ba02e4ee73f6b66d3d9f27a304e2e | |
parent | 86a5188548f80eab6bce3cb6686c49f8448683db (diff) | |
download | lingo2-archipelago-2125ccf715544d3703cadf064a85331de8b053e4.tar.gz lingo2-archipelago-2125ccf715544d3703cadf064a85331de8b053e4.tar.bz2 lingo2-archipelago-2125ccf715544d3703cadf064a85331de8b053e4.zip |
Automatically close client when clicking Quit
-rw-r--r-- | apworld/client/client.gd | 4 | ||||
-rw-r--r-- | apworld/client/main.gd | 1 | ||||
-rw-r--r-- | apworld/context.py | 3 |
3 files changed, 8 insertions, 0 deletions
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): | |||
227 | sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) | 227 | sendMessage([{"cmd": "LocationScouts", "locations": loc_ids}]) |
228 | 228 | ||
229 | 229 | ||
230 | func sendQuit(): | ||
231 | sendMessage([{"cmd": "Quit"}]) | ||
232 | |||
233 | |||
230 | func hasItem(item_id): | 234 | func hasItem(item_id): |
231 | return _received_items.has(item_id) | 235 | return _received_items.has(item_id) |
232 | 236 | ||
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(): | |||
137 | func _back_pressed(): | 137 | func _back_pressed(): |
138 | var ap = global.get_node("Archipelago") | 138 | var ap = global.get_node("Archipelago") |
139 | ap.disconnect_from_ap() | 139 | ap.disconnect_from_ap() |
140 | ap.client.sendQuit() | ||
140 | 141 | ||
141 | get_tree().quit() | 142 | get_tree().quit() |
142 | 143 | ||
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): | |||
267 | async_start(ctx.client.disconnect(), name="client disconnect") | 267 | async_start(ctx.client.disconnect(), name="client disconnect") |
268 | elif cmd in ["Sync", "LocationChecks", "Say", "StatusUpdate", "LocationScouts"]: | 268 | elif cmd in ["Sync", "LocationChecks", "Say", "StatusUpdate", "LocationScouts"]: |
269 | async_start(ctx.client.send_msgs([args]), name="client forward") | 269 | async_start(ctx.client.send_msgs([args]), name="client forward") |
270 | elif cmd == "Quit": | ||
271 | ctx.client.exit_event.set() | ||
270 | 272 | ||
271 | 273 | ||
272 | async def run_game(): | 274 | async def run_game(): |
@@ -328,6 +330,7 @@ def client_main(*launch_args: str) -> None: | |||
328 | logger.exception(e) | 330 | logger.exception(e) |
329 | 331 | ||
330 | await client_ctx.exit_event.wait() | 332 | await client_ctx.exit_event.wait() |
333 | client_ctx.ui.stop() | ||
331 | await client_ctx.shutdown() | 334 | await client_ctx.shutdown() |
332 | 335 | ||
333 | Utils.init_logging("Lingo2Client", exception_logger="Client") | 336 | Utils.init_logging("Lingo2Client", exception_logger="Client") |