Skip to content

About

A Sobosuba framework mod that exposes other mods' config files through the in-game settings menu

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

SoboModSettings

A Sobosuba framework that loads other mods' config files into the in-game settings menu.

Tested on Sobosuba v1.3.11

Installation:

Use Sobosuba Mod Manager, or do the following:

Extract modsettings.zip from the latest release into Sobosuba's userdata folder

  • Windows: %APPDATA%\Godot\app_userdata\sobosuba
  • Linux: ~/.local/share/godot/app_userdata/sobosuba

It should look like this:

├── styles
|   └── modsettings_bootstrap.tres
└── modsettings
    ├── modsettings.gd
    └── broadcaster.gd

For Developers:

Config files

To add settings for your mod, create a .cfg file in Sobosuba's userdata folder. The framework automatically scans the userdata folder and its immediate subdirectories for config files.

Each config file creates a separate page in the Mods menu.

A config file consists of a [meta] section and one section for each setting.

[meta]

name="Example Mod"
description="Configure Example Mod"

[example_bool]

type="bool"
label="example bool"
description="A simple toggle button"
value=false

[example_choice]

type="choice"
label="example choice"
description="Cycles through multiple choices"
options=["option 1", "option 2", "option 3"]
value=0

[example_float]

type="float"
label="example float"
description="A slider for a range of values"
min=0.0
max=100.0
step=1.0
value=50.0

[example_color]

type="color"
label="example color"
description="A tiny color selection ui"
value=Color(0.346704, 0, 1, 1)

[example_action]
type="action"
label="example action"
description="A button with no value. Broadcasts a signal"

Meta section

The [meta] section contains information about the mod itself.

Key Description Required
name Name displayed in the settings menu Yes
description Tooltip shown when hovering over the mod's button No

Setting sections

Every section other than [meta] represents a setting.

Key Description Required
type Setting type Yes
label Display name (defaults to the section name) No
description Tooltip shown when hovering over the setting No
value Initial setting value No

All other properties are optional. choice settings require a non-empty options array.

For choice settings, value is the zero-based index of the selected option

Saving settings

When a setting is changed, its new value is automatically written to the corresponding config file.

Your mod is responsible for reading the config values and applying them. The framework doesn't automatically change your mod's runtime behavior lol.

Config change notifications

To react to settings changes without periodically reloading your config, connect to the broadcaster's config_changed signal:

func _ready() -> void:
    var broadcaster = get_tree().root.get_meta("modsettings_broadcaster", null)
    if broadcaster:
        broadcaster.config_changed.connect(_on_config_changed)

func _on_config_changed(path: String, section: String, value: Variant) -> void:
    pass

The signal is emitted after a successful save.

  • path: Path to the config file.
  • section: Name of the setting's section.
  • value: The new value.

Make sure to check path as well as section, since another mod could use the same section name.

Actions

action settings are buttons with no value. Nothing is saved to the config file when one is pressed. Instead, the broadcaster emits an action_triggered signal so your mod can do something

func _ready() -> void:
    var broadcaster = get_tree().root.get_meta("modsettings_broadcaster", null)
    if broadcaster:
        broadcaster.action_triggered.connect(_on_action_triggered)

func _on_action_triggered(path: String, section: String) -> void:
    pass

The signal is emitted as soon as the button is released.

  • path: Path to the config file.
  • section: Name of the action's section.

Make sure to check path as well as section, since another mod could use the same section name.

About

A Sobosuba framework mod that exposes other mods' config files through the in-game settings menu

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages