From ee471a48bd443b3663100efa6044dce88bfc3679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bolduc?= <16137441+Jouramie@users.noreply.github.com> Date: Thu, 10 Apr 2025 14:34:21 -0400 Subject: [PATCH] Stardew Valley: Fix some determinism issues with entrance rando when playing with mods (#4812) --- worlds/stardew_valley/content/__init__.py | 2 +- worlds/stardew_valley/region_classes.py | 2 +- worlds/stardew_valley/regions.py | 5 ++--- .../stardew_valley/test/stability/StabilityOutputScript.py | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/worlds/stardew_valley/content/__init__.py b/worlds/stardew_valley/content/__init__.py index 33608531..5f7d4a5f 100644 --- a/worlds/stardew_valley/content/__init__.py +++ b/worlds/stardew_valley/content/__init__.py @@ -21,7 +21,7 @@ def choose_content_packs(player_options: options.StardewValleyOptions): if player_options.special_order_locations & options.SpecialOrderLocations.value_qi: active_packs.append(content_packs.qi_board_content_pack) - for mod in player_options.mods.value: + for mod in sorted(player_options.mods.value): active_packs.append(content_packs.by_mod[mod]) return active_packs diff --git a/worlds/stardew_valley/region_classes.py b/worlds/stardew_valley/region_classes.py index bd64518e..d3d16e38 100644 --- a/worlds/stardew_valley/region_classes.py +++ b/worlds/stardew_valley/region_classes.py @@ -34,7 +34,7 @@ class RegionData: merged_exits.extend(self.exits) if exits is not None: merged_exits.extend(exits) - merged_exits = list(set(merged_exits)) + merged_exits = sorted(set(merged_exits)) return RegionData(self.name, merged_exits, is_ginger_island=self.is_ginger_island) def get_without_exits(self, exits_to_remove: Set[str]): diff --git a/worlds/stardew_valley/regions.py b/worlds/stardew_valley/regions.py index 7a680d5f..d5be53ba 100644 --- a/worlds/stardew_valley/regions.py +++ b/worlds/stardew_valley/regions.py @@ -521,7 +521,7 @@ def create_final_regions(world_options) -> List[RegionData]: final_regions.extend(vanilla_regions) if world_options.mods is None: return final_regions - for mod in world_options.mods.value: + for mod in sorted(world_options.mods.value): if mod not in ModDataList: continue for mod_region in ModDataList[mod].regions: @@ -747,8 +747,7 @@ def swap_one_random_connection(regions_by_name, connections_by_name, randomized_ randomized_connections_already_shuffled = {connection: randomized_connections[connection] for connection in randomized_connections if connection != randomized_connections[connection]} - unreachable_regions_names_leading_somewhere = tuple([region for region in unreachable_regions - if len(regions_by_name[region].exits) > 0]) + unreachable_regions_names_leading_somewhere = [region for region in sorted(unreachable_regions) if len(regions_by_name[region].exits) > 0] unreachable_regions_leading_somewhere = [regions_by_name[region_name] for region_name in unreachable_regions_names_leading_somewhere] unreachable_regions_exits_names = [exit_name for region in unreachable_regions_leading_somewhere for exit_name in region.exits] unreachable_connections = [connections_by_name[exit_name] for exit_name in unreachable_regions_exits_names] diff --git a/worlds/stardew_valley/test/stability/StabilityOutputScript.py b/worlds/stardew_valley/test/stability/StabilityOutputScript.py index a5385362..9b4b608d 100644 --- a/worlds/stardew_valley/test/stability/StabilityOutputScript.py +++ b/worlds/stardew_valley/test/stability/StabilityOutputScript.py @@ -2,7 +2,7 @@ import argparse import json from .. import setup_solo_multiworld -from ..options.presets import allsanity_mods_6_x_x +from ..options.presets import allsanity_mods_6_x_x_exclude_disabled from ...options import FarmType, EntranceRandomization if __name__ == "__main__": @@ -12,7 +12,7 @@ if __name__ == "__main__": args = parser.parse_args() seed = args.seed - options = allsanity_mods_6_x_x() + options = allsanity_mods_6_x_x_exclude_disabled() options[FarmType.internal_name] = FarmType.option_standard options[EntranceRandomization.internal_name] = EntranceRandomization.option_buildings multi_world = setup_solo_multiworld(options, seed=seed)