mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 19:51:59 +00:00
* A * Update centcom_computers.dm * a * Update CommandReportConsole.js * commandreporter * Update command_report_computer.dm * a * FEET COMMAND * a * e * e * Update departments.dm * F * a * a * Update new_player.dm * Update new_player.dm * AAAAAA * Update zombie.dm * Update zombie.dm * aaaaaaa * 0 * a * Update CentCom_skyrat.dmm * aa * Update nsstitan.dmm * A * Update station_goal_computer.dm * Update station_goal_computer.dm * Update bridge_officer.dm * Update CentCom_skyrat.dmm * Update pda.dm * Revert "Update pda.dm" This reverts commit fbe1823726f9edb7f7c3ba03c2d34b08b46ae294. * logic * cargo system * 0 * Update import_console.dm * Update cargo_skyrat.dmm * noob coder * Update cargo_shuttle_console.dm * a * Update deck_crew.dm * Update export_console.dm * Update deck_crew.dm * 0 * Update CentCom_skyrat_z2.dmm * AAAA * 0 * Update CentCom_skyrat_z2.dmm * Update cargo_shuttle_console.dm * Update CentCom_skyrat_z2.dmm * a * SELLING CREW IS BAD. * a * Update supply.dm * Update CentCom_skyrat_z2.dmm * Update supply.dm * A * a * a * Update zombie.dm * Update modular_skyrat/modules/central_command_module/code/jobs/fleetmaster.dm Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
163 lines
4.4 KiB
Plaintext
163 lines
4.4 KiB
Plaintext
//used for holding information about unique properties of maps
|
|
//feed it json files that match the datum layout
|
|
//defaults to box
|
|
// -Cyberboss
|
|
|
|
/datum/map_config
|
|
// Metadata
|
|
var/config_filename = "_maps/metastation.json"
|
|
var/defaulted = TRUE // set to FALSE by LoadConfig() succeeding
|
|
// Config from maps.txt
|
|
var/config_max_users = 0
|
|
var/config_min_users = 0
|
|
var/voteweight = 1
|
|
var/votable = FALSE
|
|
|
|
// Config actually from the JSON - should default to Meta
|
|
var/map_name = "Meta Station"
|
|
var/map_path = "map_files/MetaStation"
|
|
var/map_file = "MetaStation.dmm"
|
|
|
|
var/traits = null
|
|
var/space_ruin_levels = 7
|
|
var/space_empty_levels = 1
|
|
|
|
var/minetype = "lavaland"
|
|
|
|
var/allow_custom_shuttles = TRUE
|
|
var/shuttles = list(
|
|
"cargo" = "cargo_skyrat",
|
|
"ferry" = "ferry_fancy",
|
|
"whiteship" = "whiteship_box",
|
|
"emergency" = "emergency_skyrat") //SKYRAT EDIT CHANGE
|
|
|
|
/// Dictionary of job sub-typepath to template changes dictionary
|
|
var/job_changes = list()
|
|
|
|
/proc/load_map_config(filename = "data/next_map.json", default_to_box, delete_after, error_if_missing = TRUE)
|
|
var/datum/map_config/config = new
|
|
if (default_to_box)
|
|
return config
|
|
if (!config.LoadConfig(filename, error_if_missing))
|
|
qdel(config)
|
|
config = new /datum/map_config // Fall back to Box
|
|
if (delete_after)
|
|
fdel(filename)
|
|
return config
|
|
|
|
#define CHECK_EXISTS(X) if(!istext(json[X])) { log_world("[##X] missing from json!"); return; }
|
|
/datum/map_config/proc/LoadConfig(filename, error_if_missing)
|
|
if(!fexists(filename))
|
|
if(error_if_missing)
|
|
log_world("map_config not found: [filename]")
|
|
return
|
|
|
|
var/json = file(filename)
|
|
if(!json)
|
|
log_world("Could not open map_config: [filename]")
|
|
return
|
|
|
|
json = file2text(json)
|
|
if(!json)
|
|
log_world("map_config is not text: [filename]")
|
|
return
|
|
|
|
json = json_decode(json)
|
|
if(!json)
|
|
log_world("map_config is not json: [filename]")
|
|
return
|
|
|
|
config_filename = filename
|
|
|
|
if(!json["version"])
|
|
log_world("map_config missing version!")
|
|
return
|
|
|
|
if(json["version"] != MAP_CURRENT_VERSION)
|
|
log_world("map_config has invalid version [json["version"]]!")
|
|
return
|
|
|
|
CHECK_EXISTS("map_name")
|
|
map_name = json["map_name"]
|
|
CHECK_EXISTS("map_path")
|
|
map_path = json["map_path"]
|
|
|
|
map_file = json["map_file"]
|
|
// "map_file": "MetaStation.dmm"
|
|
if (istext(map_file))
|
|
if (!fexists("_maps/[map_path]/[map_file]"))
|
|
log_world("Map file ([map_path]/[map_file]) does not exist!")
|
|
return
|
|
// "map_file": ["Lower.dmm", "Upper.dmm"]
|
|
else if (islist(map_file))
|
|
for (var/file in map_file)
|
|
if (!fexists("_maps/[map_path]/[file]"))
|
|
log_world("Map file ([map_path]/[file]) does not exist!")
|
|
return
|
|
else
|
|
log_world("map_file missing from json!")
|
|
return
|
|
|
|
if (islist(json["shuttles"]))
|
|
var/list/L = json["shuttles"]
|
|
for(var/key in L)
|
|
var/value = L[key]
|
|
shuttles[key] = value
|
|
else if ("shuttles" in json)
|
|
log_world("map_config shuttles is not a list!")
|
|
return
|
|
|
|
shuttles["emergency"] = "emergency_skyrat"
|
|
|
|
traits = json["traits"]
|
|
// "traits": [{"Linkage": "Cross"}, {"Space Ruins": true}]
|
|
if (islist(traits))
|
|
// "Station" is set by default, but it's assumed if you're setting
|
|
// traits you want to customize which level is cross-linked
|
|
for (var/level in traits)
|
|
if (!(ZTRAIT_STATION in level))
|
|
level[ZTRAIT_STATION] = TRUE
|
|
// "traits": null or absent -> default
|
|
else if (!isnull(traits))
|
|
log_world("map_config traits is not a list!")
|
|
return
|
|
|
|
var/temp = json["space_ruin_levels"]
|
|
if (isnum(temp))
|
|
space_ruin_levels = temp
|
|
else if (!isnull(temp))
|
|
log_world("map_config space_ruin_levels is not a number!")
|
|
return
|
|
|
|
temp = json["space_empty_levels"]
|
|
if (isnum(temp))
|
|
space_empty_levels = temp
|
|
else if (!isnull(temp))
|
|
log_world("map_config space_empty_levels is not a number!")
|
|
return
|
|
|
|
if ("minetype" in json)
|
|
minetype = json["minetype"]
|
|
|
|
allow_custom_shuttles = json["allow_custom_shuttles"] != FALSE
|
|
|
|
if ("job_changes" in json)
|
|
if(!islist(json["job_changes"]))
|
|
log_world("map_config \"job_changes\" field is missing or invalid!")
|
|
return
|
|
job_changes = json["job_changes"]
|
|
|
|
defaulted = FALSE
|
|
return TRUE
|
|
#undef CHECK_EXISTS
|
|
|
|
/datum/map_config/proc/GetFullMapPaths()
|
|
if (istext(map_file))
|
|
return list("_maps/[map_path]/[map_file]")
|
|
. = list()
|
|
for (var/file in map_file)
|
|
. += "_maps/[map_path]/[file]"
|
|
|
|
/datum/map_config/proc/MakeNextMap()
|
|
return config_filename == "data/next_map.json" || fcopy(config_filename, "data/next_map.json")
|