Porting tg painting code. (#12305)

* Porting tg painting code.

* yes.
This commit is contained in:
Ghom
2020-05-21 03:45:36 +02:00
committed by GitHub
parent 6696560656
commit 3ac61c0704
21 changed files with 831 additions and 313 deletions

View File

@@ -24,6 +24,8 @@ SUBSYSTEM_DEF(persistence)
var/list/saved_votes = list()
var/list/obj/structure/sign/picture_frame/photo_frames
var/list/obj/item/storage/photo_album/photo_albums
var/list/obj/structure/sign/painting/painting_frames = list()
var/list/paintings = list()
/datum/controller/subsystem/persistence/Initialize()
LoadSatchels()
@@ -265,6 +267,7 @@ SUBSYSTEM_DEF(persistence)
CollectAntagReputation()
SaveRandomizedRecipes()
SavePanicBunker()
SavePaintings()
/datum/controller/subsystem/persistence/proc/LoadPanicBunker()
var/bunker_path = file("data/bunker_passthrough.json")
@@ -528,3 +531,19 @@ SUBSYSTEM_DEF(persistence)
file_data["data"] = saved_votes[ckey]
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
/datum/controller/subsystem/persistence/proc/LoadPaintings()
var/json_file = file("data/paintings.json")
if(fexists(json_file))
paintings = json_decode(file2text(json_file))
for(var/obj/structure/sign/painting/P in painting_frames)
P.load_persistent()
/datum/controller/subsystem/persistence/proc/SavePaintings()
for(var/obj/structure/sign/painting/P in painting_frames)
P.save_persistent()
var/json_file = file("data/paintings.json")
fdel(json_file)
WRITE_FILE(json_file, json_encode(paintings))