-
Notifications
You must be signed in to change notification settings - Fork 0
Native Game Settings
runtime:register_game_bool_setting(options) adds a localized native ON/OFF row
under Settings -> Game -> Mods. PleasureLib uses the game's own settings row
and boolean widget so mouse, keyboard, controller focus, and the details panel
behave like vanilla settings.
local show_extra_info = false
local handle = pleasureLib:register_game_bool_setting({
id = "MyMod.ShowExtraInfo",
get = function()
return show_extra_info
end,
set = function(value)
show_extra_info = value == true
return true
end,
})| Option | Description |
|---|---|
id |
Globally unique, stable identifier. Prefix it with the mod name. |
get() |
Returns the current boolean value. |
set(value) |
Applies a boolean value. Return false to reject the change. |
Invalid registrations return nil and write a readable log message.
| Option | Description |
|---|---|
default |
Fallback when get() does not return a boolean. |
persist.path |
INI path or callback returning the path. |
persist.key |
INI key or callback returning the key. |
translations |
Display names and descriptions keyed by language code. |
local handle = pleasureLib:register_game_bool_setting({
id = "MyMod.ShowExtraInfo",
default = false,
get = function()
return config.ShowExtraInfo == true
end,
set = function(value)
config.ShowExtraInfo = value == true
return true
end,
persist = {
path = function() return config_path end,
key = "ShowExtraInfo",
},
translations = {
en = {
name = "Show extra information",
description = "Shows more information in the inventory.",
},
de = {
name = "Zusatzliche Informationen anzeigen",
description = "Zeigt mehr Informationen im Inventar an.",
},
},
})Translation lookup tries the complete current language code, then its base
language, and finally en. You can supply Gothic 1 Remake language codes such
as de, fr, it, es, pl, ru, zh-hans, ja, and pt-br.
When the native toggle reports a change, PleasureLib updates the configured INI value. It also commits the current native value when the settings page applies or discards pending values.
The returned handle contains:
-
id: the registered setting identifier -
refresh(): synchronizes visible native widgets with the current value fromget()
Call refresh() when the mod changes the setting outside the settings menu:
config.ShowExtraInfo = false
if handle then handle.refresh() endRegistration is safe before the game's settings assets are loaded. PleasureLib waits for the Game settings page and injects registered rows when it becomes available. It tracks settings pages and prevents duplicate rows when the page is opened or reinitialized again.
Use one stable id per logical setting. Registering the same id again updates
the entry used by PleasureLib instead of intentionally creating a second row.
The public settings API currently supports boolean ON/OFF rows. Numeric, enumeration, keybinding, and custom widget settings are not part of the public API.