about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 18:54:44 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 18:54:44 -0400
commitf0c59deb3bfa9189c2136ab3c494f8a5b452470b (patch)
treee31d74b23327c74f1204ed3250b6413bdc4ccc2c
parent05827d25733698a26cc0f305966e6a8a03be4684 (diff)
downloadlingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.tar.gz
lingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.tar.bz2
lingo2-archipelago-f0c59deb3bfa9189c2136ab3c494f8a5b452470b.zip
Support launching with AP URL
-rw-r--r--apworld/__init__.py2
-rw-r--r--apworld/context.py16
2 files changed, 13 insertions, 5 deletions
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):
162 162
163 163
164component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, 164component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client,
165 description="Open Lingo 2.") 165 description="Open Lingo 2.", supports_uri=True, game_name="Lingo 2")
166components.append(component) 166components.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
8 8
9import Utils 9import Utils
10import settings 10import settings
11from CommonClient import CommonContext, server_loop, gui_enabled, logger 11from CommonClient import CommonContext, server_loop, gui_enabled, logger, get_base_parser, handle_url_arg
12from NetUtils import Endpoint, decode, encode 12from NetUtils import Endpoint, decode, encode
13from Utils import async_start 13from Utils import async_start
14 14
@@ -272,10 +272,10 @@ async def run_game():
272 272
273 273
274def client_main(*launch_args: str) -> None: 274def 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()