Get the key of this setting
Class SettingV3
#include <Geode/loader/SettingV3.hpp>Examples0
Public static methods0
Public member functions16
std::stringgetKey()const
std::stringgetModID()const
Get the mod ID this setting is for
geode::Mod*getMod()const
Get the mod this setting is for. Note that this may return null while the mod is still being initialized
std::optional<std::string>getName()const
Get the name of this setting
std::stringgetDisplayName()const
Get the name of this setting, or its key if it has no name
std::optional<std::string>getDescription()const
Get the description of this setting
std::optional<std::string>getEnableIf()const
Get the “enable-if” scheme for this setting
boolshouldEnable()const
Check if this setting should be enabled based on the “enable-if” scheme
std::optional<std::string>getEnableIfDescription()const
boolrequiresRestart()const
Whether this setting requires a restart on change
std::vector<geode::PlatformID>getPlatforms()const
Get the platforms this setting is available on
virtualboolload()=0
virtualboolsave(matjson::Value&json)const=0
virtualgeode::SettingNodeV3*createNode(floatwidth)=0
virtualboolisDefaultValue()const=0
virtualvoidreset()=0
Reset this setting’s value back to its original value
Fields0
Protected member functions8
voidinit(,std::stringconst&modID,)
Only call this function if you aren’t going to call parseBaseProperties, which will call it for you! If you don’t want to call parseBaseProperties, at the very least you must call this! Select which properties you want to parse using the parseX functions
key
modID
json
voidinit(,std::stringconst&modID)
Only call this function if you aren’t going to call parseBaseProperties, which will call it for you! If you don’t want to call parseBaseProperties, at the very least you must call this! Select which properties you want to parse using the parseX functions
key
modID
ℹ If you are using Geode's JSON checking utilities (`checkJson` / `JsonExpectedValue`), you should be using the other overload that takes a `JsonExpectedValue&`!
voidparseNameAndDescription()
Parses the "name" and "description" keys from the setting’s definition in mod.json (if they exist), so their values can be accessed via getName and getDescription.
json
⚠️ In most cases, you should be using `parseBaseProperties` instead to do all of this in one go! If you do need the fine-grained control however, make sure to call `init` before calling these parsing functions!
voidparseEnableIf()
Parses the "enable-if" and "enable-if-description" keys from the setting’s definition in mod.json (if they exist), so shouldEnable and getEnableIfDescription work.
json
⚠️ In most cases, you should be using `parseBaseProperties` instead to do all of this in one go! If you do need the fine-grained control however, make sure to call `init` before calling these parsing functions!
voidparseValueProperties()
Parses the "requires-restart" key from the setting’s definition in mod.json (if they exist), so requiresRestart works.
json
⚠️ In most cases, you should be using `parseBaseProperties` instead to do all of this in one go! If you do need the fine-grained control however, make sure to call `init` before calling these parsing functions!
voidparseBaseProperties(,std::stringconst&modID,)
Parse all of the base properties such as "name" and "description" for this setting
key
modID
json
ℹ If you don't want to parse some of the base properties, such as `"requires-restart"` (because you're doing a cosmetic setting), then you can call `init` instead and then the specific `parseX` functions
geode::Result<>parseBaseProperties(,std::stringconst&modID,)
Parse all of the base properties such as "name" and "description" for this setting
key
modID
json
ℹ If you don't want to parse some of the base properties, such as `"requires-restart"` (because you're doing a cosmetic setting), then you can call `init` instead and then the specific `parseX` functions
voidmarkChanged()
Mark that the value of this setting has changed. This should be ALWAYS called on every setter that can modify the setting’s state!