-
Notifications
You must be signed in to change notification settings - Fork 30
ModLoaderConfig
Extends: Object
This Class provides functionality for working with per-mod Configurations.
const DEFAULT_CONFIG_NAME: String = "default"
const LOG_NAME: String = "ModLoader:Config"
func create_config(mod_id: String, config_name: String, config_data: Dictionary) -> ModConfig
Creates a new configuration for a mod.
Parameters:
- mod_id (String): The ID of the mod for which the configuration is being created.
- config_name (String): The name of the configuration.
- config_data (Dictionary): The configuration data to be stored in the new configuration.
Returns:
- ModConfig: The created ModConfig object if successful, or null otherwise.
func update_config(config: ModConfig) -> ModConfig
Updates an existing ModConfig object with new data and save the config file.
Parameters:
- config (ModConfig): The ModConfig object to be updated.
Returns:
- ModConfig: The updated ModConfig object if successful, or null otherwise.
func delete_config(config: ModConfig) -> bool
Deletes a ModConfig object and performs cleanup operations.
Parameters:
- config (ModConfig): The ModConfig object to be deleted.
Returns:
- bool: True if the deletion was successful, False otherwise.
func set_current_config(config: ModConfig) -> void
Sets the current configuration of a mod to the specified configuration.
Parameters:
- config (ModConfig): The ModConfig object to be set as current config.
func get_config_schema(mod_id: String) -> Dictionary
Returns the schema for the specified mod id. If no configuration file exists for the mod, an empty dictionary is returned.
Parameters:
- mod_id (String): the ID of the mod to get the configuration schema for
Returns:
- A dictionary representing the schema for the mod's configuration file
func get_schema_for_prop(config: ModConfig, prop: String) -> Dictionary
Retrieves the schema for a specific property key.
Parameters:
- config (ModConfig): The ModConfig object from which to retrieve the schema.
- prop (String): The property key for which to retrieve the schema.
e.g.
parentProp.childProp.nthChildProp
||propKey
Returns:
- Dictionary: The schema dictionary for the specified property.
func get_mods_with_config() -> Array
Retrieves an Array of mods that have configuration files.
Returns: An Array containing the mod data of mods that have configuration files.
func get_configs(mod_id: String) -> Dictionary
Retrieves the configurations dictionary for a given mod ID.
Parameters:
- mod_id: The ID of the mod for which to retrieve the configurations.
Returns: A dictionary containing the configurations for the specified mod. If the mod ID is invalid or no configurations are found, an empty dictionary is returned.
func get_config(mod_id: String, config_name: String) -> ModConfig
Retrieves the configuration for a specific mod and configuration name. Returns the configuration as a ModConfig object or null if not found.
Parameters:
- mod_id (String): The ID of the mod to retrieve the configuration for.
- config_name (String): The name of the configuration to retrieve.
Returns: The configuration as a ModConfig object or null if not found.
func get_default_config(mod_id: String) -> ModConfig
Retrieves the default configuration for a specified mod ID.
Parameters:
- mod_id: The ID of the mod for which to retrieve the default configuration.
Returns: The ModConfig object representing the default configuration for the specified mod. If the mod ID is invalid or no configuration is found, returns null.
func get_current_config(mod_id: String) -> ModConfig
Retrieves the currently active configuration for a specific mod
Parameters: mod_id (String): The ID of the mod to retrieve the configuration for.
Returns: The configuration as a ModConfig object or null if not found.
func get_current_config_name(mod_id: String) -> String
Retrieves the name of the current configuration for a specific mod Returns an empty string if no configuration exists for the mod or the user profile has not been loaded
Parameters: mod_id (String): The ID of the mod to retrieve the current configuration name for.
Returns: The currently active configuration name for the given mod id or an empty string if not found.
Home ~ Setup ~ Mod Structure ~ Mod Files ~ API Methods ~ Logging