EverestAPI / EverestAPI/Everest
Allow mods to (more easily) create their own `[SettingXYZ]` attributes for use with mod settings
- Dominant language
- C#
- Stars
- 516
- Forks
- 106
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 5
Description
### I am planning on implementing this myself
No
### Describe your request
Creating lots of similar `CreateXYZEntry` methods for mod settings (to facilitate eg. custom input types) sucks, and modifying the settings' `TextMenu` after Everest has already created it also sucks. I propose there should be a way for mods to create their own `[SettingsXYZ]`-like attributes to avoid repetition in cases like these, for example:
```cs
[SettingInGame(false)]
[SettingFactory(CreateColorSetting, 1f, 1f, 1f)]
public Color MyColorSetting {get; set;} = Color.Red;
public TextMenu.Item CreateColorSetting(PropertyInfo propertyInfo, object?[] parameters)
{
if (propertyInfo.PropertyType is not typeof(Color)) return;
float rRange = (parameters[0] as float) ?? 0f, gRange = (parameters[1] as float) ?? 0f, bRange = (parameters[2] as float) ?? 0f;
// ...
}
```
(this is very tentative - I have no clue how this API should be best designed; the signature of the factory method should probably be closer to that of the `CreateXYZEntry` methods I think)
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.