Skip to content

Commit d5a7e2e

Browse files
Merge branch 'ArchipelagoMW:main' into main
2 parents 51fe19c + 3c819ec commit d5a7e2e

99 files changed

Lines changed: 2187 additions & 321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- "!.github/workflows/**"
1212
- ".github/workflows/docker.yml"
1313
branches:
14-
- "*"
14+
- "main"
1515
tags:
1616
- "v?[0-9]+.[0-9]+.[0-9]*"
1717
workflow_dispatch:

.github/workflows/unittests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
- name: Install dependencies
6060
run: |
6161
python -m pip install --upgrade pip
62-
pip install pytest pytest-subtests pytest-xdist
62+
pip install -r ci-requirements.txt
6363
python ModuleUpdate.py --yes --force --append "WebHostLib/requirements.txt"
6464
python Launcher.py --update_settings # make sure host.yaml exists for tests
6565
- name: Unittests

BaseClasses.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,10 @@ def create_playthrough(self, create_paths: bool = True) -> None:
17211721
logging.debug('The following items could not be reached: %s', ['%s (Player %d) at %s (Player %d)' % (
17221722
location.item.name, location.item.player, location.name, location.player) for location in
17231723
sphere_candidates])
1724-
if any([multiworld.worlds[location.item.player].options.accessibility != 'minimal' for location in sphere_candidates]):
1725-
raise RuntimeError(f'Not all progression items reachable ({sphere_candidates}). '
1726-
f'Something went terribly wrong here.')
1724+
if not multiworld.has_beaten_game(state):
1725+
raise RuntimeError("During playthrough generation, the game was determined to be unbeatable. "
1726+
"Something went terribly wrong here. "
1727+
f"Unreachable progression items: {sphere_candidates}")
17271728
else:
17281729
self.unreachables = sphere_candidates
17291730
break

Generate.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ def main(args=None) -> tuple[argparse.Namespace, int]:
189189
yaml[category][key] = option
190190
elif category_name not in yaml:
191191
logging.warning(f"Meta: Category {category_name} is not present in {path}.")
192+
elif key == "triggers":
193+
if "triggers" not in yaml[category_name]:
194+
yaml[category_name][key] = []
195+
for trigger in option:
196+
yaml[category_name][key].append(trigger)
192197
else:
193198
yaml[category_name][key] = option
194199

@@ -362,7 +367,10 @@ def update_weights(weights: dict, new_weights: dict, update_type: str, name: str
362367
f" received {type(new_value).__name__}.")
363368
cleaned_weights[option_name] = cleaned_value
364369
else:
365-
cleaned_weights[option_name] = new_weights[option]
370+
# Options starting with + and - may modify values in-place, and new_weights may be shared by multiple slots
371+
# using the same .yaml, so ensure that the new value is a copy.
372+
cleaned_value = copy.deepcopy(new_weights[option])
373+
cleaned_weights[option_name] = cleaned_value
366374
new_options = set(cleaned_weights) - set(weights)
367375
weights.update(cleaned_weights)
368376
if new_options:
@@ -385,6 +393,8 @@ def roll_meta_option(option_key, game: str, category_dict: dict) -> Any:
385393
if options[option_key].supports_weighting:
386394
return get_choice(option_key, category_dict)
387395
return category_dict[option_key]
396+
if option_key == "triggers":
397+
return category_dict[option_key]
388398
raise Options.OptionError(f"Error generating meta option {option_key} for {game}.")
389399

390400

Launcher.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ def open_patch():
7575
launch([*exe, file], component.cli)
7676

7777

78-
def generate_yamls():
78+
def generate_yamls(*args):
7979
from Options import generate_yaml_templates
8080

81+
parser = argparse.ArgumentParser(description="Generate Template Options", usage="[-h] [--skip_open_folder]")
82+
parser.add_argument("--skip_open_folder", action="store_true")
83+
args = parser.parse_args(args)
84+
8185
target = Utils.user_path("Players", "Templates")
8286
generate_yaml_templates(target, False)
83-
open_folder(target)
87+
if not args.skip_open_folder:
88+
open_folder(target)
8489

8590

8691
def browse_files():

Main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def precollect_hint(location: Location, auto_status: HintStatus):
326326
if current_sphere:
327327
spheres.append(dict(current_sphere))
328328

329-
multidata: NetUtils.MultiData | bytes = {
329+
multidata: NetUtils.MultiData = {
330330
"slot_data": slot_data,
331331
"slot_info": slot_info,
332332
"connect_names": {name: (0, player) for player, name in multiworld.player_name.items()},
@@ -350,11 +350,11 @@ def precollect_hint(location: Location, auto_status: HintStatus):
350350
for key in ("slot_data", "er_hint_data"):
351351
multidata[key] = convert_to_base_types(multidata[key])
352352

353-
multidata = zlib.compress(restricted_dumps(multidata), 9)
353+
serialized_multidata = zlib.compress(restricted_dumps(multidata), 9)
354354

355355
with open(os.path.join(temp_dir, f'{outfilebase}.archipelago'), 'wb') as f:
356356
f.write(bytes([3])) # version of format
357-
f.write(multidata)
357+
f.write(serialized_multidata)
358358

359359
output_file_futures.append(pool.submit(write_multidata))
360360
if not check_accessibility_task.result():

Options.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,8 @@ class PlandoTexts(Option[typing.List[PlandoText]], VerifyKeys):
10181018
supports_weighting = False
10191019
display_name = "Plando Texts"
10201020

1021+
visibility = Visibility.template | Visibility.complex_ui | Visibility.spoiler
1022+
10211023
def __init__(self, value: typing.Iterable[PlandoText]) -> None:
10221024
self.value = list(deepcopy(value))
10231025
super().__init__()
@@ -1144,6 +1146,8 @@ class PlandoConnections(Option[typing.List[PlandoConnection]], metaclass=Connect
11441146
entrances: typing.ClassVar[typing.AbstractSet[str]]
11451147
exits: typing.ClassVar[typing.AbstractSet[str]]
11461148

1149+
visibility = Visibility.template | Visibility.complex_ui | Visibility.spoiler
1150+
11471151
duplicate_exits: bool = False
11481152
"""Whether or not exits should be allowed to be duplicate."""
11491153

@@ -1435,6 +1439,7 @@ class DeathLink(Toggle):
14351439
class ItemLinks(OptionList):
14361440
"""Share part of your item pool with other players."""
14371441
display_name = "Item Links"
1442+
visibility = Visibility.template | Visibility.complex_ui | Visibility.spoiler
14381443
rich_text_doc = True
14391444
default = []
14401445
schema = Schema([
@@ -1726,11 +1731,16 @@ def generate_yaml_templates(target_folder: typing.Union[str, "pathlib.Path"], ge
17261731

17271732
def dictify_range(option: Range):
17281733
data = {option.default: 50}
1729-
for sub_option in ["random", "random-low", "random-high"]:
1734+
for sub_option in ["random", "random-low", "random-high",
1735+
f"random-range-{option.range_start}-{option.range_end}"]:
17301736
if sub_option != option.default:
17311737
data[sub_option] = 0
1732-
1733-
notes = {}
1738+
notes = {
1739+
"random-low": "random value weighted towards lower values",
1740+
"random-high": "random value weighted towards higher values",
1741+
f"random-range-{option.range_start}-{option.range_end}": f"random value between "
1742+
f"{option.range_start} and {option.range_end}"
1743+
}
17341744
for name, number in getattr(option, "special_range_names", {}).items():
17351745
notes[name] = f"equivalent to {number}"
17361746
if number in data:

0 commit comments

Comments
 (0)