Skip to content

Commit fa32e59

Browse files
committed
Updated some failed changes
1 parent 0b5ee21 commit fa32e59

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

addons/mod_loader/api/profile.gd

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const FILE_PATH_USER_PROFILES := "user://mod_user_profiles.json"
1212
# API profile functions
1313
# =============================================================================
1414

15+
export var name := ""
16+
export var mod_list := {}
1517

1618
# Enables a mod - it will be loaded on the next game start
1719
#
@@ -94,6 +96,7 @@ static func create_profile(profile_name: String) -> bool:
9496

9597
return is_save_success
9698

99+
97100
# Renames an existing user profile.
98101
#
99102
# Parameters:
@@ -113,16 +116,16 @@ static func rename_profile(old_profile_name: String, new_profile_name: String) -
113116
return false
114117

115118
# Rename user profile
116-
var profile_to_rename = ModLoaderStore.user_profiles[old_profile_name].duplicate(true)
117-
profile_to_rename.name = new_profile_name
119+
var profile_renamed := ModLoaderStore.user_profiles[old_profile_name].duplicate() as ModUserProfile
120+
profile_renamed.name = new_profile_name
118121

119122
# Remove old profile entry, replace it with new name entry in the ModLoaderStore
120123
ModLoaderStore.user_profiles.erase(old_profile_name)
121-
ModLoaderStore.user_profiles[new_profile_name] = profile_to_rename
124+
ModLoaderStore.user_profiles[profile_renamed] = profile_renamed
122125

123-
# Set it as the current profile
124-
if ModLoaderStore.current_user_profile == ModLoaderStore.user_profiles[old_profile_name]:
125-
ModLoaderStore.current_user_profile[new_profile_name]
126+
# Set it as the current profile if it was the current profile
127+
if ModLoaderStore.current_user_profile.name == old_profile_name:
128+
set_profile(profile_renamed)
126129

127130
# Store the new profile in the json file
128131
var is_save_success := _save()

0 commit comments

Comments
 (0)