Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schemas/Manual.categories.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"minItems": 1,
"uniqueItems": true
},
"yaml_description": {
"description": "(Optional) Dictionary of option-description pairs to add descriptor text to the yaml options defined in 'yaml_option'",
"type": "object"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

personally I would define the object using paternproperties but this should work as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I've never used schemas so I did the bare minimum here. Feel free to suggest whatever makes sense to change here.

How do patternproperties work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basicaly normaly with an object you can define its properties using properties but, when they are define by the user you can use a regex aka a pattern using patternProperties
you could look at items.schema.json for a pretty good example for your situation

"_comment": {"$ref": "#/definitions/comment"}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class FillerTrapPercent(Range):
if option_name not in manual_options:
manual_options[option_name] = type(option_name, (DefaultOnToggle,), {"default": True})
manual_options[option_name].__doc__ = "Should items/locations linked to this option be enabled?"
if option_name in category_table[category].get("yaml_description", []):
manual_options[option_name].__doc__ = category_table[category]["yaml_description"][option_name]

manual_options = after_options_defined(manual_options)
manual_options_data = make_dataclass('ManualOptionsClass', manual_options.items(), bases=(PerGameCommonOptions,))
3 changes: 2 additions & 1 deletion src/data/categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"hidden": true
},
"Example Yaml-option category": {
"yaml_option": ["DLC_enabled"]
"yaml_option": ["DLC_enabled"],
"yaml_description": {"DLC_enabled": "Include items and locations that require purchasing the DLC"}
}
}