Options: set old options api before the world is created (#2378)

This commit is contained in:
Aaron Wagener
2023-12-16 15:21:05 -06:00
committed by GitHub
parent c56cbd0474
commit 7dff09dc1a
3 changed files with 33 additions and 5 deletions

View File

@@ -77,6 +77,10 @@ class AutoWorldRegister(type):
# 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
if __debug__:
from warnings import warn
warn("Assigning options through option_definitions is now deprecated. Use options_dataclass instead.")
dct["options_dataclass"] = make_dataclass(f"{name}Options", dct["option_definitions"].items(),
bases=(PerGameCommonOptions,))