mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
file ops
This commit is contained in:
@@ -31,7 +31,7 @@ SUBSYSTEM_DEF(persistence)
|
||||
*/
|
||||
/datum/controller/subsystem/persistence/proc/get_map_persistence_path()
|
||||
ASSERT(SSmapping.config)
|
||||
if(SSmapping.config.persistence_key == "NO_PERSIST")
|
||||
if(!SSmapping.config.persistence_key || (SSmapping.config.persistence_key == "NO_PERSIST"))
|
||||
return null
|
||||
return "data/persistence/[ckey(SSmapping.config.persistence_key)]"
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
SaveMapDebris()
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/LoadMapDebris()
|
||||
if(CONFIG_GET(flag/persistent_debris_only))
|
||||
wipe_existing_debris()
|
||||
if(!fexists("[get_map_persistence_path()]/debris.json"))
|
||||
return
|
||||
if(loaded_debris)
|
||||
return
|
||||
loaded_debris = TRUE
|
||||
if(CONFIG_GET(flag/persistent_debris_only))
|
||||
wipe_existing_debris()
|
||||
var/list/allowed_turf_typecache = typecacheof(/turf/open) - typecacheof(/turf/open/space)
|
||||
var/list/allowed_z_cache = list()
|
||||
for(var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
||||
@@ -104,12 +104,16 @@
|
||||
message_admins(w)
|
||||
subsystem_log(w)
|
||||
|
||||
subsystem_log({"
|
||||
Debris saving completed:
|
||||
Total: [global_max]
|
||||
By type: [english_list(stored_by_type)]
|
||||
"})
|
||||
WRITE_FILE("[get_map_persistence_path()]/debris.json", json_encode(data))
|
||||
var/list/bytype = list()
|
||||
for(var/path in stored_by_type)
|
||||
bytype += "[path] - [stored_by_type[path]]"
|
||||
subsystem_log(
|
||||
{"Debris saving completed:
|
||||
Total: [stored]
|
||||
By type:
|
||||
[bytype.Join("\n")]"}
|
||||
)
|
||||
WRITE_FILE(file("[get_map_persistence_path()]/debris.json"), json_encode(data))
|
||||
|
||||
/datum/controller/subsystem/persistence/proc/IsValidDebrisLocation(turf/tile, list/allowed_typecache, list/allowed_zcache, obj/effect/decal/cleanable/type, loading = FALSE)
|
||||
if(!allowed_typecache[tile.type])
|
||||
|
||||
@@ -105,10 +105,11 @@
|
||||
persistence_key = ckey(map_name)
|
||||
|
||||
var/json_persistence_key = json["persistence_key"]
|
||||
if(json_persistence_key == "NO_PERSIST")
|
||||
persistence_key = null
|
||||
else
|
||||
persistence_key = json_persistence_key
|
||||
if(json_persistence_key)
|
||||
if(json_persistence_key == "NO_PERSIST")
|
||||
persistence_key = null
|
||||
else
|
||||
persistence_key = json_persistence_key
|
||||
|
||||
// "map_file": "BoxStation.dmm"
|
||||
if (istext(map_file))
|
||||
|
||||
Reference in New Issue
Block a user