mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 04:01:32 -06:00
Core: Purge Multiworld.option_name (#5050)
This commit is contained in:
@@ -228,17 +228,8 @@ class MultiWorld():
|
||||
self.seed_name = name if name else str(self.seed)
|
||||
|
||||
def set_options(self, args: Namespace) -> None:
|
||||
# TODO - remove this section once all worlds use options dataclasses
|
||||
from worlds import AutoWorld
|
||||
|
||||
all_keys: Set[str] = {key for player in self.player_ids for key in
|
||||
AutoWorld.AutoWorldRegister.world_types[self.game[player]].options_dataclass.type_hints}
|
||||
for option_key in all_keys:
|
||||
option = Utils.DeprecateDict(f"Getting options from multiworld is now deprecated. "
|
||||
f"Please use `self.options.{option_key}` instead.", True)
|
||||
option.update(getattr(args, option_key, {}))
|
||||
setattr(self, option_key, option)
|
||||
|
||||
for player in self.player_ids:
|
||||
world_type = AutoWorld.AutoWorldRegister.world_types[self.game[player]]
|
||||
self.worlds[player] = world_type(self, player)
|
||||
|
2
Main.py
2
Main.py
@@ -176,7 +176,7 @@ def main(args, seed=None, baked_server_options: dict[str, object] | None = None)
|
||||
|
||||
multiworld.link_items()
|
||||
|
||||
if any(multiworld.item_links.values()):
|
||||
if any(world.options.item_links for world in multiworld.worlds.values()):
|
||||
multiworld._all_state = None
|
||||
|
||||
logger.info("Running Item Plando.")
|
||||
|
@@ -72,15 +72,6 @@ class AutoWorldRegister(type):
|
||||
dct["required_client_version"] = max(dct["required_client_version"],
|
||||
base.__dict__["required_client_version"])
|
||||
|
||||
# create missing options_dataclass from legacy option_definitions
|
||||
# TODO - remove this once all worlds use options dataclasses
|
||||
if "options_dataclass" not in dct and "option_definitions" in dct:
|
||||
# TODO - switch to deprecate after a version
|
||||
deprecate(f"{name} Assigned options through option_definitions which is now deprecated. "
|
||||
"Please use options_dataclass instead.")
|
||||
dct["options_dataclass"] = make_dataclass(f"{name}Options", dct["option_definitions"].items(),
|
||||
bases=(PerGameCommonOptions,))
|
||||
|
||||
# construct class
|
||||
new_class = super().__new__(mcs, name, bases, dct)
|
||||
new_class.__file__ = sys.modules[new_class.__module__].__file__
|
||||
@@ -493,9 +484,6 @@ class World(metaclass=AutoWorldRegister):
|
||||
Creates a group, which is an instance of World that is responsible for multiple others.
|
||||
An example case is ItemLinks creating these.
|
||||
"""
|
||||
# TODO remove loop when worlds use options dataclass
|
||||
for option_key, option in cls.options_dataclass.type_hints.items():
|
||||
getattr(multiworld, option_key)[new_player_id] = option.from_any(option.default)
|
||||
group = cls(multiworld, new_player_id)
|
||||
group.options = cls.options_dataclass(**{option_key: option.from_any(option.default)
|
||||
for option_key, option in cls.options_dataclass.type_hints.items()})
|
||||
|
@@ -209,8 +209,8 @@ def fill_dungeons_restrictive(multiworld: MultiWorld):
|
||||
if localized:
|
||||
in_dungeon_items = [item for item in get_dungeon_item_pool(multiworld) if (item.player, item.name) in localized]
|
||||
if in_dungeon_items:
|
||||
restricted_players = {player for player, restricted in multiworld.restrict_dungeon_item_on_boss.items() if
|
||||
restricted}
|
||||
restricted_players = {world.player for world in multiworld.get_game_worlds("A Link to the Past") if
|
||||
world.options.restrict_dungeon_item_on_boss}
|
||||
locations: typing.List["ALttPLocation"] = [
|
||||
location for location in get_unfilled_dungeon_locations(multiworld)
|
||||
# filter boss
|
||||
@@ -255,8 +255,9 @@ def fill_dungeons_restrictive(multiworld: MultiWorld):
|
||||
if all_state_base.has("Triforce", player):
|
||||
all_state_base.remove(multiworld.worlds[player].create_item("Triforce"))
|
||||
|
||||
for (player, key_drop_shuffle) in multiworld.key_drop_shuffle.items():
|
||||
if not key_drop_shuffle and player not in multiworld.groups:
|
||||
for lttp_world in multiworld.get_game_worlds("A Link to the Past"):
|
||||
if not lttp_world.options.key_drop_shuffle and lttp_world.player not in multiworld.groups:
|
||||
player = lttp_world.player
|
||||
for key_loc in key_drop_data:
|
||||
key_data = key_drop_data[key_loc]
|
||||
all_state_base.remove(item_factory(key_data[3], multiworld.worlds[player]))
|
||||
|
Reference in New Issue
Block a user