v o t e s a v i n g

This commit is contained in:
Putnam
2019-12-26 12:13:02 -08:00
parent a471e26d9c
commit f8557c8ae4
2 changed files with 40 additions and 3 deletions
+18
View File
@@ -20,6 +20,7 @@ SUBSYSTEM_DEF(persistence)
var/list/antag_rep = list()
var/list/antag_rep_change = list()
var/list/picture_logging_information = list()
var/list/saved_votes = list()
var/list/obj/structure/sign/picture_frame/photo_frames
var/list/obj/item/storage/photo_album/photo_albums
@@ -33,6 +34,7 @@ SUBSYSTEM_DEF(persistence)
LoadRecentRulesets()
LoadRecentMaps()
LoadPhotoPersistence()
LoadSavedVotes()
if(CONFIG_GET(flag/use_antag_rep))
LoadAntagReputation()
LoadRandomizedRecipes()
@@ -207,6 +209,15 @@ SUBSYSTEM_DEF(persistence)
return
antag_rep = json_decode(json)
/datum/controller/subsystem/persistence/proc/LoadSavedVotes()
var/json_file = file("data/SavedVotes.json")
if(!fexists(json_file))
return
var/list/json = json_decode(file2text(json_file))
if(!json)
return
saved_votes = json["data"]
/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items)
for(var/A in GLOB.trophy_cases)
var/obj/structure/displaycase/trophy/T = A
@@ -484,3 +495,10 @@ SUBSYSTEM_DEF(persistence)
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
/datum/controller/subsystem/persistence/proc/SaveSavedVotes()
var/json_file = file("data/SavedVotes.json")
var/list/file_data = list()
file_data["data"] = saved_votes
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))