mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Save Slots! People can now have separate save slots for different character setups, with a customizable maximum of 3 slots per account.
Since the preference files are now numbered and named differently I made it detect old saves, when a player loads a save file, so it can rename it. Basically, everything should be saved still. Character Setup UI change. I changed the layout of the character screen to not require scrolling. Screenshot 1: http://i.imgur.com/xPAzn.png Screenshot 2: http://i.imgur.com/iBKJ6.png I've made the limit variable in the All-In-One grinder actually do something. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4058 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -745,10 +745,10 @@
|
||||
O.contents -= G
|
||||
G.loc = src
|
||||
holdingitems += G
|
||||
if((holdingitems && holdingitems.len >= 10) || beaker.reagents.total_volume >= 80) //Sanity checking so the blender doesn't overfill
|
||||
if((holdingitems && holdingitems.len >= limit) || beaker.reagents.total_volume >= 80) //Sanity checking so the blender doesn't overfill
|
||||
user << "You fill the All-In-One grinder to the brim."
|
||||
break
|
||||
if(src.contents.len < 10 && src.reagents.total_volume < 80)
|
||||
if(src.contents.len < limit && src.reagents.total_volume < 80)
|
||||
user << "You empty the plant bag into the All-In-One grinder."
|
||||
|
||||
src.updateUsrDialog()
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
var/be_pai = 1 //Consider client when searching for players to recruit as a pAI
|
||||
var/vote = null
|
||||
var/showvote = null
|
||||
var/activeslot = 1 //Default active slot!
|
||||
var/STFU_ghosts //80+ people rounds are fun to admin when text flies faster than airport security
|
||||
var/STFU_radio //80+ people rounds are fun to admin when text flies faster than airport security
|
||||
|
||||
|
||||
@@ -29,10 +29,11 @@ var/const/BE_CULTIST =(1<<8)
|
||||
var/const/BE_MONKEY =(1<<9)
|
||||
|
||||
|
||||
|
||||
var/const/MAX_SAVE_SLOTS = 3
|
||||
|
||||
|
||||
datum/preferences
|
||||
|
||||
var/real_name
|
||||
var/be_random_name = 0
|
||||
var/gender = MALE
|
||||
@@ -122,7 +123,28 @@ datum/preferences
|
||||
update_preview_icon()
|
||||
user << browse_rsc(preview_icon_front, "previewicon.png")
|
||||
user << browse_rsc(preview_icon_side, "previewicon2.png")
|
||||
var/dat = "<html><body>"
|
||||
var/dat = "<html><body><center>"
|
||||
|
||||
|
||||
if(!IsGuestKey(user.key))
|
||||
var/list/saves = list()
|
||||
for(var/i = 1; i <= MAX_SAVE_SLOTS; i += 1)
|
||||
saves += "<a href=\"byond://?src=\ref[user];preferences=1;changeslot=[i]\">Save Slot [i]</a>"
|
||||
|
||||
for(var/i = 1; i <= MAX_SAVE_SLOTS; i += 1)
|
||||
if(i == user.client.activeslot)
|
||||
dat += "Save Slot [i]"
|
||||
else
|
||||
dat += "[saves[i]]"
|
||||
|
||||
if(i != MAX_SAVE_SLOTS)
|
||||
dat += " / "
|
||||
|
||||
else
|
||||
dat += "Please create an account to save your preferences."
|
||||
|
||||
dat += "</center><hr><table><tr><td width='300px' height='300px'>"
|
||||
|
||||
dat += "<b>Name:</b> "
|
||||
dat += "<a href=\"byond://?src=\ref[user];preferences=1;real_name=input\"><b>[real_name]</b></a> "
|
||||
dat += "(<a href=\"byond://?src=\ref[user];preferences=1;real_name=random\">®</A>) "
|
||||
@@ -142,17 +164,17 @@ datum/preferences
|
||||
dat += "<b>OOC Notes:</b> <a href='byond://?src=\ref[user];preferences=1;OOC=input'> Edit </a><br>"
|
||||
|
||||
if((user.client) && (user.client.holder) && (user.client.holder.rank))
|
||||
dat += "<hr><b>Adminhelp sound</b>: "
|
||||
dat += "[(sound_adminhelp)?"On":"Off"] <a href='byond://?src=\ref[user];preferences=1;toggleadminhelpsound=1'>toggle</a>"
|
||||
dat += "<b>Adminhelp sound</b>: "
|
||||
dat += "[(sound_adminhelp)?"On":"Off"] <a href='byond://?src=\ref[user];preferences=1;toggleadminhelpsound=1'>toggle</a><br>"
|
||||
|
||||
if(user.client.holder.level >= 5)
|
||||
dat += "<hr><b>OOC</b><br>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;ooccolor=input'>Change color</a> <font face=\"fixedsys\" size=\"3\" color=\"[ooccolor]\"><table style='display:inline;' bgcolor=\"[ooccolor]\"><tr><td>__</td></tr></table></font>"
|
||||
dat += "<br><b>OOC</b><br>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;ooccolor=input'>Change color</a> <font face=\"fixedsys\" size=\"3\" color=\"[ooccolor]\"><table style='display:inline;' bgcolor=\"[ooccolor]\"><tr><td>__</td></tr></table></font><br>"
|
||||
|
||||
dat += "<hr><b>Occupation Choices</b><br>"
|
||||
dat += "<br><b>Occupation Choices</b><br>"
|
||||
dat += "\t<a href=\"byond://?src=\ref[user];preferences=1;occ=1\"><b>Set Preferences</b></a><br>"
|
||||
|
||||
dat += "<hr><table><tr><td><b>Body</b> "
|
||||
dat += "<br><table><tr><td><b>Body</b> "
|
||||
dat += "(<a href=\"byond://?src=\ref[user];preferences=1;s_tone=random;underwear=random;backbag_type=random;age=random;b_type=random;hair=random;h_style=random;facial=random;f_style=random;eyes=random\">®</A>)" // Random look
|
||||
dat += "<br>"
|
||||
dat += "Blood Type: <a href='byond://?src=\ref[user];preferences=1;b_type=input'>[b_type]</a><br>"
|
||||
@@ -168,22 +190,24 @@ datum/preferences
|
||||
|
||||
dat += "</td><td><b>Preview</b><br><img src=previewicon.png height=64 width=64><img src=previewicon2.png height=64 width=64></td></tr></table>" //Carn: Now with profile!
|
||||
|
||||
dat += "<hr><b>Hair</b><br>"
|
||||
dat += "</td><td width='300px' height='300px'>"
|
||||
|
||||
dat += "<br><b>Hair</b><br>"
|
||||
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;hair=input'>Change Color</a> <font face=\"fixedsys\" size=\"3\" color=\"#[num2hex(r_hair, 2)][num2hex(g_hair, 2)][num2hex(b_hair, 2)]\"><table style='display:inline;' bgcolor=\"#[num2hex(r_hair, 2)][num2hex(g_hair, 2)][num2hex(b_hair)]\"><tr><td>__</td></tr></table></font> "
|
||||
|
||||
dat += "Style: <a href='byond://?src=\ref[user];preferences=1;h_style=input'>[h_style]</a>"
|
||||
dat += "Style: <a href='byond://?src=\ref[user];preferences=1;h_style=input'>[h_style]</a><br>"
|
||||
|
||||
dat += "<hr><b>Facial</b><br>"
|
||||
dat += "<br><b>Facial</b><br>"
|
||||
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;facial=input'>Change Color</a> <font face=\"fixedsys\" size=\"3\" color=\"#[num2hex(r_facial, 2)][num2hex(g_facial, 2)][num2hex(b_facial, 2)]\"><table style='display:inline;' bgcolor=\"#[num2hex(r_facial, 2)][num2hex(g_facial, 2)][num2hex(b_facial)]\"><tr><td>__</td></tr></table></font> "
|
||||
|
||||
dat += "Style: <a href='byond://?src=\ref[user];preferences=1;f_style=input'>[f_style]</a>"
|
||||
dat += "Style: <a href='byond://?src=\ref[user];preferences=1;f_style=input'>[f_style]</a><br>"
|
||||
|
||||
dat += "<hr><b>Eyes</b><br>"
|
||||
dat += "<br><b>Eyes</b><br>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;eyes=input'>Change Color</a> <font face=\"fixedsys\" size=\"3\" color=\"#[num2hex(r_eyes, 2)][num2hex(g_eyes, 2)][num2hex(b_eyes, 2)]\"><table style='display:inline;' bgcolor=\"#[num2hex(r_eyes, 2)][num2hex(g_eyes, 2)][num2hex(b_eyes)]\"><tr><td>__</td></tr></table></font>"
|
||||
|
||||
dat += "<hr>"
|
||||
dat += "<br><br>"
|
||||
if(jobban_isbanned(user, "Syndicate"))
|
||||
dat += "<b>You are banned from antagonist roles.</b>"
|
||||
src.be_special = 0
|
||||
@@ -199,16 +223,16 @@ datum/preferences
|
||||
else
|
||||
dat += "<b>Be [i]:</b> <a href=\"byond://?src=\ref[user];preferences=1;be_special=[n]\"><b>[src.be_special&(1<<n) ? "Yes" : "No"]</b></a><br>"
|
||||
n++
|
||||
dat += "<hr>"
|
||||
dat += "</td></tr></table><hr><center>"
|
||||
|
||||
if(!IsGuestKey(user.key))
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;load=1'>Load Setup</a><br>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;save=1'>Save Setup</a><br>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;load=1'>Undo</a> - "
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;save=1'>Save Setup</a> - "
|
||||
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;reset_all=1'>Reset Setup</a><br>"
|
||||
dat += "</body></html>"
|
||||
dat += "<a href='byond://?src=\ref[user];preferences=1;reset_all=1'>Reset Setup</a>"
|
||||
dat += "</center></body></html>"
|
||||
|
||||
user << browse(dat, "window=preferences;size=300x710")
|
||||
user << browse(dat, "window=preferences;size=550x545")
|
||||
|
||||
proc/SetChoices(mob/user, limit = 17, list/splitJobs = list("Chief Engineer"), width = 550, height = 500)
|
||||
//limit - The amount of jobs allowed per column. Defaults to 17 to make it look nice.
|
||||
@@ -640,8 +664,14 @@ datum/preferences
|
||||
savefile_save(user)
|
||||
|
||||
else if(link_tags["load"])
|
||||
if(!savefile_load(user, 0))
|
||||
alert(user, "You do not have a savefile.")
|
||||
if(!savefile_load(user))
|
||||
alert(user, "You do not have a savefile or a convertable savefile.")
|
||||
|
||||
else if(link_tags["changeslot"])
|
||||
savefile_save(user)
|
||||
user.client.activeslot = text2num(link_tags["changeslot"])
|
||||
savefile_load(user)
|
||||
|
||||
|
||||
if(link_tags["reset_all"])
|
||||
gender = MALE
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#define SAVEFILE_VERSION_MAX 7
|
||||
|
||||
datum/preferences/proc/savefile_path(mob/user)
|
||||
return "data/player_saves/[copytext(user.ckey, 1, 2)]/[user.ckey]/preferences.sav"
|
||||
if(!user.client)
|
||||
return null
|
||||
else
|
||||
return "data/player_saves/[copytext(user.ckey, 1, 2)]/[user.ckey]/preferences[user.client.activeslot].sav"
|
||||
|
||||
datum/preferences/proc/savefile_save(mob/user)
|
||||
if (IsGuestKey(user.key))
|
||||
@@ -81,7 +84,22 @@ datum/preferences/proc/savefile_load(mob/user)
|
||||
if(IsGuestKey(user.key)) return 0
|
||||
|
||||
var/path = savefile_path(user)
|
||||
if(!fexists(path)) return 0
|
||||
|
||||
if(!fexists(path))
|
||||
//Is there a preference file before this was committed?
|
||||
path = "data/player_saves/[copytext(user.ckey, 1, 2)]/[user.ckey]/preferences.sav"
|
||||
if(!fexists(path))
|
||||
//No there is not
|
||||
return 0
|
||||
else
|
||||
//Yes there is. Let's rename it.
|
||||
var/savefile/oldsave = new/savefile(path)
|
||||
fcopy(oldsave, savefile_path(user))
|
||||
fdel(path) // We don't need the old file anymore
|
||||
path = savefile_path(user)
|
||||
// Did nothing break?
|
||||
if(!fexists(path))
|
||||
return 0
|
||||
|
||||
var/savefile/F = new /savefile(path)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user