Options: make common options overridable in a game section

WebHost: add prog balancing and accessibility to settings page
This commit is contained in:
Fabian Dill
2021-12-28 18:43:52 +01:00
parent 2e56c226db
commit 6e4b255be5
5 changed files with 9 additions and 15 deletions

View File

@@ -11,6 +11,8 @@ target_folder = os.path.join("WebHostLib", "static", "generated")
def create():
os.makedirs(os.path.join(target_folder, 'configs'), exist_ok=True)
def dictify_range(option):
data = {option.range_start: 0, option.range_end: 0, "random": 0, "random-low": 0, "random-high": 0,
option.default: 50}
@@ -26,14 +28,13 @@ def create():
return default_value
for game_name, world in AutoWorldRegister.world_types.items():
all_options = {**world.options, **Options.per_game_common_options}
res = Template(open(os.path.join("WebHostLib", "templates", "options.yaml")).read()).render(
options={**world.options, **Options.per_game_common_options},
options=all_options,
__version__=__version__, game=game_name, yaml_dump=yaml.dump,
dictify_range=dictify_range, default_converter=default_converter,
)
os.makedirs(os.path.join(target_folder, 'configs'), exist_ok=True)
with open(os.path.join(target_folder, 'configs', game_name + ".yaml"), "w") as f:
f.write(res)
@@ -47,7 +48,7 @@ def create():
}
game_options = {}
for option_name, option in world.options.items():
for option_name, option in all_options.items():
if option.options:
game_options[option_name] = this_option = {
"type": "select",

View File

@@ -29,13 +29,6 @@ game:
requires:
version: {{ __version__ }} # Version of Archipelago required for this yaml to work as expected.
# Shared Options supported by all games:
accessibility:
items: 0 # Guarantees you will be able to acquire all items, but you may not be able to access all locations
locations: 50 # Guarantees you will be able to access all locations, and therefore all items
none: 0 # Guarantees only that the game is beatable. You may not be able to access all locations or acquire all items
progression_balancing:
on: 50 # A system to reduce BK, as in times during which you can't do anything by moving your items into an earlier access sphere to make it likely you have stuff to do
off: 0 # Turn this off if you don't mind a longer multiworld, or can glitch/sequence break around missing items.
{%- macro range_option(option) %}
# you can add additional values between minimum and maximum