This commit is contained in:
silicons
2020-12-25 15:54:28 -08:00
parent c05c57acf9
commit 999262665b
2 changed files with 26 additions and 2 deletions

View File

@@ -21,13 +21,26 @@ SUBSYSTEM_DEF(persistence)
/datum/controller/subsystem/persistence/Initialize() /datum/controller/subsystem/persistence/Initialize()
LoadServerPersistence() LoadServerPersistence()
LoadGamePersistence() LoadGamePersistence()
LoadMapPersistence() var/map_persistence_path = get_map_persistence_path()
if(map_persistence_path)
LoadMapPersistence(map_persistence_path)
return ..() return ..()
/**
* Gets the persistence path of the current map.
*/
/datum/controller/subsystem/persistence/proc/get_map_persistence_path()
ASSERT(SSmapping.config)
if(SSmapping.config.persistence_key == "NO_PERSIST")
return null
return "data/persistence/[ckey(SSmapping.config.persistence_key)]"
/datum/controller/subsystem/persistence/proc/CollectData() /datum/controller/subsystem/persistence/proc/CollectData()
SaveServerPersistence() SaveServerPersistence()
SaveGamePersistence() SaveGamePersistence()
SaveMapPersistence() var/map_persistence_path = get_map_persistence_path()
if(map_persistence_path)
SaveMapPersistence(map_persistence_path)
/** /**
* Loads persistent data relevant to the server: Configurations, past gamemodes, votes, etc * Loads persistent data relevant to the server: Configurations, past gamemodes, votes, etc

View File

@@ -18,6 +18,8 @@
var/map_name = "Box Station" var/map_name = "Box Station"
var/map_path = "map_files/BoxStation" var/map_path = "map_files/BoxStation"
var/map_file = "BoxStation.dmm" var/map_file = "BoxStation.dmm"
/// Persistence key: Defaults to ckey(map_name). If set to "NO_PERSIST", this map will have NO persistence.
var/persistence_key
var/traits = null var/traits = null
var/space_ruin_levels = 4 var/space_ruin_levels = 4
@@ -99,6 +101,15 @@
map_path = json["map_path"] map_path = json["map_path"]
map_file = json["map_file"] map_file = json["map_file"]
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
// "map_file": "BoxStation.dmm" // "map_file": "BoxStation.dmm"
if (istext(map_file)) if (istext(map_file))
if (!fexists("_maps/[map_path]/[map_file]")) if (!fexists("_maps/[map_path]/[map_file]"))