mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core, all worlds: Hard-deprecate old options API (by August 10th 2024) (#3284)
* Core: deprecate old options API * also deprecate assigning options via option_definitions --------- Co-authored-by: alwaysintreble <mmmcheese158@gmail.com>
This commit is contained in:
@@ -223,7 +223,7 @@ class MultiWorld():
|
|||||||
AutoWorld.AutoWorldRegister.world_types[self.game[player]].options_dataclass.type_hints}
|
AutoWorld.AutoWorldRegister.world_types[self.game[player]].options_dataclass.type_hints}
|
||||||
for option_key in all_keys:
|
for option_key in all_keys:
|
||||||
option = Utils.DeprecateDict(f"Getting options from multiworld is now deprecated. "
|
option = Utils.DeprecateDict(f"Getting options from multiworld is now deprecated. "
|
||||||
f"Please use `self.options.{option_key}` instead.")
|
f"Please use `self.options.{option_key}` instead.", True)
|
||||||
option.update(getattr(args, option_key, {}))
|
option.update(getattr(args, option_key, {}))
|
||||||
setattr(self, option_key, option)
|
setattr(self, option_key, option)
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ from typing import (Any, Callable, ClassVar, Dict, FrozenSet, Iterable, List, Ma
|
|||||||
|
|
||||||
from Options import item_and_loc_options, ItemsAccessibility, OptionGroup, PerGameCommonOptions
|
from Options import item_and_loc_options, ItemsAccessibility, OptionGroup, PerGameCommonOptions
|
||||||
from BaseClasses import CollectionState
|
from BaseClasses import CollectionState
|
||||||
|
from Utils import deprecate
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance
|
from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance
|
||||||
@@ -75,9 +76,8 @@ class AutoWorldRegister(type):
|
|||||||
# TODO - remove this once all worlds use options dataclasses
|
# TODO - remove this once all worlds use options dataclasses
|
||||||
if "options_dataclass" not in dct and "option_definitions" in dct:
|
if "options_dataclass" not in dct and "option_definitions" in dct:
|
||||||
# TODO - switch to deprecate after a version
|
# TODO - switch to deprecate after a version
|
||||||
if __debug__:
|
deprecate(f"{name} Assigned options through option_definitions which is now deprecated. "
|
||||||
logging.warning(f"{name} Assigned options through option_definitions which is now deprecated. "
|
"Please use options_dataclass instead.")
|
||||||
"Please use options_dataclass instead.")
|
|
||||||
dct["options_dataclass"] = make_dataclass(f"{name}Options", dct["option_definitions"].items(),
|
dct["options_dataclass"] = make_dataclass(f"{name}Options", dct["option_definitions"].items(),
|
||||||
bases=(PerGameCommonOptions,))
|
bases=(PerGameCommonOptions,))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user