diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index d0aefa286f..c26e6f1c0e 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -214,7 +214,9 @@ datum/preferences
dat += "Load slot - "
dat += "Save slot - "
dat += "Reload slot - "
- dat += "Reset slot"
+ dat += "Reset slot - "
+ //CHOMPStation Edit - TFF 20/9/19 - Port Polaris slot Copying for Char Setup
+ dat += "Copy slot"
else
dat += "Please create an account to save your preferences."
@@ -270,6 +272,15 @@ datum/preferences
return 0
load_character(SAVE_RESET)
sanitize_preferences()
+ //CHOMPStation Edit - TFF 20/9/19 - Port Polaris slot Copying for Char Setup
+ else if(href_list["copy"])
+ if(!IsGuestKey(usr.key))
+ open_copy_dialog(usr)
+ return 1
+ else if(href_list["overwrite"])
+ overwrite_character(text2num(href_list["overwrite"]))
+ sanitize_preferences()
+ close_load_dialog(usr)
else
return 0
@@ -325,3 +336,27 @@ datum/preferences
/datum/preferences/proc/close_load_dialog(mob/user)
//user << browse(null, "window=saves")
panel.close()
+
+//CHOMPStation Edit - TFF 20/9/19 - Port Polaris slot Copying for Char Setup
+/datum/preferences/proc/open_copy_dialog(mob/user)
+ var/dat = "
"
+ dat += ""
+
+ var/savefile/S = new /savefile(path)
+ if(S)
+ dat += "Select a character slot to overwrite
"
+ dat += "You will then need to save to confirm
"
+ var/name
+ for(var/i=1, i<= config.character_slots, i++)
+ S.cd = "/character[i]"
+ S["real_name"] >> name
+ if(!name) name = "Character[i]"
+ if(i==default_slot)
+ name = "[name]"
+ dat += "[name]
"
+
+ dat += "
"
+ dat += ""
+ panel = new(user, "Character Slots", "Character Slots", 300, 390, src)
+ panel.set_content(dat)
+ panel.open()
\ No newline at end of file
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index 22eab43de5..de620c382b 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -93,6 +93,22 @@
player_setup.save_character(S)
return 1
+//CHOMPStation Edit - TFF 20/9/19 - Port Polaris slot Copying for Char Setup
+/datum/preferences/proc/overwrite_character(slot)
+ if(!path) return 0
+ if(!fexists(path)) return 0
+ var/savefile/S = new /savefile(path)
+ if(!S) return 0
+ if(!slot) slot = default_slot
+ if(slot != SAVE_RESET)
+ slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot))
+ if(slot != default_slot)
+ default_slot = slot
+ S["default_slot"] << slot
+ else
+ S["default_slot"] << default_slot
+
+ return 1
/datum/preferences/proc/sanitize_preferences()
player_setup.sanitize_setup()