diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 18:54:44 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 18:54:44 -0400 |
commit | f0c59deb3bfa9189c2136ab3c494f8a5b452470b (patch) | |
tree | e31d74b23327c74f1204ed3250b6413bdc4ccc2c /apworld/context.py | |
parent | 05827d25733698a26cc0f305966e6a8a03be4684 (diff) | |
download | lingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.tar.gz lingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.tar.bz2 lingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.zip |
Support launching with AP URL
Diffstat (limited to 'apworld/context.py')
-rw-r--r-- | apworld/context.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apworld/context.py b/apworld/context.py index 848efb8..2294491 100644 --- a/apworld/context.py +++ b/apworld/context.py | |||
@@ -8,7 +8,7 @@ import websockets | |||
8 | 8 | ||
9 | import Utils | 9 | import Utils |
10 | import settings | 10 | import settings |
11 | from CommonClient import CommonContext, server_loop, gui_enabled, logger | 11 | from CommonClient import CommonContext, server_loop, gui_enabled, logger, get_base_parser, handle_url_arg |
12 | from NetUtils import Endpoint, decode, encode | 12 | from NetUtils import Endpoint, decode, encode |
13 | from Utils import async_start | 13 | from Utils import async_start |
14 | 14 | ||
@@ -272,10 +272,10 @@ async def run_game(): | |||
272 | 272 | ||
273 | 273 | ||
274 | def client_main(*launch_args: str) -> None: | 274 | def client_main(*launch_args: str) -> None: |
275 | async def main(): | 275 | async def main(args): |
276 | async_start(run_game()) | 276 | async_start(run_game()) |
277 | 277 | ||
278 | client_ctx = Lingo2ClientContext() | 278 | client_ctx = Lingo2ClientContext(args.connect, args.password) |
279 | game_ctx = Lingo2GameContext() | 279 | game_ctx = Lingo2GameContext() |
280 | 280 | ||
281 | client_ctx.game_ctx = game_ctx | 281 | client_ctx.game_ctx = game_ctx |
@@ -299,6 +299,14 @@ def client_main(*launch_args: str) -> None: | |||
299 | 299 | ||
300 | Utils.init_logging("Lingo2Client", exception_logger="Client") | 300 | Utils.init_logging("Lingo2Client", exception_logger="Client") |
301 | import colorama | 301 | import colorama |
302 | |||
303 | parser = get_base_parser(description="Lingo 2 Archipelago Client") | ||
304 | parser.add_argument('--name', default=None, help="Slot Name to connect as.") | ||
305 | parser.add_argument("url", nargs="?", help="Archipelago connection url") | ||
306 | args = parser.parse_args(launch_args) | ||
307 | |||
308 | args = handle_url_arg(args, parser=parser) | ||
309 | |||
302 | colorama.just_fix_windows_console() | 310 | colorama.just_fix_windows_console() |
303 | asyncio.run(main()) | 311 | asyncio.run(main(args)) |
304 | colorama.deinit() | 312 | colorama.deinit() |