From f0c59deb3bfa9189c2136ab3c494f8a5b452470b Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 25 Sep 2025 18:54:44 -0400 Subject: Support launching with AP URL --- apworld/__init__.py | 2 +- apworld/context.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'apworld') diff --git a/apworld/__init__.py b/apworld/__init__.py index fc397a2..f99f5f5 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py @@ -162,5 +162,5 @@ def launch_client(*args): component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, - description="Open Lingo 2.") + description="Open Lingo 2.", supports_uri=True, game_name="Lingo 2") components.append(component) 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 import Utils import settings -from CommonClient import CommonContext, server_loop, gui_enabled, logger +from CommonClient import CommonContext, server_loop, gui_enabled, logger, get_base_parser, handle_url_arg from NetUtils import Endpoint, decode, encode from Utils import async_start @@ -272,10 +272,10 @@ async def run_game(): def client_main(*launch_args: str) -> None: - async def main(): + async def main(args): async_start(run_game()) - client_ctx = Lingo2ClientContext() + client_ctx = Lingo2ClientContext(args.connect, args.password) game_ctx = Lingo2GameContext() client_ctx.game_ctx = game_ctx @@ -299,6 +299,14 @@ def client_main(*launch_args: str) -> None: Utils.init_logging("Lingo2Client", exception_logger="Client") import colorama + + parser = get_base_parser(description="Lingo 2 Archipelago Client") + parser.add_argument('--name', default=None, help="Slot Name to connect as.") + parser.add_argument("url", nargs="?", help="Archipelago connection url") + args = parser.parse_args(launch_args) + + args = handle_url_arg(args, parser=parser) + colorama.just_fix_windows_console() - asyncio.run(main()) + asyncio.run(main(args)) colorama.deinit() -- cgit 1.4.1