WebHost: Allow "random" to be default option for toggles and choices. (#640)
This commit is contained in:
parent
c8c025ac34
commit
1bcc5b6582
|
@ -89,12 +89,16 @@ def create():
|
|||
"value": "random",
|
||||
})
|
||||
|
||||
if option.default == "random":
|
||||
this_option["defaultValue"] = "random"
|
||||
|
||||
elif hasattr(option, "range_start") and hasattr(option, "range_end"):
|
||||
game_options[option_name] = {
|
||||
"type": "range",
|
||||
"displayName": option.display_name if hasattr(option, "display_name") else option_name,
|
||||
"description": option.__doc__ if option.__doc__ else "Please document me!",
|
||||
"defaultValue": option.default if hasattr(option, "default") else option.range_start,
|
||||
"defaultValue": option.default if hasattr(
|
||||
option, "default") and option.default != "random" else option.range_start,
|
||||
"min": option.range_start,
|
||||
"max": option.range_end,
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ requires:
|
|||
{%- for suboption_option_id, sub_option_name in option.name_lookup.items() %}
|
||||
{{ sub_option_name }}: {% if suboption_option_id == option.default %}50{% else %}0{% endif %}
|
||||
{%- endfor -%}
|
||||
{% if option.default == "random" %}
|
||||
random: 50
|
||||
{%- endif -%}
|
||||
{%- else %}
|
||||
{{ yaml_dump(default_converter(option.default)) | indent(4, first=False) }}
|
||||
{%- endif -%}
|
||||
|
|
|
@ -12,7 +12,7 @@ class StartingGender(Choice):
|
|||
option_lady = 1
|
||||
alias_male = 0
|
||||
alias_female = 1
|
||||
default = 0
|
||||
default = "random"
|
||||
|
||||
|
||||
class StartingClass(Choice):
|
||||
|
|
Loading…
Reference in New Issue