diff options
-rw-r--r-- | apworld/__init__.py | 2 | ||||
-rw-r--r-- | apworld/context.py | 16 |
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 | ||
164 | component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, | 164 | component = 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") |
166 | components.append(component) | 166 | 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 | |||
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() |