WebHost: sample yamls now render Range defaults correctly

This commit is contained in:
Fabian Dill
2021-08-31 19:54:55 +02:00
parent a6a859b272
commit ff2e57705e
2 changed files with 22 additions and 9 deletions

View File

@@ -11,8 +11,18 @@ target_folder = os.path.join("WebHostLib", "static", "generated")
def create():
for game_name, world in AutoWorldRegister.world_types.items():
def dictify_range(option):
data = {option.range_start: 0, option.range_end: 0, "random": 0, "random-low": 0, "random-high": 0,
option.default: 50}
notes = {
option.range_start: "minimum value",
option.range_end: "maximum value"
}
return data, notes
res = Template(open(os.path.join("WebHostLib", "templates", "options.yaml")).read()).render(
options=world.options, __version__=__version__, game=game_name, yaml_dump=yaml.dump
options=world.options, __version__=__version__, game=game_name, yaml_dump=yaml.dump,
dictify_range=dictify_range
)
with open(os.path.join(target_folder, game_name + ".yaml"), "w") as f: