Merge pull request #2934 from Anewbe/char_reset

Ports Bay's character resets
This commit is contained in:
Anewbe
2017-01-27 20:44:54 -06:00
committed by GitHub
4 changed files with 94 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
#define SAVE_RESET -1
var/list/preferences_datums = list()
@@ -199,7 +199,8 @@ datum/preferences
dat += "Slot - "
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];reload=1'>Reload slot</a> - "
dat += "<a href='?src=\ref[src];resetslot=1'>Reset slot</a>"
else
dat += "Please create an account to save your preferences."
@@ -248,6 +249,11 @@ datum/preferences
load_character(text2num(href_list["changeslot"]))
sanitize_preferences()
close_load_dialog(usr)
else if(href_list["resetslot"])
if("No" == alert("This will reset the current slot. Continue?", "Reset current slot?", "No", "Yes"))
return 0
load_character(SAVE_RESET)
sanitize_preferences()
else
return 0

View File

@@ -67,11 +67,20 @@
if(!S) return 0
S.cd = "/"
if(!slot) slot = default_slot
slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot))
if(slot != default_slot)
default_slot = slot
S["default_slot"] << slot
S.cd = "/character[slot]"
if(slot != SAVE_RESET) // SAVE_RESET will reset the slot as though it does not exist, but keep the current slot for saving purposes.
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
if(slot != SAVE_RESET)
S.cd = "/character[slot]"
player_setup.load_character(S)
else
player_setup.load_character(S)
S.cd = "/character[default_slot]"
player_setup.load_character(S)
return 1