mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-24 20:46:29 +01:00
Slots Copying Palooza
Ports https://github.com/PolarisSS13/Polaris/pull/5988 so you can copy your character slot info over to another one if you have the space.
This commit is contained in:
@@ -214,7 +214,9 @@ datum/preferences
|
||||
dat += "<a href='?src=\ref[src];load=1'>Load slot</a> - "
|
||||
dat += "<a href='?src=\ref[src];save=1'>Save slot</a> - "
|
||||
dat += "<a href='?src=\ref[src];reload=1'>Reload slot</a> - "
|
||||
dat += "<a href='?src=\ref[src];resetslot=1'>Reset slot</a>"
|
||||
dat += "<a href='?src=\ref[src];resetslot=1'>Reset slot</a> - "
|
||||
//CHOMPStation Edit - TFF 20/9/19 - Port Polaris slot Copying for Char Setup
|
||||
dat += "<a href='?src=\ref[src];copy=1'>Copy slot</a>"
|
||||
|
||||
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 = "<body>"
|
||||
dat += "<tt><center>"
|
||||
|
||||
var/savefile/S = new /savefile(path)
|
||||
if(S)
|
||||
dat += "<b>Select a character slot to overwrite</b><br>"
|
||||
dat += "<b>You will then need to save to confirm</b><hr>"
|
||||
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 = "<b>[name]</b>"
|
||||
dat += "<a href='?src=\ref[src];overwrite=[i]'>[name]</a><br>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "</center></tt>"
|
||||
panel = new(user, "Character Slots", "Character Slots", 300, 390, src)
|
||||
panel.set_content(dat)
|
||||
panel.open()
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user