From 2dfd8858a9f81f74fb05552ffd67dd432fb8433d Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sun, 8 May 2016 17:24:38 -0400 Subject: [PATCH] More work towards saving --- code/modules/client/client procs.dm | 4 +- code/modules/mob/new_player/new_player.dm | 15 ++++- code/modules/vore/eating/vore_vr.dm | 67 +++++++++++++++++++++-- code/modules/vore/hook-defs_vr.dm | 2 + 4 files changed, 79 insertions(+), 9 deletions(-) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 4c05ebece5..08b68c53a0 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -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// diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index e9aa06068b..66e0509bb1 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -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 += "" - 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) diff --git a/code/modules/vore/eating/vore_vr.dm b/code/modules/vore/eating/vore_vr.dm index 1e2c8cb1ba..8d93f20fd0 100644 --- a/code/modules/vore/eating/vore_vr.dm +++ b/code/modules/vore/eating/vore_vr.dm @@ -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 \ No newline at end of file diff --git a/code/modules/vore/hook-defs_vr.dm b/code/modules/vore/hook-defs_vr.dm index 5dd01eb318..629b1ba8f3 100644 --- a/code/modules/vore/hook-defs_vr.dm +++ b/code/modules/vore/hook-defs_vr.dm @@ -1,6 +1,8 @@ //The base hooks themselves //New() hooks +/hook/client_new + /hook/mob_new /hook/living_new