mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
[MIRROR] TGUI Outfit Manager and Editor (#4828)
* TGUI Outfit Manager and Editor * Update persistence.dm Co-authored-by: Trigg <36010999+TriggeredBoi@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
co-authored by
Trigg
Gandalf
parent
9ee2fb4c54
commit
835dee4581
@@ -34,6 +34,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
LoadRandomizedRecipes()
|
||||
LoadPaintings()
|
||||
LoadPanicBunker() //SKYRAT EDIT ADDITION - PANICBUNKER
|
||||
load_custom_outfits()
|
||||
|
||||
GLOB.explorer_drone_adventures = load_adventures()
|
||||
return ..()
|
||||
@@ -185,6 +186,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
SavePaintings()
|
||||
SaveScars()
|
||||
SavePanicBunker()//SKYRAT EDIT ADDITION - PANICBUNKER
|
||||
save_custom_outfits()
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/GetPhotoAlbums()
|
||||
var/album_path = file("data/photo_albums.json")
|
||||
@@ -413,3 +415,35 @@ SUBSYSTEM_DEF(persistence)
|
||||
original_human.save_persistent_scars(TRUE)
|
||||
else
|
||||
original_human.save_persistent_scars()
|
||||
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/load_custom_outfits()
|
||||
var/file = file("data/custom_outfits.json")
|
||||
if(!fexists(file))
|
||||
return
|
||||
var/outfits_json = file2text(file)
|
||||
var/list/outfits = json_decode(outfits_json)
|
||||
if(!islist(outfits))
|
||||
return
|
||||
|
||||
for(var/outfit_data in outfits)
|
||||
if(!islist(outfit_data))
|
||||
continue
|
||||
|
||||
var/outfittype = text2path(outfit_data["outfit_type"])
|
||||
if(!ispath(outfittype, /datum/outfit))
|
||||
continue
|
||||
var/datum/outfit/outfit = new outfittype
|
||||
if(!outfit.load_from(outfit_data))
|
||||
continue
|
||||
GLOB.custom_outfits += outfit
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/save_custom_outfits()
|
||||
var/file = file("data/custom_outfits.json")
|
||||
fdel(file)
|
||||
|
||||
var/list/data = list()
|
||||
for(var/datum/outfit/outfit in GLOB.custom_outfits)
|
||||
data += list(outfit.get_json_data())
|
||||
|
||||
WRITE_FILE(file, json_encode(data))
|
||||
|
||||
Reference in New Issue
Block a user