From 92ff0ddba8ae300fe9164ee13b37d6a0d531db7a Mon Sep 17 00:00:00 2001 From: Phaneros <31861583+MatthewMarinets@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:34:26 -0700 Subject: [PATCH] SC2: Launcher bugfixes after content merge (#5409) * sc2: Fixing Launcher.py launch not properly handling command-line arguments * sc2: Fixing some old option names in webhost * sc2: Switching to common client url parameter handling --- worlds/sc2/client.py | 20 ++++++++------------ worlds/sc2/options.py | 4 ++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/worlds/sc2/client.py b/worlds/sc2/client.py index d64d44aea1..e9f46f93b7 100644 --- a/worlds/sc2/client.py +++ b/worlds/sc2/client.py @@ -21,10 +21,11 @@ import random import concurrent.futures import time import uuid +import argparse from pathlib import Path # CommonClient import first to trigger ModuleUpdater -from CommonClient import CommonContext, server_loop, ClientCommandProcessor, gui_enabled, get_base_parser +from CommonClient import CommonContext, server_loop, ClientCommandProcessor, gui_enabled, get_base_parser, handle_url_arg from Utils import init_logging, is_windows, async_start from .item import item_names, item_parents, race_to_item_type from .item.item_annotations import ITEM_NAME_ANNOTATIONS @@ -1298,20 +1299,15 @@ class CompatItemHolder(typing.NamedTuple): quantity: int = 1 -def parse_uri(uri: str) -> str: - if "://" in uri: - uri = uri.split("://", 1)[1] - return uri.split('?', 1)[0] - - -async def main(): +async def main(args: typing.Sequence[str] | None): multiprocessing.freeze_support() parser = get_base_parser() parser.add_argument('--name', default=None, help="Slot Name to connect as.") - args, uri = parser.parse_known_args() + args, uri = parser.parse_known_args(args) if uri and uri[0].startswith('archipelago://'): - args.connect = parse_uri(' '.join(uri)) + args.url = uri[0] + handle_url_arg(args, parser) ctx = SC2Context(args.connect, args.password) ctx.auth = args.name @@ -2346,7 +2342,7 @@ def force_settings_save_on_close() -> None: _has_forced_save = True -def launch(): +def launch(*args: str): colorama.just_fix_windows_console() - asyncio.run(main()) + asyncio.run(main(args)) colorama.deinit() diff --git a/worlds/sc2/options.py b/worlds/sc2/options.py index 08be7e187a..00dd4ba742 100644 --- a/worlds/sc2/options.py +++ b/worlds/sc2/options.py @@ -170,7 +170,7 @@ class TwoStartPositions(Toggle): If turned on and 'grid', 'hopscotch', or 'golden_path' mission orders are selected, removes the first mission and allows both of the next two missions to be played from the start. """ - display_name = "Start with two unlocked missions on grid" + display_name = "Two start missions" default = Toggle.option_false @@ -1053,7 +1053,7 @@ class VictoryCache(Range): Controls how many additional checks are awarded for completing a mission. Goal missions are unaffected by this option. """ - display_name = "Victory Checks" + display_name = "Victory Cache" range_start = 0 range_end = 10 default = 0