More work towards saving

This commit is contained in:
Arokha Sieyes
2016-05-08 17:24:38 -04:00
parent 687129144f
commit 2dfd8858a9
4 changed files with 79 additions and 9 deletions
+2 -2
View File
@@ -159,7 +159,7 @@
send_resources()
nanomanager.send_resources(src)
if(!void)
void = new()
screen += void
@@ -170,7 +170,7 @@
if(config.aggressive_changelog)
src.changes()
hook_vr("client_new",list(src)) //VOREStation Code
//////////////
//DISCONNECT//
+12 -3
View File
@@ -5,6 +5,7 @@
var/spawning = 0//Referenced when you want to delete the new_player later on in the code.
var/totalPlayers = 0 //Player counts for the Lobby tab
var/totalPlayersReady = 0
var/datum/browser/panel
universal_speak = 1
invisibility = 101
@@ -61,7 +62,12 @@
output += "</div>"
src << browse(output,"window=playersetup;size=210x280;can_close=0")
//src << browse(output,"window=playersetup;size=210x280;can_close=0")
panel = new(src, "New Player","New Player", 210, 280, src)
panel.set_window_options("can_close=0")
panel.set_content(output)
panel.open()
return
/mob/new_player/Stat()
@@ -98,7 +104,8 @@
ready = 0
if(href_list["refresh"])
src << browse(null, "window=playersetup") //closes the player setup window
//src << browse(null, "window=playersetup") //closes the player setup window
panel.close()
new_player_panel_proc()
if(href_list["observe"])
@@ -468,8 +475,10 @@
return 0
/mob/new_player/proc/close_spawn_windows()
src << browse(null, "window=latechoices") //closes late choices window
src << browse(null, "window=playersetup") //closes the player setup window
//src << browse(null, "window=playersetup") //closes the player setup window
panel.close()
/mob/new_player/proc/has_admin_rights()
return check_rights(R_ADMIN, 0, src)
+63 -4
View File
@@ -23,25 +23,48 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
// Overrides/additions to stock defines go here, as well as hooks. Sort them by
// the object they are overriding. So all /mob/living together, etc.
//
/datum/configuration
var/items_survive_digestion = 1 //For configuring if the important_items survive digestion
//
// The datum type bolted onto normal preferences datums for storing Virgo stuff
//
/client
var/datum/vore_preferences/prefs_vr
/hook/client_new/proc/add_prefs_vr(client/C)
C.prefs_vr = new/datum/vore_preferences(C)
if(C.prefs_vr)
return 1
return 0
/datum/vore_preferences
//Actual preferences
var/digestable = 1
var/list/belly_prefs = list()
/datum/configuration
var/items_survive_digestion = 1 //For configuring if the important_items survive digestion
//Mechanically required
var/path
var/slot
var/client/client
var/client_ckey
/datum/vore_preferences/New(client/C)
if(istype(C))
client = C
client_ckey = C.ckey
load_vore(C)
//
// Adding procs to types to support vore
//
/datum/vore_preferences/proc/save_vore_preferences()
//POLARISTODO
save_vore()
return
/datum/vore_preferences/proc/load_vore_preferences()
//POLARISTODO
load_vore()
return
//
@@ -66,3 +89,39 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE
return(B)
return 0
//
// Save/Load Vore Preferences
//
/datum/vore_preferences/proc/load_vore(filename="preferences_vr.sav")
if(!client || !client_ckey) return 0 //No client, how can we save?
if(!path)
path = "data/player_saves/[copytext(client_ckey,1,2)]/[client_ckey]/[filename]"
if(!path) return 0 //Path couldn't be set?
var/savefile/S = new /savefile(path)
if(!S) return 0 //Savefile object couldn't be created?
S.cd = "/"
if(!slot)
slot = client.prefs.default_slot
slot = sanitize_integer(slot, 1, config.character_slots, initial(client.prefs.default_slot))
S.cd = "/character[slot]"
S["digestable"] >> digestable
S["belly_prefs"] >> belly_prefs
return 1
/datum/vore_preferences/proc/save_vore()
if(!path) return 0
if(!slot) return 0
var/savefile/S = new /savefile(path)
if(!S) return 0
S.cd = "/character[slot]"
S["digestable"] << digestable
S["belly_prefs"] << belly_prefs
return 1
+2
View File
@@ -1,6 +1,8 @@
//The base hooks themselves
//New() hooks
/hook/client_new
/hook/mob_new
/hook/living_new