@@ -12,6 +12,8 @@ const FILE_PATH_USER_PROFILES := "user://mod_user_profiles.json"
12
12
# API profile functions
13
13
# =============================================================================
14
14
15
+ export var name := ""
16
+ export var mod_list := {}
15
17
16
18
# Enables a mod - it will be loaded on the next game start
17
19
#
@@ -94,6 +96,7 @@ static func create_profile(profile_name: String) -> bool:
94
96
95
97
return is_save_success
96
98
99
+
97
100
# Renames an existing user profile.
98
101
#
99
102
# Parameters:
@@ -113,16 +116,16 @@ static func rename_profile(old_profile_name: String, new_profile_name: String) -
113
116
return false
114
117
115
118
# 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
118
121
119
122
# Remove old profile entry, replace it with new name entry in the ModLoaderStore
120
123
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
122
125
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 )
126
129
127
130
# Store the new profile in the json file
128
131
var is_save_success := _save ()
0 commit comments