Options: raise Exception if per-game options are in root

Options: implement progression balancing and accessibility on new system
Options: implement the notion of "common" and "per_game_common" options in various systems
Options: centralize item and location name checking
Spoiler: prettier print some lists, sets and dicts
WebHost: add common options into /templates
This commit is contained in:
Fabian Dill
2021-09-17 00:17:54 +02:00
parent abc0220cfa
commit a82bf1bb32
21 changed files with 219 additions and 137 deletions

View File

@@ -5,6 +5,7 @@ import yaml
import json
from worlds.AutoWorld import AutoWorldRegister
import Options
target_folder = os.path.join("WebHostLib", "static", "generated")
@@ -18,10 +19,17 @@ def create():
option.range_end: "maximum value"
}
return data, notes
def default_converter(default_value):
if isinstance(default_value, (set, frozenset)):
return list(default_value)
return default_value
for game_name, world in AutoWorldRegister.world_types.items():
res = Template(open(os.path.join("WebHostLib", "templates", "options.yaml")).read()).render(
options=world.options, __version__=__version__, game=game_name, yaml_dump=yaml.dump,
dictify_range=dictify_range
options={**world.options, **Options.per_game_common_options},
__version__=__version__, game=game_name, yaml_dump=yaml.dump,
dictify_range=dictify_range, default_converter=default_converter,
)
with open(os.path.join(target_folder, game_name + ".yaml"), "w") as f: