Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions addons/mod_loader/api/config.gd
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ static func delete_config(config: ModConfig) -> bool:
return true


# Duplicate an existing ModConfig
#
# Parameters:
# - config (ModConfig): The ModConfig object to be duplicated.
# - config_name (String): The name of the new configuration.
#
# Returns:
# - ModConfig: The duplicated ModConfig object if successful, or null otherwise.
static func duplicate_config(config: ModConfig, config_name: String) -> ModConfig:
return create_config(config.mod_id, config_name, config.data)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing the .data in directly might create issues since both dictionaries would be the same reference, so changing the original will change the dupe. I think .data.duplicate(true) is what we want



# Sets the current configuration of a mod to the specified configuration.
#
# Parameters:
Expand Down