Add Field annotations
parent
11b778c1ce
commit
c8498adbd4
1 changed files with 54 additions and 0 deletions
54
Field-annotations.md
Normal file
54
Field-annotations.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# @Config(name)
|
||||
|
||||
This specifies that a field should be saved to config and appear in the GUI.
|
||||
|
||||
# @Description(desc)
|
||||
|
||||
Requires:
|
||||
- @Config
|
||||
|
||||
Shows a description for the config option when it is hovered.
|
||||
|
||||
# @Range("start..end")
|
||||
|
||||
Requires:
|
||||
- Type is int or float
|
||||
- @Config
|
||||
|
||||
For sliders, a range is required. The start and end are both inclusive. This annotation is REQUIRED when a field is annotated @Config and has a number type.
|
||||
|
||||
# @KeyBound(name?)
|
||||
|
||||
Requires:
|
||||
- Type is boolean
|
||||
- @Config
|
||||
|
||||
Allows the user to set a key to toggle this boolean. If a name is specified, this is the name of the keybind. Otherwise, the one from a @Config on the same field is used.
|
||||
|
||||
# @Marker(n)
|
||||
|
||||
Gives a field a numeric identifier for easy reflective access or other annotations.
|
||||
|
||||
# @Gate(n)
|
||||
|
||||
Requires:
|
||||
- Marked field n's Type is boolean
|
||||
- @Config
|
||||
|
||||
Only shows an option if the specified marked field is true.
|
||||
|
||||
# @MultiGate(overrideOr?, and?, or?)
|
||||
|
||||
Requires:
|
||||
- Specified marked fields are all booleans
|
||||
- @Config
|
||||
|
||||
All arguments are arrays of numeric identifiers for marked fields.
|
||||
|
||||
Shows an option if any of the following is true:
|
||||
- Any value in `overrideOr` is true
|
||||
- No value in `and` is false and `or` is empty
|
||||
- No value in `and` is false and any value in `or` is true
|
||||
|
||||
Which can be written like:
|
||||
`show = any(overrideOr) || (all(and) && (or.isEmpty() || any(or)))`
|
Loading…
Add table
Reference in a new issue