Skip to main content

ModSystemProjectSettings

See the code at utils/settings.gd

Description

Inherits Object

This class handles the custom ProjectSettings related to the Mod System addon.


Constants

Settings

const Settings := {
ModDirs = {
Path = "mod_system/mod_dirs",
Default = "user://mods",
Info = {
name = "mod_system/mod_dirs",
type = TYPE_STRING,
hint = PROPERTY_HINT_PLACEHOLDER_TEXT,
hint_string = "(e.g. user://mods, res://content)"
}
},
ModSettingsSavePath = {
Path = "mod_system/mod_settings_save_path",
Default = "user://mod_settings.tres",
Info = {
name = "mod_system/mod_settings_save_path",
type = TYPE_STRING,
hint = PROPERTY_HINT_SAVE_FILE,
}
},
}

A dictionary containing the settings related to the mod system addon. Follows this format:

{
[key: String]: {
"Path": String,
"Default": Variant,
"Info": {
"name": String, # same as Path
"type": Variant.Type,
"hint": @GlobalScope.PropertyHint, # optional
"hint_string": String, # optional
}
}
}

See ProjectSettings.add_property_info() for more information about the "Info" value.


Methods

update_project_settings

static func update_project_settings() -> void

Adds "mod_system/mod_dirs" and "mod_system/mod_settings_save_path" to ProjectSettings, if they are not already there.

Parameters

None

Returns

void


get_mod_dirs

static func get_mod_dirs() -> PackedStringArray

Retrieves all directories listed in "mod_system/mod_dirs" in ProjectSettings.

Parameters

None

Returns

TypePackedStringArray
DescriptionA list of directories.

set_mod_dirs

static func set_mod_dirs(dirs: PackedStringArray) -> void

Sets "mod_system/mod_dirs" in ProjectSettings to the provided value.

Parameters

NameTypeDescription
dirsPackedStringArrayThe directories to save in ProjectSettings

Returns

void


get_mod_settings_save_path

static func get_mod_settings_save_path() -> String

Retrieves "mod_system/mod_settings_save_path" from ProjectSettings.

Parameters

None

Returns

TypeString
DescriptionThe save path.

set_mod_settings_save_path

static func set_mod_settings_save_path(save_path: String) -> void

Sets "mod_system/mod_settings_save_path" in ProjectSettings to the provided value.

Parameters

NameTypeDescription
save_pathStringThe path to save in ProjectSettings

Returns

void