diff --git a/worlds/tww/TWWClient.py b/worlds/tww/TWWClient.py index cb4c25685d92..b71f43d56979 100644 --- a/worlds/tww/TWWClient.py +++ b/worlds/tww/TWWClient.py @@ -696,12 +696,11 @@ async def dolphin_sync_task(ctx: TWWContext) -> None: continue -def main(connect: Optional[str] = None, password: Optional[str] = None) -> None: +def main(*args: str) -> None: """ Run the main async loop for the Wind Waker client. - :param connect: Address of the Archipelago server. - :param password: Password for server authentication. + :param *args: Command line arguments passed to the client. """ Utils.init_logging("The Wind Waker Client") @@ -726,14 +725,11 @@ async def _main(connect: Optional[str], password: Optional[str]) -> None: if ctx.dolphin_sync_task: await ctx.dolphin_sync_task + parser = get_base_parser() + parsed_args = parser.parse_args(args) + import colorama colorama.init() - asyncio.run(_main(connect, password)) + asyncio.run(_main(parsed_args.connect, parsed_args.password)) colorama.deinit() - - -if __name__ == "__main__": - parser = get_base_parser() - args = parser.parse_args() - main(args.connect, args.password) diff --git a/worlds/tww/__init__.py b/worlds/tww/__init__.py index 58e752b5c9ad..f4418c698b1a 100644 --- a/worlds/tww/__init__.py +++ b/worlds/tww/__init__.py @@ -13,7 +13,7 @@ from worlds.AutoWorld import WebWorld, World from worlds.Files import APPlayerContainer from worlds.generic.Rules import add_item_rule -from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch_subprocess +from worlds.LauncherComponents import Component, SuffixIdentifier, Type, components, icon_paths, launch from .Items import ISLAND_NUMBER_TO_CHART_NAME, ITEM_TABLE, TWWItem, item_name_groups from .Locations import LOCATION_TABLE, TWWFlag, TWWLocation @@ -29,14 +29,16 @@ VERSION: tuple[int, int, int] = (3, 0, 0) -def run_client() -> None: +def run_client(*args: str) -> None: """ Launch the The Wind Waker client. + + :param *args: Variable length argument list passed to the client. """ print("Running The Wind Waker Client") from .TWWClient import main - launch_subprocess(main, name="TheWindWakerClient") + launch(main, name="TheWindWakerClient", args=args) components.append(