buildmode mapgen tool save

This commit is contained in:
Artur
2021-10-26 16:31:36 +03:00
parent ce97595abe
commit bfcdf83e55
8 changed files with 335 additions and 0 deletions

View File

@@ -383,3 +383,34 @@
/obj/proc/plunger_act(obj/item/plunger/P, mob/living/user, reinforced)
return
//For returning special data when the object is saved
//For example, or silos will return a list of their materials which will be dumped on top of them
//Can be customised if you have something that contains something you want saved
//If you put an incorrect format it will break outputting, so don't use this if you don't know what you are doing
//NOTE: Contents is automatically saved, so if you store your things in the contents var, don't worry about this
//====Output Format Examples====:
//===Single Object===
// "/obj/item/folder/blue"
//===Multiple Objects===
// "/obj/item/folder/blue,\n
// /obj/item/folder/red"
//===Single Object with metadata===
// "/obj/item/folder/blue{\n
// \tdir = 8;\n
// \tname = "special folder"\n
// \t}"
//===Multiple Objects with metadata===
// "/obj/item/folder/blue{\n
// \tdir = 8;\n
// \tname = "special folder"\n
// \t},\n
// /obj/item/folder/red"
//====How to save easily====:
// return "[thing.type][generate_tgm_metadata(thing)]"
//Where thing is the additional thing you want to same (For example ores inside an ORM)
//Just add ,\n between each thing
//generate_tgm_metadata(thing) handles everything inside the {} for you
/obj/proc/on_object_saved(depth)
return ""

View File

@@ -672,3 +672,15 @@
if(allowed(user))
return TRUE
to_chat(user, "<span class='notice'>Access denied.</span>")
/obj/structure/closet/on_object_saved(depth)
if(depth >= 10)
return ""
var/dat = ""
for(var/obj/item in contents)
var/metadata = generate_tgm_metadata(item)
dat += "[dat ? ",\n" : ""][item.type][metadata]"
//Save the contents of things inside the things inside us, EG saving the contents of bags inside lockers
var/custom_data = item.on_object_saved(depth++)
dat += "[custom_data ? ",\n[custom_data]" : ""]"
return dat