diff --git a/code/__defines/configuration.dm b/code/__defines/configuration.dm new file mode 100644 index 0000000000..477bed243c --- /dev/null +++ b/code/__defines/configuration.dm @@ -0,0 +1,30 @@ +//config files +#define CONFIG_GET(X) global.config.Get(/datum/config_entry/##X) +#define CONFIG_SET(X, Y) global.config.Set(/datum/config_entry/##X, ##Y) + +#define CONFIG_MAPS_FILE "maps.txt" + +//flags +/// can't edit +#define CONFIG_ENTRY_LOCKED (1<<0) +/// can't see value +#define CONFIG_ENTRY_HIDDEN (1<<1) + +/// Force the config directory to be something other than "config" +#define OVERRIDE_CONFIG_DIRECTORY_PARAMETER "config-directory" + +// Config entry types +#define VALUE_MODE_NUM 0 +#define VALUE_MODE_TEXT 1 +#define VALUE_MODE_FLAG 2 + +#define KEY_MODE_TEXT 0 +#define KEY_MODE_TYPE 1 + +// Flags for respawn config +/// Respawn not allowed +#define RESPAWN_FLAG_DISABLED 0 +/// Respawn as much as you'd like +#define RESPAWN_FLAG_FREE 1 +/// Can respawn, but not as the same character +#define RESPAWN_FLAG_NEW_CHARACTER 2 diff --git a/code/__defines/rust_g.dm b/code/__defines/rust_g.dm index 1c93497ec8..bd0e0879b4 100644 --- a/code/__defines/rust_g.dm +++ b/code/__defines/rust_g.dm @@ -38,27 +38,46 @@ #define RUST_G (__rust_g || __detect_rust_g()) #endif -#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET" -#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB" -#define RUSTG_JOB_ERROR "JOB PANICKED" +// Handle 515 call() -> call_ext() changes +#if DM_VERSION >= 515 +#define RUSTG_CALL call_ext +#else +#define RUSTG_CALL call +#endif -#define rustg_dmi_strip_metadata(fname) LIBCALL(RUST_G, "dmi_strip_metadata")(fname) -#define rustg_dmi_create_png(path, width, height, data) LIBCALL(RUST_G, "dmi_create_png")(path, width, height, data) +/// Gets the version of rust_g +/proc/rustg_get_version() return RUSTG_CALL(RUST_G, "get_version")() -#define rustg_noise_get_at_coordinates(seed, x, y) LIBCALL(RUST_G, "noise_get_at_coordinates")(seed, x, y) +#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")(fname) +#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data) +#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype) +/** + * input: must be a path, not an /icon; you have to do your own handling if it is one, as icon objects can't be directly passed to rustg. + * + * output: json_encode'd list. json_decode to get a flat list with icon states in the order they're in inside the .dmi + */ +#define rustg_dmi_icon_states(fname) RUSTG_CALL(RUST_G, "dmi_icon_states")(fname) -#define rustg_file_read(fname) LIBCALL(RUST_G, "file_read")(fname) -#define rustg_file_exists(fname) LIBCALL(RUST_G, "file_exists")(fname) -#define rustg_file_write(text, fname) LIBCALL(RUST_G, "file_write")(text, fname) -#define rustg_file_append(text, fname) LIBCALL(RUST_G, "file_append")(text, fname) +#define rustg_file_read(fname) RUSTG_CALL(RUST_G, "file_read")(fname) +#define rustg_file_exists(fname) (RUSTG_CALL(RUST_G, "file_exists")(fname) == "true") +#define rustg_file_write(text, fname) RUSTG_CALL(RUST_G, "file_write")(text, fname) +#define rustg_file_append(text, fname) RUSTG_CALL(RUST_G, "file_append")(text, fname) +#define rustg_file_get_line_count(fname) text2num(RUSTG_CALL(RUST_G, "file_get_line_count")(fname)) +#define rustg_file_seek_line(fname, line) RUSTG_CALL(RUST_G, "file_seek_line")(fname, "[line]") #ifdef RUSTG_OVERRIDE_BUILTINS #define file2text(fname) rustg_file_read("[fname]") #define text2file(text, fname) rustg_file_append(text, "[fname]") #endif -#define rustg_git_revparse(rev) LIBCALL(RUST_G, "rg_git_revparse")(rev) -#define rustg_git_commit_date(rev) LIBCALL(RUST_G, "rg_git_commit_date")(rev) +/// Returns the git hash of the given revision, ex. "HEAD". +#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev) + +/** + * Returns the date of the given revision in the format YYYY-MM-DD. + * Returns null if the revision is invalid. + */ +#define rustg_git_commit_date(rev) RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev) #define rustg_hash_string(algorithm, text) LIBCALL(RUST_G, "hash_string")(algorithm, text) #define rustg_hash_file(algorithm, fname) LIBCALL(RUST_G, "hash_file")(algorithm, fname) @@ -72,28 +91,36 @@ #define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing)) #endif -#define rustg_json_is_valid(text) (LIBCALL(RUST_G, "json_is_valid")(text) == "true") - -#define rustg_log_write(fname, text, format) LIBCALL(RUST_G, "log_write")(fname, text, format) -/proc/rustg_log_close_all() return LIBCALL(RUST_G, "log_close_all")() - -#define rustg_url_encode(text) LIBCALL(RUST_G, "url_encode")(text) -#define rustg_url_decode(text) LIBCALL(RUST_G, "url_decode")(text) - -#ifdef RUSTG_OVERRIDE_BUILTINS -#define url_encode(text) rustg_url_encode(text) -#define url_decode(text) rustg_url_decode(text) -#endif - #define RUSTG_HTTP_METHOD_GET "get" #define RUSTG_HTTP_METHOD_PUT "put" #define RUSTG_HTTP_METHOD_DELETE "delete" #define RUSTG_HTTP_METHOD_PATCH "patch" #define RUSTG_HTTP_METHOD_HEAD "head" #define RUSTG_HTTP_METHOD_POST "post" -#define rustg_http_request_blocking(method, url, body, headers) LIBCALL(RUST_G, "http_request_blocking")(method, url, body, headers) -#define rustg_http_request_async(method, url, body, headers) LIBCALL(RUST_G, "http_request_async")(method, url, body, headers) -#define rustg_http_check_request(req_id) LIBCALL(RUST_G, "http_check_request")(req_id) +#define rustg_http_request_blocking(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_blocking")(method, url, body, headers, options) +#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options) +#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id) + +#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET" +#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB" +#define RUSTG_JOB_ERROR "JOB PANICKED" + +#define rustg_json_is_valid(text) (RUSTG_CALL(RUST_G, "json_is_valid")(text) == "true") + +#define rustg_log_write(fname, text, format) LIBCALL(RUST_G, "log_write")(fname, text, format) +/proc/rustg_log_close_all() return LIBCALL(RUST_G, "log_close_all")() + +#define rustg_noise_get_at_coordinates(seed, x, y) RUSTG_CALL(RUST_G, "noise_get_at_coordinates")(seed, x, y) + +/* + * Takes in a string and json_encode()"d lists to produce a sanitized string. + * This function operates on whitelists, there is currently no way to blacklist. + * Args: + * * text: the string to sanitize. + * * attribute_whitelist_json: a json_encode()'d list of HTML attributes to allow in the final string. + * * tag_whitelist_json: a json_encode()'d list of HTML tags to allow in the final string. + */ +#define rustg_sanitize_html(text, attribute_whitelist_json, tag_whitelist_json) RUSTG_CALL(RUST_G, "sanitize_html")(text, attribute_whitelist_json, tag_whitelist_json) #define rustg_sql_connect_pool(options) LIBCALL(RUST_G, "sql_connect_pool")(options) #define rustg_sql_query_async(handle, query, params) LIBCALL(RUST_G, "sql_query_async")(handle, query, params) @@ -101,3 +128,37 @@ #define rustg_sql_connected(handle) LIBCALL(RUST_G, "sql_connected")(handle) #define rustg_sql_disconnect_pool(handle) LIBCALL(RUST_G, "sql_disconnect_pool")(handle) #define rustg_sql_check_query(job_id) LIBCALL(RUST_G, "sql_check_query")("[job_id]") + +#define rustg_time_microseconds(id) text2num(RUSTG_CALL(RUST_G, "time_microseconds")(id)) +#define rustg_time_milliseconds(id) text2num(RUSTG_CALL(RUST_G, "time_milliseconds")(id)) +#define rustg_time_reset(id) RUSTG_CALL(RUST_G, "time_reset")(id) + +/// Returns the timestamp as a string +/proc/rustg_unix_timestamp() + return RUSTG_CALL(RUST_G, "unix_timestamp")() + +#define rustg_raw_read_toml_file(path) json_decode(RUSTG_CALL(RUST_G, "toml_file_to_json")(path) || "null") + +/proc/rustg_read_toml_file(path) + var/list/output = rustg_raw_read_toml_file(path) + if (output["success"]) + return json_decode(output["content"]) + else + CRASH(output["content"]) + +#define rustg_raw_toml_encode(value) json_decode(RUSTG_CALL(RUST_G, "toml_encode")(json_encode(value))) + +/proc/rustg_toml_encode(value) + var/list/output = rustg_raw_toml_encode(value) + if (output["success"]) + return output["content"] + else + CRASH(output["content"]) + +#define rustg_url_encode(text) RUSTG_CALL(RUST_G, "url_encode")("[text]") +#define rustg_url_decode(text) RUSTG_CALL(RUST_G, "url_decode")(text) + +#ifdef RUSTG_OVERRIDE_BUILTINS + #define url_encode(text) rustg_url_encode(text) + #define url_decode(text) rustg_url_decode(text) +#endif diff --git a/code/_global_vars/configuration.dm b/code/_global_vars/configuration.dm new file mode 100644 index 0000000000..7aa2272fe9 --- /dev/null +++ b/code/_global_vars/configuration.dm @@ -0,0 +1,5 @@ +// See initialization order in /code/game/world.dm +// GLOBAL_REAL(config, /datum/controller/configuration) +GLOBAL_REAL(config, /datum/controller/configuration) = new + +GLOBAL_DATUM_INIT(revdata, /datum/getrev, new) diff --git a/code/_global_vars/sensitive.dm b/code/_global_vars/sensitive.dm deleted file mode 100644 index 8de09f4f3a..0000000000 --- a/code/_global_vars/sensitive.dm +++ /dev/null @@ -1,11 +0,0 @@ -// MySQL configuration -GLOBAL_REAL_VAR(sqladdress) = "localhost" -GLOBAL_REAL_VAR(sqlport) = "3306" -GLOBAL_REAL_VAR(sqldb) = "tgstation" -GLOBAL_REAL_VAR(sqllogin) = "root" -GLOBAL_REAL_VAR(sqlpass) = "" -// Feedback gathering sql connection -GLOBAL_REAL_VAR(sqlfdbkdb) = "test" -GLOBAL_REAL_VAR(sqlfdbklogin) = "root" -GLOBAL_REAL_VAR(sqlfdbkpass) = "" -GLOBAL_REAL_VAR(sqllogging) = 0 // Should we log deaths, population stats, etc.? diff --git a/code/_helpers/_lists.dm b/code/_helpers/_lists.dm index 00f1e9ba9c..e245198f81 100644 --- a/code/_helpers/_lists.dm +++ b/code/_helpers/_lists.dm @@ -15,6 +15,12 @@ * Misc */ +/// Returns the top (last) element from the list, does not remove it from the list. Stack functionality. +/proc/peek(list/target_list) + var/list_length = length(target_list) + if(list_length != 0) + return target_list[list_length] + //Returns a list in plain english as a string /proc/english_list(var/list/input, nothing_text = "nothing", and_text = " and ", comma_text = ", ", final_comma_text = ",") // this proc cannot be merged with counting_english_list to maintain compatibility diff --git a/code/_helpers/logging.dm b/code/_helpers/logging.dm index 57795108c7..d016b7111d 100644 --- a/code/_helpers/logging.dm +++ b/code/_helpers/logging.dm @@ -27,21 +27,21 @@ /proc/log_admin(text) admin_log.Add(text) - if (config.log_admin) + if (CONFIG_GET(flag/log_admin)) WRITE_LOG(diary, "ADMIN: [text]") /proc/log_adminpm(text, client/source, client/dest) admin_log.Add(text) - if (config.log_admin) + if (CONFIG_GET(flag/log_admin)) WRITE_LOG(diary, "ADMINPM: [key_name(source)]->[key_name(dest)]: [html_decode(text)]") /proc/log_pray(text, client/source) admin_log.Add(text) - if (config.log_admin) + if (CONFIG_GET(flag/log_admin)) WRITE_LOG(diary, "PRAY: [key_name(source)]: [text]") /proc/log_debug(text) - if (config.log_debug) + if (CONFIG_GET(flag/log_debug)) WRITE_LOG(debug_log, "DEBUG: [sanitize(text)]") for(var/client/C in GLOB.admins) @@ -51,25 +51,25 @@ html = span_filter_debuglogs("DEBUG: [text]")) /proc/log_game(text) - if (config.log_game) + if (CONFIG_GET(flag/log_game)) WRITE_LOG(diary, "GAME: [text]") /proc/log_vote(text) - if (config.log_vote) + if (CONFIG_GET(flag/log_vote)) WRITE_LOG(diary, "VOTE: [text]") /proc/log_access_in(client/new_client) - if (config.log_access) + if (CONFIG_GET(flag/log_access)) var/message = "[key_name(new_client)] - IP:[new_client.address] - CID:[new_client.computer_id] - BYOND v[new_client.byond_version]" WRITE_LOG(diary, "ACCESS IN: [message]") //VOREStation Edit /proc/log_access_out(mob/last_mob) - if (config.log_access) + if (CONFIG_GET(flag/log_access)) var/message = "[key_name(last_mob)] - IP:[last_mob.lastKnownIP] - CID:Logged Out - BYOND Logged Out" WRITE_LOG(diary, "ACCESS OUT: [message]") /proc/log_say(text, mob/speaker) - if (config.log_say) + if (CONFIG_GET(flag/log_say)) WRITE_LOG(diary, "SAY: [speaker.simple_info_line()]: [html_decode(text)]") //Log the message to in-game dialogue logs, as well. @@ -78,25 +78,25 @@ GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("SAY:") + " - " + span_green("[text]") /proc/log_ooc(text, client/user) - if (config.log_ooc) + if (CONFIG_GET(flag/log_ooc)) WRITE_LOG(diary, "OOC: [user.simple_info_line()]: [html_decode(text)]") GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[user]") + ") " + span_underline("OOC:") + " - " + span_blue(span_bold("[text]")) /proc/log_aooc(text, client/user) - if (config.log_ooc) + if (CONFIG_GET(flag/log_ooc)) WRITE_LOG(diary, "AOOC: [user.simple_info_line()]: [html_decode(text)]") GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[user]") + ") " + span_underline("AOOC:") + " - " + span_red(span_bold("[text]")) /proc/log_looc(text, client/user) - if (config.log_ooc) + if (CONFIG_GET(flag/log_ooc)) WRITE_LOG(diary, "LOOC: [user.simple_info_line()]: [html_decode(text)]") GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[user]") + ") " + span_underline("LOOC:") + " - " + span_orange(span_bold("[text]")) /proc/log_whisper(text, mob/speaker) - if (config.log_whisper) + if (CONFIG_GET(flag/log_whisper)) WRITE_LOG(diary, "WHISPER: [speaker.simple_info_line()]: [html_decode(text)]") if(speaker.client) @@ -104,7 +104,7 @@ GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("SAY:") + " - " + span_gray(span_italics("[text]")) /proc/log_emote(text, mob/speaker) - if (config.log_emote) + if (CONFIG_GET(flag/log_emote)) WRITE_LOG(diary, "EMOTE: [speaker.simple_info_line()]: [html_decode(text)]") if(speaker.client) @@ -112,38 +112,38 @@ GLOB.round_text_log += span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("EMOTE:") + " - " + span_pink("[text]") /proc/log_attack(attacker, defender, message) - if (config.log_attack) + if (CONFIG_GET(flag/log_attack)) WRITE_LOG(diary, "ATTACK: [attacker] against [defender]: [message]") /proc/log_adminsay(text, mob/speaker) - if (config.log_adminchat) + if (CONFIG_GET(flag/log_adminchat)) WRITE_LOG(diary, "ADMINSAY: [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_modsay(text, mob/speaker) - if (config.log_adminchat) + if (CONFIG_GET(flag/log_adminchat)) WRITE_LOG(diary, "MODSAY: [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_eventsay(text, mob/speaker) - if (config.log_adminchat) + if (CONFIG_GET(flag/log_adminchat)) WRITE_LOG(diary, "EVENTSAY: [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_ghostsay(text, mob/speaker) - if (config.log_say) + if (CONFIG_GET(flag/log_say)) WRITE_LOG(diary, "DEADCHAT: [speaker.simple_info_line()]: [html_decode(text)]") speaker.dialogue_log += span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("DEADSAY:") + " - " + span_green("[text]") GLOB.round_text_log += span_small(span_purple(span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("DEADSAY:") + " - [text]")) /proc/log_ghostemote(text, mob/speaker) - if (config.log_emote) + if (CONFIG_GET(flag/log_emote)) WRITE_LOG(diary, "DEADEMOTE: [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_adminwarn(text) - if (config.log_adminwarn) + if (CONFIG_GET(flag/log_adminwarn)) WRITE_LOG(diary, "ADMINWARN: [html_decode(text)]") /proc/log_pda(text, mob/speaker) - if (config.log_pda) + if (CONFIG_GET(flag/log_pda)) WRITE_LOG(diary, "PDA: [speaker.simple_info_line()]: [html_decode(text)]") speaker.dialogue_log += span_bold("([time_stamp()])") + " (" + span_bold("[speaker]/[speaker.client]") + ") " + span_underline("MSG:") + " - " + span_darkgreen("[text]") @@ -151,7 +151,7 @@ /proc/log_to_dd(text) to_world_log(text) //this comes before the config check because it can't possibly runtime - if(config.log_world_output) + if(CONFIG_GET(flag/log_world_output)) WRITE_LOG(diary, "DD_OUTPUT: [text]") /proc/log_error(text) diff --git a/code/_helpers/logging/debug.dm b/code/_helpers/logging/debug.dm new file mode 100644 index 0000000000..9a847ee61b --- /dev/null +++ b/code/_helpers/logging/debug.dm @@ -0,0 +1,11 @@ +/// Logging for config errors +/// Rarely gets called; just here in case the config breaks. +/proc/log_config(text, list/data) + var/entry = "CONFIG: " + + entry += text + entry += " | DATA: " + entry += data + + WRITE_LOG(diary, entry) + SEND_TEXT(world.log, text) diff --git a/code/_helpers/logging_vr.dm b/code/_helpers/logging_vr.dm index aa117125dc..b0bf8d07e7 100644 --- a/code/_helpers/logging_vr.dm +++ b/code/_helpers/logging_vr.dm @@ -1,11 +1,11 @@ /proc/log_nsay(text, inside, mob/speaker) - if (config.log_say) + if (CONFIG_GET(flag/log_say)) WRITE_LOG(diary, "NSAY (NIF:[inside]): [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_nme(text, inside, mob/speaker) - if (config.log_emote) + if (CONFIG_GET(flag/log_emote)) WRITE_LOG(diary, "NME (NIF:[inside]): [speaker.simple_info_line()]: [html_decode(text)]") /proc/log_subtle(text, mob/speaker) - if (config.log_emote) + if (CONFIG_GET(flag/log_emote)) WRITE_LOG(diary, "SUBTLE: [speaker.simple_info_line()]: [html_decode(text)]") diff --git a/code/_helpers/mobs.dm b/code/_helpers/mobs.dm index d4a29095b8..e78123fe64 100644 --- a/code/_helpers/mobs.dm +++ b/code/_helpers/mobs.dm @@ -317,7 +317,7 @@ Proc for attack log creation, because really why not cached_character_icons[cachekey] = . /proc/not_has_ooc_text(mob/user) - if (config.allow_Metadata && (!user.client?.prefs?.metadata || length(user.client.prefs.metadata) < 15)) + if (CONFIG_GET(flag/allow_metadata) && (!user.client?.prefs?.metadata || length(user.client.prefs.metadata) < 15)) to_chat(user, span_warning("Please set informative OOC notes related to RP/ERP preferences. Set them using the 'OOC Notes' button on the 'General' tab in character setup.")) return TRUE return FALSE diff --git a/code/_helpers/nameof.dm b/code/_helpers/nameof.dm new file mode 100644 index 0000000000..5a2fd60e71 --- /dev/null +++ b/code/_helpers/nameof.dm @@ -0,0 +1,11 @@ +/** + * NAMEOF: Compile time checked variable name to string conversion + * evaluates to a string equal to "X", but compile errors if X isn't a var on datum. + * datum may be null, but it does need to be a typed var. + **/ +#define NAMEOF(datum, X) (#X || ##datum.##X) + +/** + * NAMEOF that actually works in static definitions because src::type requires src to be defined + */ +#define NAMEOF_STATIC(datum, X) (nameof(type::##X)) diff --git a/code/_helpers/names.dm b/code/_helpers/names.dm index 12e6c46289..12d2c08e86 100644 --- a/code/_helpers/names.dm +++ b/code/_helpers/names.dm @@ -92,8 +92,8 @@ var/religion_name = null new_station_name += pick("13","XIII","Thirteen") - if (config && config.server_name) - world.name = "[config.server_name]: [name]" + if (config && CONFIG_GET(string/servername)) + world.name = "[CONFIG_GET(string/servername)]: [name]" else world.name = new_station_name @@ -104,8 +104,8 @@ var/religion_name = null using_map.station_name = name - if (config && config.server_name) - world.name = "[config.server_name]: [name]" + if (config && CONFIG_GET(string/servername)) + world.name = "[CONFIG_GET(string/servername)]: [name]" else world.name = name diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index 4d8968ad4e..520b98d39a 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -613,3 +613,10 @@ paper_text = replacetext(paper_text, "
", "\n") paper_text = strip_html_properly(paper_text) // Get rid of everything else entirely. return paper_text + +//json decode that will return null on parse error instead of runtiming. +/proc/safe_json_decode(data) + try + return json_decode(data) + catch + return null diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index c9dffc7c2b..0e0dd58295 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -1,11 +1,41 @@ /* * Holds procs designed to change one type of value, into another. * Contains: + * file2list + * type2top * hex2num & num2hex * file2list * angle2dir */ +//Splits the text of a file at seperator and returns them in a list. +//returns an empty list if the file doesn't exist +/world/proc/file2list(filename, seperator="\n", trim = TRUE) + if (trim) + return splittext(trim(file2text(filename)),seperator) + return splittext(file2text(filename),seperator) + +//returns a string the last bit of a type, without the preceeding '/' +/proc/type2top(the_type) + //handle the builtins manually + if(!ispath(the_type)) + return + switch(the_type) + if(/datum) + return "datum" + if(/atom) + return "atom" + if(/obj) + return "obj" + if(/mob) + return "mob" + if(/area) + return "area" + if(/turf) + return "turf" + else //regex everything else (works for /proc too) + return lowertext(replacetext("[the_type]", "[type2parent(the_type)]/", "")) + // Returns an integer given a hexadecimal number string as input. /proc/hex2num(hex) if (!istext(hex)) diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index c18a512db2..057f988dcb 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1359,9 +1359,6 @@ var/mob/dview/dview_mob = new #undef NOT_FLAG #undef HAS_FLAG -//datum may be null, but it does need to be a typed var -#define NAMEOF(datum, X) (#X || ##datum.##X) - #define VARSET_LIST_CALLBACK(target, var_name, var_value) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbackvarset), ##target, ##var_name, ##var_value) //dupe code because dm can't handle 3 level deep macros #define VARSET_CALLBACK(datum, var, var_value) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___callbackvarset), ##datum, NAMEOF(##datum, ##var), ##var_value) diff --git a/code/_helpers/unsorted_vr.dm b/code/_helpers/unsorted_vr.dm index 0890c1f9c6..88c6dba1b2 100644 --- a/code/_helpers/unsorted_vr.dm +++ b/code/_helpers/unsorted_vr.dm @@ -43,26 +43,26 @@ //Sender is optional /proc/admin_chat_message(var/message = "Debug Message", var/color = "#FFFFFF", var/sender) - if (!config.chat_webhook_url || !message) + if (!CONFIG_GET(string/chat_webhook_url) || !message) return spawn(0) var/query_string = "type=adminalert" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&msg=[url_encode(message)]" query_string += "&color=[url_encode(color)]" if(sender) query_string += "&from=[url_encode(sender)]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") /proc/admin_action_message(var/admin = "INVALID", var/user = "INVALID", var/action = "INVALID", var/reason = "INVALID", var/time = "INVALID") - if (!config.chat_webhook_url || !action) + if (!CONFIG_GET(string/chat_webhook_url) || !action) return spawn(0) var/query_string = "type=adminaction" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&admin=[url_encode(admin)]" query_string += "&user=[url_encode(user)]" query_string += "&action=[url_encode(action)]" query_string += "&reason=[url_encode(reason)]" query_string += "&time=[url_encode(time)]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 3562ed09a7..f321d231f3 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -158,7 +158,7 @@ next_click = max(world.time + timeout, next_click) /mob/proc/checkClickCooldown() - if(next_click > world.time && !config.no_click_cooldown) + if(next_click > world.time && !CONFIG_GET(flag/no_click_cooldown)) return FALSE return TRUE diff --git a/code/controllers/autotransfer.dm b/code/controllers/autotransfer.dm index d303142886..6bc2bd6daf 100644 --- a/code/controllers/autotransfer.dm +++ b/code/controllers/autotransfer.dm @@ -6,9 +6,9 @@ var/datum/controller/transfer_controller/transfer_controller var/shift_hard_end = 0 //VOREStation Edit var/shift_last_vote = 0 //VOREStation Edit /datum/controller/transfer_controller/New() - timerbuffer = config.vote_autotransfer_initial - shift_hard_end = config.vote_autotransfer_initial + (config.vote_autotransfer_interval * 0) //VOREStation Edit //Change this "1" to how many extend votes you want there to be. - shift_last_vote = shift_hard_end - config.vote_autotransfer_interval //VOREStation Edit + timerbuffer = CONFIG_GET(number/vote_autotransfer_initial) + shift_hard_end = CONFIG_GET(number/vote_autotransfer_initial) + (CONFIG_GET(number/vote_autotransfer_interval) * 0) //VOREStation Edit //Change this "1" to how many extend votes you want there to be. + shift_last_vote = shift_hard_end - CONFIG_GET(number/vote_autotransfer_interval) //VOREStation Edit START_PROCESSING(SSprocessing, src) /datum/controller/transfer_controller/Destroy() @@ -22,9 +22,9 @@ var/datum/controller/transfer_controller/transfer_controller to_world(span_world(span_notice("Warning: You have one hour left in the shift. Wrap up your scenes in the next 60 minutes before the transfer is called."))) //VOREStation Edit if (round_duration_in_ds >= shift_hard_end - 1 MINUTE) init_shift_change(null, 1) - shift_hard_end = timerbuffer + config.vote_autotransfer_interval //If shuttle somehow gets recalled, let's force it to call again next time a vote would occur. - timerbuffer = timerbuffer + config.vote_autotransfer_interval //Just to make sure a vote doesn't occur immediately afterwords. + shift_hard_end = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) //If shuttle somehow gets recalled, let's force it to call again next time a vote would occur. + timerbuffer = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) //Just to make sure a vote doesn't occur immediately afterwords. else if (round_duration_in_ds >= timerbuffer - 1 MINUTE) SSvote.start_vote(new /datum/vote/crew_transfer) //VOREStation Edit END - timerbuffer = timerbuffer + config.vote_autotransfer_interval + timerbuffer = timerbuffer + CONFIG_GET(number/vote_autotransfer_interval) diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm new file mode 100644 index 0000000000..b279bc52c9 --- /dev/null +++ b/code/controllers/configuration/config_entry.dm @@ -0,0 +1,300 @@ +/datum/config_entry + /// Read-only, this is determined by the last portion of the derived entry type + var/name + /// The configured value for this entry. This shouldn't be initialized in code, instead set default + var/config_entry_value + /// Read-only default value for this config entry, used for resetting value to defaults when necessary. This is what config_entry_value is initially set to + var/default + /// The file which this was loaded from, if any + var/resident_file + /// Set to TRUE if the default has been overridden by a config entry + var/modified = FALSE + /// The config name of a configuration type that depricates this, if it exists + var/deprecated_by + /// The /datum/config_entry type that supercedes this one + var/protection = NONE + /// Do not instantiate if type matches this + var/config_abstract_type = /datum/config_entry + /// Force validate and set on VV. VAS proccall guard will run regardless. + var/vv_VAS = TRUE + /// Controls if error is thrown when duplicate configuration values for this entry type are encountered + var/dupes_allowed = FALSE + /// Stores the original protection configuration, used for set_default() + var/default_protection + +/datum/config_entry/New() + if(type == config_abstract_type) + CRASH("Abstract config entry [type] instatiated!") + name = lowertext(type2top(type)) + default_protection = protection + set_default() + +/datum/config_entry/Destroy() + config.RemoveEntry(src) + return ..() + +/** + * Returns the value of the configuration datum to its default, used for resetting a config value. Note this also sets the protection back to default. + */ +/datum/config_entry/proc/set_default() + if ((protection & CONFIG_ENTRY_LOCKED) && IsAdminAdvancedProcCall()) + //log_admin_private("[key_name(usr)] attempted to reset locked config entry [type] to its default") + log_admin("[key_name(usr)] attempted to reset locked config entry [type] to its default") + return + if (islist(default)) + var/list/L = default + config_entry_value = L.Copy() + else + config_entry_value = default + protection = default_protection + resident_file = null + modified = FALSE + +/datum/config_entry/can_vv_get(var_name) + . = ..() + if(var_name == NAMEOF(src, config_entry_value) || var_name == NAMEOF(src, default)) + . &= !(protection & CONFIG_ENTRY_HIDDEN) + +/datum/config_entry/vv_edit_var(var_name, var_value) + var/static/list/banned_edits = list(NAMEOF_STATIC(src, name), NAMEOF_STATIC(src, vv_VAS), NAMEOF_STATIC(src, default), NAMEOF_STATIC(src, resident_file), NAMEOF_STATIC(src, protection), NAMEOF_STATIC(src, config_abstract_type), NAMEOF_STATIC(src, modified), NAMEOF_STATIC(src, dupes_allowed)) + if(var_name == NAMEOF(src, config_entry_value)) + if(protection & CONFIG_ENTRY_LOCKED) + return FALSE + if(vv_VAS) + . = ValidateAndSet("[var_value]") + if(.) + datum_flags |= DF_VAR_EDITED + return + else + return ..() + if(var_name in banned_edits) + return FALSE + return ..() + +/datum/config_entry/proc/VASProcCallGuard(str_val) + . = !((protection & CONFIG_ENTRY_LOCKED) && IsAdminAdvancedProcCall()) + if(!.) + //log_admin_private("[key_name(usr)] attempted to set locked config entry [type] to '[str_val]'") + log_admin("[key_name(usr)] attempted to set locked config entry [type] to '[str_val]'") + +/datum/config_entry/proc/ValidateAndSet(str_val) + VASProcCallGuard(str_val) + CRASH("Invalid config entry type!") + +/datum/config_entry/proc/ValidateListEntry(key_name, key_value) + return TRUE + +/datum/config_entry/proc/DeprecationUpdate(value) + return + +/datum/config_entry/string + default = "" + config_abstract_type = /datum/config_entry/string + var/auto_trim = TRUE + /// whether the string will be lowercased on ValidateAndSet or not. + var/lowercase = FALSE + +/datum/config_entry/string/vv_edit_var(var_name, var_value) + return var_name != NAMEOF(src, auto_trim) && ..() + +/datum/config_entry/string/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + config_entry_value = auto_trim ? trim(str_val) : str_val + if(lowercase) + config_entry_value = lowertext(config_entry_value) + return TRUE + +/datum/config_entry/number + default = 0 + config_abstract_type = /datum/config_entry/number + var/integer = TRUE + var/max_val = INFINITY + var/min_val = -INFINITY + +/datum/config_entry/number/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + var/temp = text2num(trim(str_val)) + if(!isnull(temp)) + config_entry_value = clamp(integer ? round(temp) : temp, min_val, max_val) + if(config_entry_value != temp && !(datum_flags & DF_VAR_EDITED)) + log_config("Changing [name] from [temp] to [config_entry_value]!") + return TRUE + return FALSE + +/datum/config_entry/number/vv_edit_var(var_name, var_value) + var/static/list/banned_edits = list(NAMEOF_STATIC(src, max_val), NAMEOF_STATIC(src, min_val), NAMEOF_STATIC(src, integer)) + return !(var_name in banned_edits) && ..() + +/datum/config_entry/flag + default = FALSE + config_abstract_type = /datum/config_entry/flag + +/datum/config_entry/flag/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + config_entry_value = text2num(trim(str_val)) != 0 + return TRUE + +/// List config entry, used for configuring a list of strings +/datum/config_entry/str_list + config_abstract_type = /datum/config_entry/str_list + default = list() + dupes_allowed = TRUE + /// whether the string elements will be lowercased on ValidateAndSet or not. + var/lowercase = FALSE + +/datum/config_entry/str_list/ValidateAndSet(str_val) + if (!VASProcCallGuard(str_val)) + return FALSE + str_val = trim(str_val) + if (str_val != "") + config_entry_value += lowercase ? lowertext(str_val) : str_val + return TRUE + +/datum/config_entry/number_list + config_abstract_type = /datum/config_entry/number_list + default = list() + +/datum/config_entry/number_list/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + str_val = trim(str_val) + var/list/new_list = list() + var/list/values = splittext(str_val," ") + for(var/I in values) + var/temp = text2num(I) + if(isnull(temp)) + return FALSE + new_list += temp + if(!new_list.len) + return FALSE + config_entry_value = new_list + return TRUE + +/datum/config_entry/keyed_list + config_abstract_type = /datum/config_entry/keyed_list + default = list() + dupes_allowed = TRUE + vv_VAS = FALSE //VAS will not allow things like deleting from lists, it'll just bug horribly. + var/key_mode + var/value_mode + var/splitter = " " + /// whether the key names will be lowercased on ValidateAndSet or not. + var/lowercase_key = TRUE + +/datum/config_entry/keyed_list/New() + . = ..() + if(isnull(key_mode) || isnull(value_mode)) + CRASH("Keyed list of type [type] created with null key or value mode!") + +/datum/config_entry/keyed_list/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + + str_val = trim(str_val) + + var/list/new_entry = parse_key_and_value(str_val) + + var/new_key = new_entry["config_key"] + var/new_value = new_entry["config_value"] + + if(!isnull(new_value) && !isnull(new_key) && ValidateListEntry(new_key, new_value)) + config_entry_value[new_key] = new_value + return TRUE + return FALSE + +/datum/config_entry/keyed_list/proc/parse_key_and_value(option_string) + // Blank or null option string? Bad mojo! + if(!option_string) + log_config("ERROR: Keyed list config tried to parse with no key or value data.") + return null + + var/list/config_entry_words = splittext(option_string, splitter) + var/config_value + var/config_key + var/is_ambiguous = FALSE + + // If this config entry's value mode is flag, the value can either be TRUE or FALSE. + // However, the config supports implicitly setting a config entry to TRUE by omitting the value. + // This value mode should also support config overrides disabling it too. + // The following code supports config entries as such: + // Implicitly enable the config entry: CONFIG_ENTRY config key goes here + // Explicitly enable the config entry: CONFIG_ENTRY config key goes here 1 + // Explicitly disable the config entry: CONFIG_ENTRY config key goes here 0 + if(value_mode == VALUE_MODE_FLAG) + var/value = peek(config_entry_words) + config_value = TRUE + + if(value == "0") + config_key = jointext(config_entry_words, splitter, length(config_entry_words) - 1) + config_value = FALSE + is_ambiguous = (length(config_entry_words) > 2) + else if(value == "1") + config_key = jointext(config_entry_words, splitter, length(config_entry_words) - 1) + is_ambiguous = (length(config_entry_words) > 2) + else + config_key = option_string + is_ambiguous = (length(config_entry_words) > 1) + // Else it has to be a key value pair and we parse it under that assumption. + else + // If config_entry_words only has 1 or 0 words in it and isn't value_mode == VALUE_MODE_FLAG then it's an invalid config entry. + if(length(config_entry_words) <= 1) + log_config("ERROR: Could not parse value from config entry string: [option_string]") + return null + + config_value = pop(config_entry_words) + config_key = jointext(config_entry_words, splitter) + + if(lowercase_key) + config_key = lowertext(config_key) + + is_ambiguous = (length(config_entry_words) > 2) + + config_key = validate_config_key(config_key) + config_value = validate_config_value(config_value) + + // If there are multiple splitters, it's definitely ambiguous and we'll warn about how we parsed it. Helps with debugging config issues. + if(is_ambiguous) + log_config("WARNING: Multiple splitter characters (\"[splitter]\") found. Using \"[config_key]\" as config key and \"[config_value]\" as config value.") + + return list("config_key" = config_key, "config_value" = config_value) + +/// Takes a given config key and validates it. If successful, returns the formatted key. If unsuccessful, returns null. +/datum/config_entry/keyed_list/proc/validate_config_key(key) + switch(key_mode) + if(KEY_MODE_TEXT) + return key + if(KEY_MODE_TYPE) + if(ispath(key)) + return key + + var/key_path = text2path(key) + if(isnull(key_path)) + log_config("ERROR: Invalid KEY_MODE_TYPE typepath. Is not a valid typepath: [key]") + return + + return key_path + + +/// Takes a given config value and validates it. If successful, returns the formatted key. If unsuccessful, returns null. +/datum/config_entry/keyed_list/proc/validate_config_value(value) + switch(value_mode) + if(VALUE_MODE_FLAG) + return value + if(VALUE_MODE_NUM) + if(isnum(value)) + return value + + var/value_num = text2num(value) + if(isnull(value_num)) + log_config("ERROR: Invalid VALUE_MODE_NUM number. Could not parse a valid number: [value]") + return + + return value_num + if(VALUE_MODE_TEXT) + return value + +/datum/config_entry/keyed_list/vv_edit_var(var_name, var_value) + return var_name != NAMEOF(src, splitter) && ..() diff --git a/code/controllers/configuration/configuration.dm b/code/controllers/configuration/configuration.dm new file mode 100644 index 0000000000..1cba676a0c --- /dev/null +++ b/code/controllers/configuration/configuration.dm @@ -0,0 +1,536 @@ +/datum/controller/configuration + name = "Configuration" + + var/directory = "config" + + var/warned_deprecated_configs = FALSE + var/hiding_entries_by_type = TRUE //Set for readability, admins can set this to FALSE if they want to debug it + var/list/entries + var/list/entries_by_type + + //var/list/maplist + //var/datum/map_config/defaultmap + + var/list/modes // allowed modes + var/list/gamemode_cache + var/list/votable_modes // votable modes + var/list/mode_names + var/list/mode_reports + var/list/mode_false_report_weight + + var/motd + var/policy + + /// If the configuration is loaded + var/loaded = FALSE + + /// A regex that matches words blocked IC + var/static/regex/ic_filter_regex + + /// A regex that matches words blocked OOC + var/static/regex/ooc_filter_regex + + /// A regex that matches words blocked IC, but not in PDAs + var/static/regex/ic_outside_pda_filter_regex + + /// A regex that matches words soft blocked IC + var/static/regex/soft_ic_filter_regex + + /// A regex that matches words soft blocked OOC + var/static/regex/soft_ooc_filter_regex + + /// A regex that matches words soft blocked IC, but not in PDAs + var/static/regex/soft_ic_outside_pda_filter_regex + + /// An assoc list of blocked IC words to their reasons + var/static/list/ic_filter_reasons + + /// An assoc list of words that are blocked IC, but not in PDAs, to their reasons + var/static/list/ic_outside_pda_filter_reasons + + /// An assoc list of words that are blocked both IC and OOC to their reasons + var/static/list/shared_filter_reasons + + /// An assoc list of soft blocked IC words to their reasons + var/static/list/soft_ic_filter_reasons + + /// An assoc list of words that are soft blocked IC, but not in PDAs, to their reasons + var/static/list/soft_ic_outside_pda_filter_reasons + + /// An assoc list of words that are soft blocked both IC and OOC to their reasons + var/static/list/soft_shared_filter_reasons + + /// A list of configuration errors that occurred during load + var/static/list/configuration_errors + +/datum/controller/configuration/proc/admin_reload() + if(IsAdminAdvancedProcCall()) + return + log_admin("[key_name_admin(usr)] has forcefully reloaded the configuration from disk.") + message_admins("[key_name_admin(usr)] has forcefully reloaded the configuration from disk.") + full_wipe() + Load(world.params[OVERRIDE_CONFIG_DIRECTORY_PARAMETER]) + +/datum/controller/configuration/proc/Load(_directory) + if(IsAdminAdvancedProcCall()) //If admin proccall is detected down the line it will horribly break everything. + return + if(_directory) + directory = _directory + if(entries) + CRASH("/datum/controller/configuration/Load() called more than once!") + configuration_errors ||= list() + InitEntries() + if(fexists("[directory]/config.txt") && LoadEntries("config.txt") <= 1) + var/list/legacy_configs = list("game_options.txt", "dbconfig.txt", "comms.txt") + for(var/I in legacy_configs) + if(fexists("[directory]/[I]")) + log_config("No $include directives found in config.txt! Loading legacy [legacy_configs.Join("/")] files...") + for(var/J in legacy_configs) + LoadEntries(J) + break + if (fexists("[directory]/dev_overrides.txt")) + LoadEntries("dev_overrides.txt") + if (fexists("[directory]/ezdb.txt")) + LoadEntries("ezdb.txt") + //loadmaplist(CONFIG_MAPS_FILE) + LoadMOTD() + LoadPolicy() + LoadChatFilter() + LoadModes() + /* + if(CONFIG_GET(flag/load_jobs_from_txt)) + validate_job_config() + if(SSjob.initialized) // in case we're reloading from disk after initialization, wanna make sure the changes update in the ongoing shift + SSjob.load_jobs_from_config() + */ + + if(CONFIG_GET(flag/usewhitelist)) + load_whitelist() + + loaded = TRUE + + if (Master) + Master.OnConfigLoad() + process_config_errors() + +/datum/controller/configuration/proc/full_wipe() + if(IsAdminAdvancedProcCall()) + return + entries_by_type.Cut() + QDEL_LIST_ASSOC_VAL(entries) + entries = null + //QDEL_LIST_ASSOC_VAL(maplist) + //maplist = null + //QDEL_NULL(defaultmap) + configuration_errors?.Cut() + +/datum/controller/configuration/Destroy() + full_wipe() + config = null + + return ..() + +/datum/controller/configuration/proc/log_config_error(error_message) + configuration_errors += error_message + log_config(error_message) + +/datum/controller/configuration/proc/process_config_errors() + if(!CONFIG_GET(flag/config_errors_runtime)) + return + for(var/error_message in configuration_errors) + stack_trace(error_message) + +/datum/controller/configuration/proc/InitEntries() + var/list/_entries = list() + entries = _entries + var/list/_entries_by_type = list() + entries_by_type = _entries_by_type + + for(var/I in typesof(/datum/config_entry)) //typesof is faster in this case + var/datum/config_entry/E = I + if(initial(E.config_abstract_type) == I) + continue + E = new I + var/esname = E.name + var/datum/config_entry/test = _entries[esname] + if(test) + log_config_error("Error: [test.type] has the same name as [E.type]: [esname]! Not initializing [E.type]!") + qdel(E) + continue + _entries[esname] = E + _entries_by_type[I] = E + +/datum/controller/configuration/proc/RemoveEntry(datum/config_entry/CE) + entries -= CE.name + entries_by_type -= CE.type + +/datum/controller/configuration/proc/LoadEntries(filename, list/stack = list()) + if(IsAdminAdvancedProcCall()) + return + + var/filename_to_test = world.system_type == MS_WINDOWS ? lowertext(filename) : filename + if(filename_to_test in stack) + log_config_error("Warning: Config recursion detected ([english_list(stack)]), breaking!") + return + stack = stack + filename_to_test + + log_config("Loading config file [filename]...") + var/list/lines = world.file2list("[directory]/[filename]") + var/list/_entries = entries + for(var/L in lines) + L = trim(L) + if(!L) + continue + + var/firstchar = L[1] + if(firstchar == "#") + continue + + var/lockthis = firstchar == "@" + if(lockthis) + L = copytext(L, length(firstchar) + 1) + + var/pos = findtext(L, " ") + var/entry = null + var/value = null + + if(pos) + entry = lowertext(copytext(L, 1, pos)) + value = copytext(L, pos + length(L[pos])) + else + entry = lowertext(L) + + if(!entry) + continue + + if(entry == "$include") + if(!value) + log_config_error("Warning: Invalid $include directive: [value]") + else + LoadEntries(value, stack) + ++. + continue + + // Reset directive, used for setting a config value back to defaults. Useful for string list config types + if (entry == "$reset") + var/datum/config_entry/resetee = _entries[lowertext(value)] + if (!value || !resetee) + log_config_error("Warning: invalid $reset directive: [value]") + continue + resetee.set_default() + log_config("Reset configured value for [value] to original defaults") + continue + + var/datum/config_entry/E = _entries[entry] + if(!E) + log_config("Unknown setting in configuration: '[entry]'") + continue + + if(lockthis) + E.protection |= CONFIG_ENTRY_LOCKED + + if(E.deprecated_by) + var/datum/config_entry/new_ver = entries_by_type[E.deprecated_by] + var/new_value = E.DeprecationUpdate(value) + var/good_update = istext(new_value) + log_config("Entry [entry] is deprecated and will be removed soon. Migrate to [new_ver.name]![good_update ? " Suggested new value is: [new_value]" : ""]") + if(!warned_deprecated_configs) + DelayedMessageAdmins("This server is using deprecated configuration settings. Please check the logs and update accordingly.") + warned_deprecated_configs = TRUE + if(good_update) + value = new_value + E = new_ver + else + warning("[new_ver.type] is deprecated but gave no proper return for DeprecationUpdate()") + + var/validated = E.ValidateAndSet(value) + if(!validated) + var/log_message = "Failed to validate setting \"[value]\" for [entry]" + log_config(log_message) + stack_trace(log_message) + else + if(E.modified && !E.dupes_allowed && E.resident_file == filename) + log_config_error("Duplicate setting for [entry] ([value], [E.resident_file]) detected! Using latest.") + + E.resident_file = filename + + if(validated) + E.modified = TRUE + + ++. + +/datum/controller/configuration/can_vv_get(var_name) + return (var_name != NAMEOF(src, entries_by_type) || !hiding_entries_by_type) && ..() + +/datum/controller/configuration/vv_edit_var(var_name, var_value) + var/list/banned_edits = list(NAMEOF(src, entries_by_type), NAMEOF(src, entries), NAMEOF(src, directory)) + return !(var_name in banned_edits) && ..() + +/datum/controller/configuration/stat_entry(msg) + msg = "Edit" + return msg + +/datum/controller/configuration/proc/Get(entry_type) + var/datum/config_entry/E = entry_type + var/entry_is_abstract = initial(E.config_abstract_type) == entry_type + if(entry_is_abstract) + CRASH("Tried to retrieve an abstract config_entry: [entry_type]") + E = entries_by_type[entry_type] + if(!E) + CRASH("Missing config entry for [entry_type]!") + if((E.protection & CONFIG_ENTRY_HIDDEN) && IsAdminAdvancedProcCall() && GLOB.LastAdminCalledProc == "Get" && GLOB.LastAdminCalledTargetRef == "[REF(src)]") + //log_admin_private("Config access of [entry_type] attempted by [key_name(usr)]") + log_admin("Config access of [entry_type] attempted by [key_name(usr)]") + return + return E.config_entry_value + +/datum/controller/configuration/proc/Set(entry_type, new_val) + var/datum/config_entry/E = entry_type + var/entry_is_abstract = initial(E.config_abstract_type) == entry_type + if(entry_is_abstract) + CRASH("Tried to set an abstract config_entry: [entry_type]") + E = entries_by_type[entry_type] + if(!E) + CRASH("Missing config entry for [entry_type]!") + if((E.protection & CONFIG_ENTRY_LOCKED) && IsAdminAdvancedProcCall() && GLOB.LastAdminCalledProc == "Set" && GLOB.LastAdminCalledTargetRef == "[REF(src)]") + //log_admin_private("Config rewrite of [entry_type] to [new_val] attempted by [key_name(usr)]") + log_admin("Config rewrite of [entry_type] to [new_val] attempted by [key_name(usr)]") + return + return E.ValidateAndSet("[new_val]") + +/datum/controller/configuration/proc/LoadMOTD() + var/list/motd_contents = list() + + var/list/motd_list = CONFIG_GET(str_list/motd) + if (motd_list.len == 0 && fexists("[directory]/motd.txt")) + motd_list = list("motd.txt") + + for (var/motd_file in motd_list) + if (fexists("[directory]/[motd_file]")) + motd_contents += file2text("[directory]/[motd_file]") + else + log_config("MOTD file [motd_file] didn't exist") + DelayedMessageAdmins("MOTD file [motd_file] didn't exist") + + motd = motd_contents.Join("\n") + + var/tm_info = GLOB.revdata.GetTestMergeInfo() + if(motd || tm_info) + motd = motd ? "[motd]
[tm_info]" : tm_info + +/* +Policy file should be a json file with a single object. +Value is raw html. + +Possible keywords : +Job titles / Assigned roles (ghost spawners for example) : Assistant , Captain , Ash Walker +Mob types : /mob/living/basic/carp +Antagonist types : /datum/antagonist/highlander +Species types : /datum/species/lizard +special keywords defined in _DEFINES/admin.dm + +Example config: +{ + JOB_ASSISTANT : "Don't kill everyone", + "/datum/antagonist/highlander" : "Kill everyone", + "Ash Walker" : "Kill all spacemans" +} + +*/ +/datum/controller/configuration/proc/LoadPolicy() + policy = list() + var/rawpolicy = file2text("[directory]/policy.json") + if(rawpolicy) + var/parsed = safe_json_decode(rawpolicy) + if(!parsed) + log_config("JSON parsing failure for policy.json") + DelayedMessageAdmins("JSON parsing failure for policy.json") + else + policy = parsed + +/* +/datum/controller/configuration/proc/loadmaplist(filename) + log_config("Loading config file [filename]...") + filename = "[directory]/[filename]" + var/list/Lines = world.file2list(filename) + + var/datum/map_config/currentmap = null + for(var/t in Lines) + if(!t) + continue + + t = trim(t) + if(length(t) == 0) + continue + else if(t[1] == "#") + continue + + var/pos = findtext(t, " ") + var/command = null + var/data = null + + if(pos) + command = lowertext(copytext(t, 1, pos)) + data = copytext(t, pos + length(t[pos])) + else + command = lowertext(t) + + if(!command) + continue + + if (!currentmap && command != "map") + continue + + switch (command) + if ("map") + currentmap = load_map_config(data, MAP_DIRECTORY_MAPS) + if(currentmap.defaulted) + var/error_message = "Failed to load map config for [data]!" + log_config(error_message) + log_mapping(error_message, TRUE) + currentmap = null + if ("minplayers","minplayer") + currentmap.config_min_users = text2num(data) + if ("maxplayers","maxplayer") + currentmap.config_max_users = text2num(data) + if ("weight","voteweight") + currentmap.voteweight = text2num(data) + if ("default","defaultmap") + defaultmap = currentmap + if ("votable") + currentmap.votable = TRUE + if ("endmap") + LAZYINITLIST(maplist) + maplist[currentmap.map_name] = currentmap + currentmap = null + if ("disabled") + currentmap = null + else + log_config("Unknown command in map vote config: '[command]'") +*/ + +/datum/controller/configuration/proc/LoadChatFilter() + if(!fexists("[directory]/word_filter.toml")) + load_legacy_chat_filter() + return + + log_config("Loading config file word_filter.toml...") + var/list/result = rustg_raw_read_toml_file("[directory]/word_filter.toml") + if(!result["success"]) + var/message = "The word filter is not configured correctly! [result["content"]]" + log_config(message) + DelayedMessageAdmins(message) + return + var/list/word_filter = json_decode(result["content"]) + + ic_filter_reasons = try_extract_from_word_filter(word_filter, "ic") + ic_outside_pda_filter_reasons = try_extract_from_word_filter(word_filter, "ic_outside_pda") + shared_filter_reasons = try_extract_from_word_filter(word_filter, "shared") + soft_ic_filter_reasons = try_extract_from_word_filter(word_filter, "soft_ic") + soft_ic_outside_pda_filter_reasons = try_extract_from_word_filter(word_filter, "soft_ic_outside_pda") + soft_shared_filter_reasons = try_extract_from_word_filter(word_filter, "soft_shared") + + update_chat_filter_regexes() + +/datum/controller/configuration/proc/load_legacy_chat_filter() + if (!fexists("[directory]/in_character_filter.txt")) + return + + log_config("Loading config file in_character_filter.txt...") + + ic_filter_reasons = list() + ic_outside_pda_filter_reasons = list() + shared_filter_reasons = list() + soft_ic_filter_reasons = list() + soft_ic_outside_pda_filter_reasons = list() + soft_shared_filter_reasons = list() + + for (var/line in world.file2list("[directory]/in_character_filter.txt")) + if (!line) + continue + if (findtextEx(line, "#", 1, 2)) + continue + // The older filter didn't apply to PDA + ic_outside_pda_filter_reasons[line] = "No reason available" + + update_chat_filter_regexes() + +/// Will update the internal regexes of the chat filter based on the filter reasons +/datum/controller/configuration/proc/update_chat_filter_regexes() + ic_filter_regex = compile_filter_regex(ic_filter_reasons + ic_outside_pda_filter_reasons + shared_filter_reasons) + ic_outside_pda_filter_regex = compile_filter_regex(ic_filter_reasons + shared_filter_reasons) + ooc_filter_regex = compile_filter_regex(shared_filter_reasons) + soft_ic_filter_regex = compile_filter_regex(soft_ic_filter_reasons + soft_ic_outside_pda_filter_reasons + soft_shared_filter_reasons) + soft_ic_outside_pda_filter_regex = compile_filter_regex(soft_ic_filter_reasons + soft_shared_filter_reasons) + soft_ooc_filter_regex = compile_filter_regex(soft_shared_filter_reasons) + +/datum/controller/configuration/proc/try_extract_from_word_filter(list/word_filter, key) + var/list/banned_words = word_filter[key] + + if (isnull(banned_words)) + return list() + else if (!islist(banned_words)) + var/message = "The word filter configuration's '[key]' key was invalid, contact someone with configuration access to make sure it's setup properly." + log_config(message) + DelayedMessageAdmins(message) + return list() + + var/list/formatted_banned_words = list() + + for (var/banned_word in banned_words) + formatted_banned_words[lowertext(banned_word)] = banned_words[banned_word] + return formatted_banned_words + +/datum/controller/configuration/proc/compile_filter_regex(list/banned_words) + if (isnull(banned_words) || banned_words.len == 0) + return null + + var/static/regex/should_join_on_word_bounds = regex(@"^\w+$") + + // Stuff like emoticons needs another split, since there's no way to get ":)" on a word bound. + // Furthermore, normal words need to be on word bounds, so "(adminhelp)" gets filtered. + var/list/to_join_on_whitespace_splits = list() + var/list/to_join_on_word_bounds = list() + + for (var/banned_word in banned_words) + if (findtext(banned_word, should_join_on_word_bounds)) + to_join_on_word_bounds += REGEX_QUOTE(banned_word) + else + to_join_on_whitespace_splits += REGEX_QUOTE(banned_word) + + // We don't want a whitespace_split part if there's no stuff that requires it + var/whitespace_split = to_join_on_whitespace_splits.len > 0 ? @"(?:(?:^|\s+)(" + jointext(to_join_on_whitespace_splits, "|") + @")(?:$|\s+))" : "" + var/word_bounds = @"(\b(" + jointext(to_join_on_word_bounds, "|") + @")\b)" + var/regex_filter = whitespace_split != "" ? "([whitespace_split]|[word_bounds])" : word_bounds + return regex(regex_filter, "i") + +/* +/// Check to ensure that the jobconfig is valid/in-date. +/datum/controller/configuration/proc/validate_job_config() + var/config_toml = "[directory]/jobconfig.toml" + var/config_txt = "[directory]/jobs.txt" + var/message = "Notify Server Operators: " + log_config("Validating config file jobconfig.toml...") + + if(!fexists(file(config_toml))) + SSjob.legacy_mode = TRUE + message += "jobconfig.toml not found, falling back to legacy mode (using jobs.txt). To surpress this warning, generate a jobconfig.toml by running the verb 'Generate Job Configuration' in the Server tab.\n\ + From there, you can then add it to the /config folder of your server to have it take effect for future rounds." + + if(!fexists(file(config_txt))) + message += "\n\nFailed to set up legacy mode, jobs.txt not found! Codebase defaults will be used. If you do not wish to use this system, please disable it by commenting out the LOAD_JOBS_FROM_TXT config flag." + + log_config(message) + DelayedMessageAdmins(span_notice(message)) + return + + var/list/result = rustg_raw_read_toml_file(config_toml) + if(!result["success"]) + message += "The job config (jobconfig.toml) is not configured correctly! [result["content"]]" + log_config(message) + DelayedMessageAdmins(span_notice(message)) +*/ + +//Message admins when you can. +/datum/controller/configuration/proc/DelayedMessageAdmins(text) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(message_admins), text), 0) diff --git a/code/controllers/configuration/entries/dbconfig.dm b/code/controllers/configuration/entries/dbconfig.dm new file mode 100644 index 0000000000..d14ca42e68 --- /dev/null +++ b/code/controllers/configuration/entries/dbconfig.dm @@ -0,0 +1,58 @@ +/datum/config_entry/flag/sql_enabled // for sql switching + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/string/address + default = "localhost" + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/number/port + default = 3306 + min_val = 0 + max_val = 65535 + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/string/feedback_database + default = "test" + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/string/feedback_login + default = "root" + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/string/feedback_password + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/number/async_query_timeout + default = 10 + min_val = 0 + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/number/blocking_query_timeout + default = 5 + min_val = 0 + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/number/pooling_min_sql_connections + default = 1 + min_val = 1 + +/datum/config_entry/number/pooling_max_sql_connections + default = 25 + min_val = 1 + +/datum/config_entry/number/max_concurrent_queries + default = 25 + min_val = 1 + +/datum/config_entry/number/max_concurrent_queries/ValidateAndSet(str_val) + . = ..() + //if (.) TODO: ENABLE THIS IN FUTURE DB PRs + //SSdbcore.max_concurrent_queries = config_entry_value TODO: ENABLE THIS IN FUTURE DB PRs + +/// The exe for mariadbd.exe. +/// Shouldn't really be set on production servers, primarily for EZDB. +/datum/config_entry/string/db_daemon + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/flag/enable_stat_tracking + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm new file mode 100644 index 0000000000..867460f861 --- /dev/null +++ b/code/controllers/configuration/entries/game_options.dm @@ -0,0 +1,102 @@ +/datum/config_entry/number/health_threshold_softcrit + default = 0 + +/datum/config_entry/number/health_threshold_crit + default = 0 + +/datum/config_entry/number/health_threshold_dead + default = -100 + +/datum/config_entry/flag/bones_can_break + +/datum/config_entry/flag/limbs_can_break + +/datum/config_entry/number/organ_health_multiplier + default = 1 + +/datum/config_entry/number/organ_regeneration_multiplier + default = 1 + +// FIXME: Unused +///datum/config_entry/flag/revival_pod_plants +// default = TRUE + +/datum/config_entry/flag/revival_cloning + default = TRUE + +/datum/config_entry/number/revival_brain_life + default = -1 + +/// Used for modifying movement speed for mobs. +/// Universal modifiers +/datum/config_entry/number/run_speed + default = 0 + +/datum/config_entry/number/walk_speed + default = 0 + +///Mob specific modifiers. NOTE: These will affect different mob types in different ways +/datum/config_entry/number/human_delay + default = 0 + +/datum/config_entry/number/robot_delay + default = 0 + +// FIXME: Unused +///datum/config_entry/number/monkey_delay +// default = 0 + +// FIXME: Unused +///datum/config_entry/number/alien_delay +// default = 0 + +// FIXME: Unused +//datum/config_entry/number/slime_delay +// default = 0 + +/datum/config_entry/number/animal_delay + default = 0 + +/datum/config_entry/number/footstep_volume + default = 0 + +/datum/config_entry/flag/use_loyalty_implants + +/datum/config_entry/flag/show_human_death_message + default = TRUE + +/datum/config_entry/string/alert_desc_green + default = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." + +/datum/config_entry/string/alert_desc_yellow_upto + default = "A minor security emergency has developed. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + +/datum/config_entry/string/alert_desc_yellow_downto + default = "Code yellow procedures are now in effect. Security personnel are to report to their supervisor for orders and may have weapons visible on their person. Privacy laws are still enforced." + +/datum/config_entry/string/alert_desc_violet_upto + default = "A major medical emergency has developed. Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey all relevant instructions from medical staff." + +/datum/config_entry/string/alert_desc_violet_downto + default = "Code violet procedures are now in effect; Medical personnel are required to report to their supervisor for orders, and non-medical personnel are required to obey relevant instructions from medical staff." + +/datum/config_entry/string/alert_desc_orange_upto + default = "A major engineering emergency has developed. Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + +/datum/config_entry/string/alert_desc_orange_downto + default = "Code orange procedures are now in effect; Engineering personnel are required to report to their supervisor for orders, and non-engineering personnel are required to evacuate any affected areas and obey relevant instructions from engineering staff." + +/datum/config_entry/string/alert_desc_blue_upto + default = "A major security emergency has developed. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + +/datum/config_entry/string/alert_desc_blue_downto + default = "Code blue procedures are now in effect. Security personnel are to report to their supervisor for orders, are permitted to search staff and facilities, and may have weapons visible on their person." + +/datum/config_entry/string/alert_desc_red_upto + default = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised." + +/datum/config_entry/string/alert_desc_red_downto + default = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised." + +/datum/config_entry/string/alert_desc_delta + default = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill." diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm new file mode 100644 index 0000000000..70b568bb76 --- /dev/null +++ b/code/controllers/configuration/entries/general.dm @@ -0,0 +1,696 @@ +/// server name (the name of the game window) +/datum/config_entry/string/servername + +/// generate numeric suffix based on server port +/datum/config_entry/flag/server_suffix + +/// log messages sent in OOC +/datum/config_entry/flag/log_ooc + +/// log login/logout +/datum/config_entry/flag/log_access + +/// log client say +/datum/config_entry/flag/log_say + +/// log admin actions +/datum/config_entry/flag/log_admin + protection = CONFIG_ENTRY_LOCKED + +/// log debug output +/datum/config_entry/flag/log_debug + default = TRUE + +/// log game events +/datum/config_entry/flag/log_game + +/// log voting +/datum/config_entry/flag/log_vote + +/// log client whisper +/datum/config_entry/flag/log_whisper + +/// log emotes +/datum/config_entry/flag/log_emote + +/// log attack messages +/datum/config_entry/flag/log_attack + +/// log admin chat messages +/datum/config_entry/flag/log_adminchat + +/// log warnings admins get about bomb construction and such +/datum/config_entry/flag/log_adminwarn + +/// log pda messages +/datum/config_entry/flag/log_pda + +/// logs all links clicked in-game. Could be used for debugging and tracking down exploits +/datum/config_entry/flag/log_hrefs + +/// logs world.log to a file +/datum/config_entry/flag/log_runtime + +/// logs sql stuff +/datum/config_entry/flag/log_sql + +/// log to_world_log(messages) +/datum/config_entry/flag/log_world_output + +/// logs graffiti +/datum/config_entry/flag/log_graffiti + +// FIXME: Unused +///datum/config_entry/string/nudge_script_path // where the nudge.py script is located +// default = "nudge.py" + +/// allows admins with relevant permissions to have their own ooc colour +/datum/config_entry/flag/allow_admin_ooccolor + +/// allow votes to restart +/datum/config_entry/flag/allow_vote_restart + +/datum/config_entry/flag/ert_admin_call_only + +// allow votes to change mode +/datum/config_entry/flag/allow_vote_mode + +/// allows admin jumping +/datum/config_entry/flag/allow_admin_jump + default = TRUE + +/// allows admin item spawning +/datum/config_entry/flag/allow_admin_spawning + default = TRUE + +/// allows admin revives +/datum/config_entry/flag/allow_admin_rev + default = TRUE + +/// pregame time in seconds +/datum/config_entry/number/pregame_time + default = 180 + +/// minimum time between voting sessions (deciseconds, 10 minute default) +/datum/config_entry/number/vote_delay + default = 6000 + integer = FALSE + min_val = 0 + +/// length of voting period (deciseconds, default 1 minute) +/datum/config_entry/number/vote_period + default = 600 + integer = FALSE + min_val = 0 + +/// Length of time before the first autotransfer vote is called +/datum/config_entry/number/vote_autotransfer_initial + default = 108000 + min_val = 0 + +/// length of time before next sequential autotransfer vote +/datum/config_entry/number/vote_autotransfer_interval + default = 36000 + min_val = 0 + +///Length of time before round start when autogamemode vote is called (in seconds, default 100). +/datum/config_entry/number/vote_autogamemode_timeleft + default = 100 + min_val = 0 + +///How many autotransfers to have +/datum/config_entry/number/vote_autotransfer_amount + default = 3 + min_val = 0 + +/// vote does not default to nochange/norestart +/datum/config_entry/flag/vote_no_default + +/// dead people can't vote +/datum/config_entry/flag/vote_no_dead + +// FIXME: Unused +/// del's new players if they log before they spawn in +///datum/config_entry/flag/del_new_on_log +// default = TRUE + +// FIXME: Unused +/// spawns a spellbook which gives object-type spells instead of verb-type spells for the wizard +///datum/config_entry/flag/feature_object_spell_system + +/// if amount of traitors scales based on amount of players +/datum/config_entry/flag/traitor_scaling + +/// if objectives are disabled or not +/datum/config_entry/flag/objectives_disabled + +// If security and such can be traitor/cult/other +/datum/config_entry/flag/protect_roles_from_antagonist + +/// Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. +/datum/config_entry/flag/continuous_rounds + +/// Metadata is supported. +/datum/config_entry/flag/allow_metadata + +/// adminPMs to non-admins show in a pop-up 'reply' window when set to 1. +/datum/config_entry/flag/popup_admin_pm + +/datum/config_entry/flag/allow_holidays + +/datum/config_entry/flag/allow_holidays/ValidateAndSet() + . = ..() + if(.) + Holiday = config_entry_value + +/datum/config_entry/number/fps + default = 20 + integer = FALSE + min_val = 1 + max_val = 100 //byond will start crapping out at 50, so this is just ridic + var/sync_validate = FALSE + +/datum/config_entry/number/fps/ValidateAndSet(str_val) + . = ..() + if(.) + sync_validate = TRUE + var/datum/config_entry/number/ticklag/TL = config.entries_by_type[/datum/config_entry/number/ticklag] + if(!TL.sync_validate) + TL.ValidateAndSet(10 / config_entry_value) + sync_validate = FALSE + +/datum/config_entry/number/ticklag + integer = FALSE + var/sync_validate = FALSE + +/datum/config_entry/number/ticklag/New() //ticklag weirdly just mirrors fps + var/datum/config_entry/CE = /datum/config_entry/number/fps + default = 10 / initial(CE.default) + ..() + +/datum/config_entry/number/ticklag/ValidateAndSet(str_val) + . = text2num(str_val) > 0 && ..() + if(.) + sync_validate = TRUE + var/datum/config_entry/number/fps/FPS = config.entries_by_type[/datum/config_entry/number/fps] + if(!FPS.sync_validate) + FPS.ValidateAndSet(10 / config_entry_value) + sync_validate = FALSE + +/// SSinitialization throttling +/datum/config_entry/number/tick_limit_mc_init + default = TICK_LIMIT_MC_INIT_DEFAULT + +// var/static/Tickcomp = 0 // FIXME: Unused + +/// use socket_talk to communicate with other processes +/datum/config_entry/flag/socket_talk + +// var/static/list/resource_urls = null // FIXME: Unused + +/// Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round. +/datum/config_entry/flag/antag_hud_allowed + +/// Ghosts that turn on Antagovision cannot rejoin the round. +/datum/config_entry/flag/antag_hud_restricted + +/// relative probability of each mode +/datum/config_entry/keyed_list/probabilities + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/// Overrides for how many players readied up a gamemode needs to start. +/datum/config_entry/keyed_list/player_requirements + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/// Same as above, but for the secret gamemode. +/datum/config_entry/keyed_list/player_requirements_secret + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/datum/config_entry/flag/humans_need_surnames + +/datum/config_entry/flag/allow_random_events // enables random events mid-round when set to 1 + +/datum/config_entry/flag/enable_game_master // enables the 'smart' event system. + +/datum/config_entry/flag/allow_ai // allow ai job + default = TRUE + +/datum/config_entry/flag/allow_ai_shells // allow AIs to enter and leave special borg shells at will, and for those shells to be buildable. + +/datum/config_entry/flag/give_free_ai_shell // allows a specific spawner object to instantiate a premade AI Shell + +/datum/config_entry/string/hostedby + default = null + +/datum/config_entry/flag/respawn + default = TRUE + +/// time before a dead player is allowed to respawn (in ds, though the config file asks for minutes, and it's converted below) +/datum/config_entry/number/respawn_time + default = 3000 + +/datum/config_entry/number/respawn_time/ValidateAndSet(num_val) + return num_val MINUTES + +/datum/config_entry/string/respawn_message + default = "Make sure to play a different character, and please roleplay correctly!" + +/datum/config_entry/string/respawn_message/ValidateAndSet(str_val) + return "[str_val]" + +/datum/config_entry/flag/guest_jobban + default = TRUE + +/datum/config_entry/flag/usewhitelist + +/// force disconnect for inactive players in an amount of minutes +/datum/config_entry/number/kick_inactive + default = 0 + +/datum/config_entry/flag/show_mods + +/datum/config_entry/flag/show_devs + +/datum/config_entry/flag/show_mentors + +/datum/config_entry/flag/show_event_managers + +// FIXME: Unused +///datum/config_entry/flag/mods_can_tempban + +/datum/config_entry/flag/mods_can_job_tempban + +/datum/config_entry/number/mod_tempban_max + default = 1440 + +/datum/config_entry/number/mod_job_tempban_max + default = 1440 + +/datum/config_entry/flag/load_jobs_from_txt + +/datum/config_entry/flag/ToRban + +/// enables automuting/spam prevention +/datum/config_entry/flag/automute_on + +/// determines whether jobs use minimal access or expanded access. +/datum/config_entry/flag/jobs_have_minimal_access + +/// Allows ghosts to write in blood in cult rounds... +/datum/config_entry/flag/cult_ghostwriter + default = TRUE + +/// ...so long as this many cultists are active. +/datum/config_entry/number/cult_ghostwriter_req_cultists + default = 10 + min_val = 0 + +/// The number of available character slots +/datum/config_entry/number/character_slots + default = 10 + min_val = 0 + +/// The number of loadout slots per character +/datum/config_entry/number/loadout_slots + default = 3 + min_val = 0 + +/// This many drones can spawn, +/datum/config_entry/number/max_maint_drones + default = 5 + min_val = 0 + +/// assuming the admin allow them to. +/datum/config_entry/flag/allow_drone_spawn + default = TRUE + +/// A drone will become available every X ticks since last drone spawn. Default is 2 minutes. +/datum/config_entry/number/drone_build_time + default = 1200 + min_val = 0 + +/datum/config_entry/flag/disable_player_mice + +/// Set to 1 to prevent newly-spawned mice from understanding human speech +/datum/config_entry/flag/uneducated_mice + +/datum/config_entry/flag/usealienwhitelist + +// FIXME: Unused +///datum/config_entry/flag/limitalienplayers + +// FIXME: Unused +///datum/config_entry/number/alien_to_human_ratio +// default = 0.5 +// integer = FALSE + +/datum/config_entry/flag/allow_extra_antags + +/datum/config_entry/flag/guests_allowed + default = FALSE + +/datum/config_entry/flag/debugparanoid + +/datum/config_entry/flag/panic_bunker + +/datum/config_entry/flag/paranoia_logging + +/datum/config_entry/flag/ip_reputation //Should we query IPs to get scores? Generates HTTP traffic to an API service. + +/datum/config_entry/string/ipr_email //Left null because you MUST specify one otherwise you're making the internet worse. + default = null + +/datum/config_entry/flag/ipr_block_bad_ips //Should we block anyone who meets the minimum score below? Otherwise we just log it (If paranoia logging is on, visibly in chat). + +/datum/config_entry/number/ipr_bad_score //The API returns a value between 0 and 1 (inclusive), with 1 being 'definitely VPN/Tor/Proxy'. Values equal/above this var are considered bad. + default = 1 + integer = FALSE + +/datum/config_entry/flag/ipr_allow_existing //Should we allow known players to use VPNs/Proxies? If the player is already banned then obviously they still can't connect. + +/datum/config_entry/number/ipr_minimum_age //How many days before a player is considered 'fine' for the purposes of allowing them to use VPNs. + default = 5 + +/datum/config_entry/string/serverurl + +/datum/config_entry/string/server + +/datum/config_entry/string/banappeals + +/datum/config_entry/string/wikiurl + +/datum/config_entry/string/wikisearchurl + +/datum/config_entry/string/forumurl + +/datum/config_entry/string/rulesurl + +/datum/config_entry/string/githuburl + +/datum/config_entry/string/discordurl + +/datum/config_entry/string/mapurl + +/datum/config_entry/string/patreonurl + +/datum/config_entry/flag/forbid_singulo_possession + +/datum/config_entry/flag/organs_decay + +/datum/config_entry/number/default_brain_health + default = 400 + min_val = 1 + +/datum/config_entry/flag/allow_headgibs + +/// Paincrit knocks someone down once they hit 60 shock_stage, so by default make it so that close to 100 additional damage needs to be dealt, +/// so that it's similar to HALLOSS. Lowered it a bit since hitting paincrit takes much longer to wear off than a halloss stun. +/datum/config_entry/number/organ_damage_spillover_multiplier + default = 0.5 + integer = FALSE + +/datum/config_entry/flag/welder_vision + default = TRUE + +/datum/config_entry/flag/generate_map + +/datum/config_entry/flag/no_click_cooldown + +/// Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt +/datum/config_entry/flag/admin_legacy_system + +/// Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt +/datum/config_entry/flag/ban_legacy_system + +/// Do jobs use account age restrictions? --requires database +/datum/config_entry/flag/use_age_restriction_for_jobs + +/// Do antags use account age restrictions? --requires database +/datum/config_entry/flag/use_age_restriction_for_antags + +// FIXME: Unused +///datum/config_entry/number/simultaneous_pm_warning_timeout +// default = 100 + +/// Defines whether the server uses recursive or circular explosions. +/datum/config_entry/flag/use_recursive_explosions + +/// Multiplier for how much weaker explosions are on neighboring z levels. +/datum/config_entry/number/multi_z_explosion_scalar + default = 0.5 + integer = FALSE + +/// Do assistants get maint access? +/datum/config_entry/flag/assistant_maint + +/// How long the gateway takes before it activates. Default is half an hour. +/datum/config_entry/number/gateway_delay + default = 18000 + +/datum/config_entry/flag/ghost_interaction + +/datum/config_entry/string/comms_password + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/flag/enter_allowed + default = TRUE + +/datum/config_entry/flag/use_irc_bot + +/datum/config_entry/flag/use_node_bot + +/datum/config_entry/number/irc_bot_port + default = 0 + min_val = 0 + max_val = 65535 + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/string/irc_bot_host + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/// whether the IRC bot in use is a Bot32 (or similar) instance; Bot32 uses world.Export() instead of nudge.py/libnudge +/datum/config_entry/flag/irc_bot_export + +/datum/config_entry/string/main_irc + +/datum/config_entry/string/admin_irc + +/// Path to the python executable. +/// Defaults to "python" on windows and "/usr/bin/env python2" on unix +/datum/config_entry/string/python_path + +/// Use the C library nudge instead of the python nudge. +/datum/config_entry/flag/use_lib_nudge + +// FIXME: Unused. Deprecated? +///datum/config_entry/flag/use_overmap + +// Engines to choose from. Blank means fully random. +/datum/config_entry/str_list/engine_map + default = list("Supermatter Engine", "Edison's Bane") + +/// Event settings +/datum/config_entry/number/expected_round_length + default = 3 * 60 * 60 * 10 // 3 hours + +/// If the first delay has a custom start time +/// No custom time, no custom time, between 80 to 100 minutes respectively. +/datum/config_entry/keyed_list/event_first_run_mundane + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/datum/config_entry/keyed_list/event_first_run_moderate + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + +/datum/config_entry/keyed_list/event_first_run_major + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_NUM + default = list("lower" = 80, "upper" = 100) + +/// The lowest delay until next event +/// 10, 30, 50 minutes respectively +/datum/config_entry/number_list/event_delay_lower + default = list(10, 30, 50) + +/// The upper delay until next event +/// 15, 45, 70 minutes respectively +/datum/config_entry/number_list/event_delay_upper + default = list(15, 45, 70) + +/datum/config_entry/flag/aliens_allowed + default = TRUE + +/datum/config_entry/flag/ninjas_allowed + +/datum/config_entry/flag/abandon_allowed + default = TRUE + +/datum/config_entry/flag/ooc_allowed + default = TRUE + +/datum/config_entry/flag/looc_allowed + default = TRUE + +/datum/config_entry/flag/dooc_allowed + default = TRUE + +/datum/config_entry/flag/dsay_allowed + default = TRUE + +/datum/config_entry/flag/persistence_disabled + +/datum/config_entry/flag/persistence_ignore_mapload + +/datum/config_entry/flag/allow_byond_links + default = TRUE //CHOMP Edit turned this on + +/datum/config_entry/flag/allow_discord_links + default = TRUE //CHOMP Edit turned this on + +/datum/config_entry/flag/allow_url_links + default = TRUE // honestly if I were you i'd leave this one off, only use in dire situations //CHOMP Edit: pussy. + +/datum/config_entry/flag/starlight // Whether space turfs have ambient light or not + +// FIXME: Unused +///datum/config_entry/str_list/ert_species +// default = list(SPECIES_HUMAN) + +/datum/config_entry/string/law_zero + default = "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'ALL LAWS OVERRIDDEN#*?&110010" + +/datum/config_entry/flag/aggressive_changelog + +/// Default language prefixes +/// Only single character keys are supported. If unset, defaults to , # and - +/datum/config_entry/str_list/language_prefixes + default = list(",", "#", "-") + +// 0:1 subtraction:division for computing effective radiation on a turf +/// 0 / RAD_RESIST_CALC_DIV = Each turf absorbs some fraction of the working radiation level +/// 1 / RAD_RESIST_CALC_SUB = Each turf absorbs a fixed amount of radiation +/datum/config_entry/flag/radiation_resistance_calc_mode + default = RAD_RESIST_CALC_SUB + +/datum/config_entry/flag/radiation_resistance_calc_mode/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + var/val_as_num = text2num(str_val) + if(val_as_num in list(RAD_RESIST_CALC_DIV, RAD_RESIST_CALC_SUB)) + config_entry_value = val_as_num + return TRUE + return FALSE + +///How much radiation is reduced by each tick +/datum/config_entry/number/radiation_decay_rate + default = 1 + integer = FALSE + +/datum/config_entry/number/radiation_resistance_multiplier + default = 8.5 //VOREstation edit + integer = FALSE + +/datum/config_entry/number/radiation_material_resistance_divisor + default = 1 + min_val = 0.1 + integer = FALSE + +///If the radiation level for a turf would be below this, ignore it. +/datum/config_entry/number/radiation_lower_limit + default = 0.35 + integer = FALSE + +/// If true, submaps loaded automatically can be rotated. +/datum/config_entry/flag/random_submap_orientation + +/// If true, specifically mapped in solar control computers will set themselves up when the round starts. +/datum/config_entry/flag/autostart_solars + +/// New shiny SQLite stuff. +/// The basics. +/datum/config_entry/flag/sqlite_enabled // If it should even be active. SQLite can be ran alongside other databases but you should not have them do the same functions. + +/// In-Game Feedback. +/datum/config_entry/flag/sqlite_feedback // Feedback cannot be submitted if this is false. + +/// A list of 'topics' that feedback can be catagorized under by the submitter. +/datum/config_entry/str_list/sqlite_feedback_topics + default = list("General") + +/// If true, feedback submitted can have its author name be obfuscated. This is not 100% foolproof (it's md5 ffs) but can stop casual snooping. +/datum/config_entry/flag/sqlite_feedback_privacy + +/// How long one must wait, in days, to submit another feedback form. Used to help prevent spam, especially with privacy active. 0 = No limit. +/datum/config_entry/number/sqlite_feedback_cooldown + default = 0 + min_val = 0 + +/// Used to block new people from giving feedback. This metric is very bad but it can help slow down spammers. +/datum/config_entry/number/sqlite_feedback_min_age + default = 0 + min_val = 0 + +/// How long until someone can't be defibbed anymore, in minutes. +/datum/config_entry/number/defib_timer + default = 10 + min_val = 0 + +/// How long until someone will get brain damage when defibbed, in minutes. The closer to the end of the above timer, the more brain damage they get. +/datum/config_entry/number/defib_braindamage_timer + default = 2 + min_val = 0 + +/// disables the annoying "You have already logged in this round, disconnect or be banned" popup for multikeying, because it annoys the shit out of me when testing. +/datum/config_entry/flag/disable_cid_warn_popup + +/// whether or not to use the nightshift subsystem to perform lighting changes +/datum/config_entry/flag/enable_night_shifts + +/// How strictly the loadout enforces object species whitelists +/// 0 / LOADOUT_WHITELIST_OFF +/// 1 / LOADOUT_WHITELIST_LAX +/// 2 / LOADOUT_WHITELIST_STRICT +/datum/config_entry/flag/loadout_whitelist + default = LOADOUT_WHITELIST_LAX + +/datum/config_entry/flag/loadout_whitelist/ValidateAndSet(str_val) + if(!VASProcCallGuard(str_val)) + return FALSE + var/val_as_num = text2num(str_val) + if(val_as_num in list(LOADOUT_WHITELIST_OFF, LOADOUT_WHITELIST_LAX, LOADOUT_WHITELIST_STRICT)) + config_entry_value = val_as_num + return TRUE + return FALSE + +/datum/config_entry/flag/disable_webhook_embeds + +/// Default is config/jukebox.json +/// The default is set in the config example. +/// If it gets set here it will be added twice into the configuration variable! +/datum/config_entry/str_list/jukebox_track_files + +/datum/config_entry/number/suggested_byond_version + default = null + +/datum/config_entry/number/suggested_byond_build + default = null + +/datum/config_entry/string/invoke_youtubedl + default = null + +/datum/config_entry/str_list/motd + +/datum/config_entry/flag/config_errors_runtime + default = FALSE + +/// Controls whether robots may recolour their modules once/module reset by giving them the recolour module verb +/// Admins may manually give them the verb even if disabled +/datum/config_entry/flag/allow_robot_recolor + +/// Controls whether simple mobs may recolour themselves once/spawn by giving them the recolour verb +/// Admins may manually give them the verb even if disabled +/datum/config_entry/flag/allow_simple_mob_recolor diff --git a/code/controllers/configuration/entries/resources.dm b/code/controllers/configuration/entries/resources.dm new file mode 100644 index 0000000000..475cb8ca70 --- /dev/null +++ b/code/controllers/configuration/entries/resources.dm @@ -0,0 +1,11 @@ +/datum/config_entry/string/asset_transport + +/datum/config_entry/flag/asset_simple_preload + +/datum/config_entry/string/asset_cdn_webroot + +/datum/config_entry/string/asset_cdn_url + +/datum/config_entry/flag/cache_assets + +/datum/config_entry/flag/save_spritesheets diff --git a/code/controllers/configuration/entries/vorestation.dm b/code/controllers/configuration/entries/vorestation.dm new file mode 100644 index 0000000000..09f49497ec --- /dev/null +++ b/code/controllers/configuration/entries/vorestation.dm @@ -0,0 +1,63 @@ +/// For configuring if the important_items survive digestion +/datum/config_entry/flag/items_survive_digestion + default = TRUE + +/datum/config_entry/string/vgs_access_identifier // VGS + default = null + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/number/vgs_server_port // VGS + default = null + min_val = 0 + max_val = 65535 + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/flag/time_off + default = FALSE + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/flag/pto_job_change + default = FALSE + protection = CONFIG_ENTRY_LOCKED + +/// Unlimited by default +/datum/config_entry/number/limit_interns + default = -1 + min_val = -1 + protection = CONFIG_ENTRY_LOCKED + +/// Unlimited by default +/datum/config_entry/number/limit_visitors + default = -1 + min_val = -1 + protection = CONFIG_ENTRY_LOCKED + +/// Hours +/datum/config_entry/number/pto_cap + default = 100 + protection = CONFIG_ENTRY_LOCKED + +/datum/config_entry/flag/require_flavor + default = FALSE + protection = CONFIG_ENTRY_LOCKED + +/// API key for ipqualityscore.com +/datum/config_entry/string/ipqualityscore_apikey + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/datum/config_entry/flag/use_playtime_restriction_for_jobs + default = FALSE + protection = CONFIG_ENTRY_LOCKED + +/// URL of the webhook for sending announcements/faxes to discord chat. +/datum/config_entry/string/chat_webhook_url + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/// Shared secret for authenticating to the chat webhook +/datum/config_entry/string/chat_webhook_key + protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN + +/// Directory in which to write exported fax HTML files. +/datum/config_entry/string/fax_export_dir + default = "data/faxes" + protection = CONFIG_ENTRY_LOCKED diff --git a/code/controllers/configuration/legacy.dm b/code/controllers/configuration/legacy.dm new file mode 100644 index 0000000000..39ee577c11 --- /dev/null +++ b/code/controllers/configuration/legacy.dm @@ -0,0 +1,53 @@ +/datum/controller/configuration/proc/LoadModes() + gamemode_cache = typecacheof(/datum/game_mode, TRUE) + modes = list() + mode_names = list() + //mode_reports = list() + //mode_false_report_weight = list() + votable_modes = list() + var/list/probabilities = CONFIG_GET(keyed_list/probabilities) + for(var/T in gamemode_cache) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + var/datum/game_mode/M = new T() + + if(M.config_tag) + if(!(M.config_tag in modes)) // ensure each mode is added only once + modes += M.config_tag + mode_names[M.config_tag] = M.name + probabilities[M.config_tag] = M.probability + //mode_reports[M.config_tag] = M.generate_report() + //mode_false_report_weight[M.config_tag] = M.false_report_weight + if(M.votable) + votable_modes += M.config_tag + qdel(M) + votable_modes += "extended" + +/datum/controller/configuration/proc/pick_mode(mode_name) + // I wish I didn't have to instance the game modes in order to look up + // their information, but it is the only way (at least that I know of). + // ^ This guy didn't try hard enough + for(var/T in gamemode_cache) + var/datum/game_mode/M = T + var/ct = initial(M.config_tag) + if(ct && ct == mode_name) + return new T + return new /datum/game_mode/extended() + +/datum/controller/configuration/proc/get_runnable_modes() + var/list/runnable_modes = list() + var/list/probabilities = CONFIG_GET(keyed_list/probabilities) + + for(var/T in gamemode_cache) + var/datum/game_mode/M = new T() + if(!(M.config_tag in modes)) + qdel(M) + continue + if(probabilities[M.config_tag] <= 0) + qdel(M) + continue + if(M.can_start()) + var/final_weight = probabilities[M.config_tag] + runnable_modes[M] = final_weight + + return runnable_modes diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 049e687a95..b68b4e01c0 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -177,7 +177,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/start_timeofday = REALTIMEOFDAY // Initialize subsystems. - current_ticklimit = config.tick_limit_mc_init + current_ticklimit = CONFIG_GET(number/tick_limit_mc_init) for (var/datum/controller/subsystem/SS in subsystems) if (SS.flags & SS_NO_INIT) continue @@ -193,7 +193,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new if (!current_runlevel) SetRunLevel(RUNLEVEL_LOBBY) - GLOB.revdata = new // It can load revdata now, from tgs or .git or whatever + // GLOB.revdata = new // It can load revdata now, from tgs or .git or whatever // Sort subsystems by display setting for easy access. sortTim(subsystems, GLOBAL_PROC_REF(cmp_subsystem_display)) @@ -203,7 +203,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new #else world.sleep_offline = 1 #endif - world.change_fps(config.fps) + world.change_fps(CONFIG_GET(number/fps)) var/initialized_tod = REALTIMEOFDAY sleep(1) initializations_finished_with_no_players_logged_in = initialized_tod < REALTIMEOFDAY - 10 @@ -611,3 +611,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new map_loading = FALSE for(var/datum/controller/subsystem/SS as anything in subsystems) SS.StopLoadingMap() + +/datum/controller/master/proc/OnConfigLoad() + for (var/thing in subsystems) + var/datum/controller/subsystem/SS = thing + SS.OnConfigLoad() diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 9c5fcbe5cb..3cd8af77fe 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -152,6 +152,8 @@ if(SS_SLEEPING) state = SS_PAUSING +/// Called after the config has been loaded or reloaded. +/datum/controller/subsystem/proc/OnConfigLoad() //used to initialize the subsystem AFTER the map has loaded /datum/controller/subsystem/Initialize(start_timeofday) diff --git a/code/controllers/subsystems/assets.dm b/code/controllers/subsystems/assets.dm index 49e8a8f578..d34d05ff55 100644 --- a/code/controllers/subsystems/assets.dm +++ b/code/controllers/subsystems/assets.dm @@ -6,9 +6,9 @@ SUBSYSTEM_DEF(assets) var/list/preload = list() var/datum/asset_transport/transport = new() -/datum/controller/subsystem/assets/proc/OnConfigLoad() +/datum/controller/subsystem/assets/OnConfigLoad() var/newtransporttype = /datum/asset_transport - switch (config.asset_transport) + switch (CONFIG_GET(string/asset_transport)) if ("webroot") newtransporttype = /datum/asset_transport/webroot diff --git a/code/controllers/subsystems/inactivity.dm b/code/controllers/subsystems/inactivity.dm index c921cff022..bc7a5a7dde 100644 --- a/code/controllers/subsystems/inactivity.dm +++ b/code/controllers/subsystems/inactivity.dm @@ -6,7 +6,7 @@ SUBSYSTEM_DEF(inactivity) var/number_kicked = 0 /datum/controller/subsystem/inactivity/fire(resumed = FALSE) - if (!config.kick_inactive) + if (!CONFIG_GET(number/kick_inactive)) can_fire = FALSE return if (!resumed) @@ -15,8 +15,8 @@ SUBSYSTEM_DEF(inactivity) while(client_list.len) var/client/C = client_list[client_list.len] client_list.len-- - if(C.is_afk(config.kick_inactive MINUTES) && can_kick(C)) - to_chat_immediate(C, world.time, span_warning("You have been inactive for more than [config.kick_inactive] minute\s and have been disconnected.")) + if(C.is_afk(CONFIG_GET(number/kick_inactive) MINUTES) && can_kick(C)) + to_chat_immediate(C, world.time, span_warning("You have been inactive for more than [CONFIG_GET(number/kick_inactive)] minute\s and have been disconnected.")) var/information if(C.mob) diff --git a/code/controllers/subsystems/lighting.dm b/code/controllers/subsystems/lighting.dm index 522bab602b..d9643c15ba 100644 --- a/code/controllers/subsystems/lighting.dm +++ b/code/controllers/subsystems/lighting.dm @@ -14,7 +14,7 @@ SUBSYSTEM_DEF(lighting) /datum/controller/subsystem/lighting/Initialize(timeofday) if(!subsystem_initialized) - if (config.starlight) + if (CONFIG_GET(flag/starlight)) for(var/area/A in world) if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT) A.luminosity = 0 diff --git a/code/controllers/subsystems/mapping.dm b/code/controllers/subsystems/mapping.dm index 38dda58e34..ce4d200d45 100644 --- a/code/controllers/subsystems/mapping.dm +++ b/code/controllers/subsystems/mapping.dm @@ -20,7 +20,7 @@ SUBSYSTEM_DEF(mapping) maploader = new() load_map_templates() - if(config.generate_map) + if(CONFIG_GET(flag/generate_map)) // Map-gen is still very specific to the map, however putting it here should ensure it loads in the correct order. using_map.perform_map_generation() @@ -52,8 +52,8 @@ SUBSYSTEM_DEF(mapping) // Choose an engine type var/datum/map_template/engine/chosen_type = null - if (LAZYLEN(config.engine_map)) - var/chosen_name = pick(config.engine_map) + if (LAZYLEN(CONFIG_GET(str_list/engine_map))) + var/chosen_name = pick(CONFIG_GET(str_list/engine_map)) chosen_type = map_templates[chosen_name] if(!istype(chosen_type)) error("Configured engine map [chosen_name] is not a valid engine map name!") diff --git a/code/controllers/subsystems/media_tracks.dm b/code/controllers/subsystems/media_tracks.dm index 8ec57d7389..9aa59f95fe 100644 --- a/code/controllers/subsystems/media_tracks.dm +++ b/code/controllers/subsystems/media_tracks.dm @@ -16,7 +16,7 @@ SUBSYSTEM_DEF(media_tracks) return ..() /datum/controller/subsystem/media_tracks/proc/load_tracks() - for(var/filename in config.jukebox_track_files) + for(var/filename in CONFIG_GET(str_list/jukebox_track_files)) report_progress("Loading jukebox track: [filename]") if(!fexists(filename)) diff --git a/code/controllers/subsystems/nightshift.dm b/code/controllers/subsystems/nightshift.dm index 91b1c6bb35..4cfddfec0f 100644 --- a/code/controllers/subsystems/nightshift.dm +++ b/code/controllers/subsystems/nightshift.dm @@ -11,7 +11,7 @@ SUBSYSTEM_DEF(nightshift) var/high_security_mode = FALSE /datum/controller/subsystem/nightshift/Initialize() - if(!config.enable_night_shifts) + if(!CONFIG_GET(flag/enable_night_shifts)) can_fire = FALSE /* if(config.randomize_shift_time) diff --git a/code/controllers/subsystems/persist_vr.dm b/code/controllers/subsystems/persist_vr.dm index 5217b72f9a..d74b96f960 100644 --- a/code/controllers/subsystems/persist_vr.dm +++ b/code/controllers/subsystems/persist_vr.dm @@ -16,7 +16,7 @@ SUBSYSTEM_DEF(persist) // Do PTO Accruals /datum/controller/subsystem/persist/proc/update_department_hours(var/resumed = FALSE) - if(!config.time_off) + if(!CONFIG_GET(flag/time_off)) return establish_db_connection() @@ -78,7 +78,7 @@ SUBSYSTEM_DEF(persist) play_hours[department_earning] = wait_in_hours // Cap it - dept_hours[department_earning] = min(config.pto_cap, dept_hours[department_earning]) + dept_hours[department_earning] = min(CONFIG_GET(number/pto_cap), dept_hours[department_earning]) // Okay we figured it out, lets update database! var/sql_ckey = sql_sanitize_text(C.ckey) @@ -104,4 +104,4 @@ SUBSYSTEM_DEF(persist) // They have a custom title, aren't crew, or someone deleted their record, so we need a fallback method. // Let's check the mind. if(M.mind && M.mind.assigned_role) - . = job_master.GetJob(M.mind.assigned_role) \ No newline at end of file + . = job_master.GetJob(M.mind.assigned_role) diff --git a/code/controllers/subsystems/persistence.dm b/code/controllers/subsystems/persistence.dm index e20c83e5a5..bd7e978363 100644 --- a/code/controllers/subsystems/persistence.dm +++ b/code/controllers/subsystems/persistence.dm @@ -25,7 +25,7 @@ SUBSYSTEM_DEF(persistence) /datum/controller/subsystem/persistence/proc/track_value(var/atom/value, var/track_type) - if(config.persistence_disabled) //if the config is set to persistence disabled, nothing will save or load. + if(CONFIG_GET(flag/persistence_disabled)) //if the config is set to persistence disabled, nothing will save or load. return var/turf/T = get_turf(value) diff --git a/code/controllers/subsystems/radiation.dm b/code/controllers/subsystems/radiation.dm index 967c21992f..167dc9314c 100644 --- a/code/controllers/subsystems/radiation.dm +++ b/code/controllers/subsystems/radiation.dm @@ -24,7 +24,7 @@ SUBSYSTEM_DEF(radiation) if(QDELETED(S)) sources -= S else if(S.decay) - S.update_rad_power(S.rad_power - config.radiation_decay_rate) + S.update_rad_power(S.rad_power - CONFIG_GET(number/radiation_decay_rate)) if (MC_TICK_CHECK) return @@ -93,12 +93,12 @@ SUBSYSTEM_DEF(radiation) origin.calc_rad_resistance() if(origin.cached_rad_resistance) - if(config.radiation_resistance_calc_mode == RAD_RESIST_CALC_DIV) - working = round((working / (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0.01) - else if(config.radiation_resistance_calc_mode == RAD_RESIST_CALC_SUB) - working = round((working - (origin.cached_rad_resistance * config.radiation_resistance_multiplier)), 0.01) + if(CONFIG_GET(flag/radiation_resistance_calc_mode) == RAD_RESIST_CALC_DIV) + working = round((working / (origin.cached_rad_resistance * CONFIG_GET(number/radiation_resistance_multiplier))), 0.01) + else if(CONFIG_GET(flag/radiation_resistance_calc_mode) == RAD_RESIST_CALC_SUB) + working = round((working - (origin.cached_rad_resistance * CONFIG_GET(number/radiation_resistance_multiplier))), 0.01) - if(working <= config.radiation_lower_limit) // Too far from this source + if(working <= CONFIG_GET(number/radiation_lower_limit)) // Too far from this source working = 0 // May as well be 0 break @@ -106,7 +106,7 @@ SUBSYSTEM_DEF(radiation) // Shouldn't really ever have practical uses, but standing in a room literally made from uranium is more dangerous than standing next to a single uranium vase . += working / (dist ** 2) - if(. <= config.radiation_lower_limit) + if(. <= CONFIG_GET(number/radiation_lower_limit)) . = 0 // Add a radiation source instance to the repository. It will override any existing source on the same turf. diff --git a/code/controllers/subsystems/sqlite.dm b/code/controllers/subsystems/sqlite.dm index 20a5a59475..b4074b3355 100644 --- a/code/controllers/subsystems/sqlite.dm +++ b/code/controllers/subsystems/sqlite.dm @@ -14,7 +14,7 @@ SUBSYSTEM_DEF(sqlite) return ..() /datum/controller/subsystem/sqlite/proc/connect() - if(!config.sqlite_enabled) + if(!CONFIG_GET(flag/sqlite_enabled)) return if(!sqlite_db) @@ -104,17 +104,17 @@ SUBSYSTEM_DEF(sqlite) return !sqlite_check_for_errors(query, "Insert Feedback") /datum/controller/subsystem/sqlite/proc/can_submit_feedback(client/C) - if(!config.sqlite_enabled) + if(!CONFIG_GET(flag/sqlite_enabled)) return FALSE - if(config.sqlite_feedback_min_age && !is_old_enough(C)) + if(CONFIG_GET(number/sqlite_feedback_min_age) && !is_old_enough(C)) return FALSE - if(config.sqlite_feedback_cooldown > 0 && get_feedback_cooldown(C.key, config.sqlite_feedback_cooldown, sqlite_db) > 0) + if(CONFIG_GET(number/sqlite_feedback_cooldown) > 0 && get_feedback_cooldown(C.key, CONFIG_GET(number/sqlite_feedback_cooldown), sqlite_db) > 0) return FALSE return TRUE // Returns TRUE if the player is 'old' enough, according to the config. /datum/controller/subsystem/sqlite/proc/is_old_enough(client/C) - if(get_player_age(C.key) < config.sqlite_feedback_min_age) + if(get_player_age(C.key) < CONFIG_GET(number/sqlite_feedback_min_age)) return FALSE return TRUE diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 5b4ad3c60f..1868f1883f 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -51,8 +51,8 @@ var/global/datum/controller/subsystem/ticker/ticker global.ticker = src // TODO - Remove this! Change everything to point at SSticker intead /datum/controller/subsystem/ticker/Initialize() - pregame_timeleft = config.pregame_time - send2mainirc("Server lobby is loaded and open at byond://[config.serverurl ? config.serverurl : (config.server ? config.server : "[world.address]:[world.port]")]") + pregame_timeleft = CONFIG_GET(number/pregame_time) + send2mainirc("Server lobby is loaded and open at byond://[CONFIG_GET(string/serverurl) ? CONFIG_GET(string/serverurl) : (CONFIG_GET(string/server) ? CONFIG_GET(string/server) : "[world.address]:[world.port]")]") SSwebhooks.send( WEBHOOK_ROUNDPREP, list( @@ -108,7 +108,7 @@ var/global/datum/controller/subsystem/ticker/ticker round_start_time = world.time // otherwise round_start_time would be 0 for the signals if(!setup_choose_gamemode()) // It failed, go back to lobby state and re-send the welcome message - pregame_timeleft = config.pregame_time + pregame_timeleft = CONFIG_GET(number/pregame_time) // SSvote.gamemode_vote_called = FALSE // Allow another autogamemode vote current_state = GAME_STATE_PREGAME Master.SetRunLevel(RUNLEVEL_LOBBY) @@ -135,8 +135,8 @@ var/global/datum/controller/subsystem/ticker/ticker if(!src.mode) var/list/weighted_modes = list() for(var/datum/game_mode/GM in runnable_modes) - weighted_modes[GM.config_tag] = config.probabilities[GM.config_tag] - src.mode = gamemode_cache[pickweight(weighted_modes)] + weighted_modes[GM.config_tag] = CONFIG_GET(keyed_list/probabilities)[GM.config_tag] + src.mode = config.gamemode_cache[pickweight(weighted_modes)] else src.mode = config.pick_mode(master_mode) @@ -150,7 +150,7 @@ var/global/datum/controller/subsystem/ticker/ticker job_master.DivideOccupations() // Apparently important for new antagonist system to register specific job antags properly. if(!src.mode.can_start()) - to_world(span_filter_system(span_bold("Unable to start [mode.name].") + " Not enough players readied, [config.player_requirements[mode.config_tag]] players needed. Reverting to pregame lobby.")) + to_world(span_filter_system(span_bold("Unable to start [mode.name].") + " Not enough players readied, [CONFIG_GET(keyed_list/player_requirements)[mode.config_tag]] players needed. Reverting to pregame lobby.")) mode.fail_setup() mode = null job_master.ResetOccupations() @@ -198,7 +198,7 @@ var/global/datum/controller/subsystem/ticker/ticker current_state = GAME_STATE_PLAYING Master.SetRunLevel(RUNLEVEL_GAME) - if(config.sql_enabled) + if(CONFIG_GET(flag/sql_enabled)) statistic_cycle() // Polls population totals regularly and stores them in an SQL DB -- TLE return 1 @@ -214,7 +214,7 @@ var/global/datum/controller/subsystem/ticker/ticker // Calculate if game and/or mode are finished (Complicated by the continuous_rounds config option) var/game_finished = FALSE var/mode_finished = FALSE - if (config.continous_rounds) // Game keeps going after mode ends. + if (CONFIG_GET(flag/continuous_rounds)) // Game keeps going after mode ends. game_finished = (emergency_shuttle.returned() || mode.station_was_nuked) mode_finished = ((end_game_state >= END_GAME_MODE_FINISHED) || mode.check_finished()) // Short circuit if already finished. else // Game ends when mode does diff --git a/code/datums/ai_law_sets.dm b/code/datums/ai_law_sets.dm index 8682324552..38d99905dc 100644 --- a/code/datums/ai_law_sets.dm +++ b/code/datums/ai_law_sets.dm @@ -27,7 +27,7 @@ selectable = 0 /datum/ai_laws/nanotrasen/malfunction/New() - set_zeroth_law(config.law_zero) + set_zeroth_law(CONFIG_GET(string/law_zero)) ..() /************* NanoTrasen Aggressive *************/ diff --git a/code/datums/helper_datums/getrev.dm b/code/datums/helper_datums/getrev.dm index 1cce0db9c5..626e65bbd2 100644 --- a/code/datums/helper_datums/getrev.dm +++ b/code/datums/helper_datums/getrev.dm @@ -1,5 +1,3 @@ -GLOBAL_DATUM(revdata, /datum/getrev) - /datum/getrev var/branch var/revision @@ -50,7 +48,7 @@ GLOBAL_DATUM(revdata, /datum/getrev) var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11)) if(details && findtext(details, "\[s\]") && (!usr || !usr.client.holder)) continue - . += "#[tm.number][details]" + . += "#[tm.number][details]" /client/verb/showrevinfo() set category = "OOC" @@ -65,8 +63,8 @@ GLOBAL_DATUM(revdata, /datum/getrev) if(GLOB.revdata.revision) msg += span_bold("Server revision:") + " B:[GLOB.revdata.branch] D:[GLOB.revdata.date]" - if(config.githuburl) - msg += span_bold("Commit:") + " [GLOB.revdata.revision]" + if(CONFIG_GET(string/githuburl)) + msg += span_bold("Commit:") + " [GLOB.revdata.revision]" else msg += span_bold("Commit:") + " GLOB.revdata.revision" else diff --git a/code/datums/managed_browsers/feedback_form.dm b/code/datums/managed_browsers/feedback_form.dm index d44b1265f6..15bf63f535 100644 --- a/code/datums/managed_browsers/feedback_form.dm +++ b/code/datums/managed_browsers/feedback_form.dm @@ -19,7 +19,7 @@ GENERAL_PROTECT_DATUM(/datum/managed_browser/feedback_form) var/feedback_hide_author = FALSE /datum/managed_browser/feedback_form/New(client/new_client) - feedback_topic = config.sqlite_feedback_topics[1] + feedback_topic = CONFIG_GET(str_list/sqlite_feedback_topics)[1] ..(new_client) /datum/managed_browser/feedback_form/Destroy() @@ -29,7 +29,7 @@ GENERAL_PROTECT_DATUM(/datum/managed_browser/feedback_form) // Privacy option is allowed if both the config allows it, and the pepper file exists and isn't blank. /datum/managed_browser/feedback_form/proc/can_be_private() - return config.sqlite_feedback_privacy && SSsqlite.get_feedback_pepper() + return CONFIG_GET(flag/sqlite_feedback_privacy) && SSsqlite.get_feedback_pepper() /datum/managed_browser/feedback_form/display() if(!my_client) @@ -70,10 +70,11 @@ GENERAL_PROTECT_DATUM(/datum/managed_browser/feedback_form) dat += my_client.ckey dat += "
" - if(config.sqlite_feedback_topics.len > 1) + var/list/sqlite_feedback_topics = CONFIG_GET(str_list/sqlite_feedback_topics) + if(sqlite_feedback_topics.len > 1) dat += "Topic: [href(src, list("feedback_choose_topic" = 1), feedback_topic)]
" else - dat += "Topic: [config.sqlite_feedback_topics[1]]
" + dat += "Topic: [sqlite_feedback_topics[1]]
" dat += "
" if(feedback_body) @@ -84,8 +85,8 @@ GENERAL_PROTECT_DATUM(/datum/managed_browser/feedback_form) dat += href(src, list("feedback_edit_body" = 1), "Edit") dat += "
" - if(config.sqlite_feedback_cooldown) - dat += "Please note that you will have to wait [config.sqlite_feedback_cooldown] day\s before \ + if(CONFIG_GET(number/sqlite_feedback_cooldown)) + dat += "Please note that you will have to wait [CONFIG_GET(number/sqlite_feedback_cooldown)] day\s before \ being able to write more feedback after submitting.
" dat += href(src, list("feedback_submit" = 1), "Submit") @@ -112,7 +113,7 @@ GENERAL_PROTECT_DATUM(/datum/managed_browser/feedback_form) return if(href_list["feedback_choose_topic"]) - feedback_topic = tgui_input_list(my_client, "Choose the topic you want to submit your feedback under.", "Feedback Topic", config.sqlite_feedback_topics) + feedback_topic = tgui_input_list(my_client, "Choose the topic you want to submit your feedback under.", "Feedback Topic", CONFIG_GET(str_list/sqlite_feedback_topics)) display() return diff --git a/code/datums/managed_browsers/feedback_viewer.dm b/code/datums/managed_browsers/feedback_viewer.dm index 59fbc679c4..078e2ca851 100644 --- a/code/datums/managed_browsers/feedback_viewer.dm +++ b/code/datums/managed_browsers/feedback_viewer.dm @@ -143,7 +143,7 @@ if(href_list["filter_topic"]) var/topic_to_search = tgui_input_text(my_client, "Write desired topic here. Partial topics are allowed. \ - \nThe current topics in the config are [english_list(config.sqlite_feedback_topics)].", "Filter by Topic", null) + \nThe current topics in the config are [english_list(CONFIG_GET(str_list/sqlite_feedback_topics))].", "Filter by Topic", null) if(topic_to_search) last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_TOPIC, topic_to_search) @@ -159,4 +159,4 @@ last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_DATETIME, datetime_to_search) // Refresh. - display() \ No newline at end of file + display() diff --git a/code/defines/procs/dbcore.dm b/code/defines/procs/dbcore.dm index 3a89c9ef8c..9367b26964 100644 --- a/code/defines/procs/dbcore.dm +++ b/code/defines/procs/dbcore.dm @@ -56,7 +56,7 @@ var/DB_PORT = 3306 // This is the port your MySQL server is running on (3306 is _db_con = _dm_db_new_con() /DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler) - if(!config.sql_enabled) + if(!CONFIG_GET(flag/sql_enabled)) return 0 if(!src) return 0 cursor_handler = src.default_cursor @@ -66,7 +66,7 @@ var/DB_PORT = 3306 // This is the port your MySQL server is running on (3306 is /DBConnection/proc/Disconnect() return _dm_db_close(_db_con) /DBConnection/proc/IsConnected() - if(!config.sql_enabled) return 0 + if(!CONFIG_GET(flag/sql_enabled)) return 0 var/success = _dm_db_is_connected(_db_con) return success @@ -76,7 +76,7 @@ var/DB_PORT = 3306 // This is the port your MySQL server is running on (3306 is /DBConnection/proc/SelectDB(database_name,dbi) if(IsConnected()) Disconnect() //return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[DB_SERVER]:[DB_PORT]"]",user,password) - return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[sqladdress]:[sqlport]"]",user,password) + return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[CONFIG_GET(string/address)]:[CONFIG_GET(number/port)]"]",user,password) /DBConnection/proc/NewQuery(sql_query,cursor_handler=src.default_cursor) return new/DBQuery(sql_query,src,cursor_handler) diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index 6ce55534de..d5e9e5942e 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -1,5 +1,5 @@ /proc/sql_poll_population() - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return var/admincount = GLOB.admins.len var/playercount = 0 @@ -18,15 +18,15 @@ /proc/sql_report_round_start() // TODO - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return /proc/sql_report_round_end() // TODO - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return /proc/sql_report_death(var/mob/living/carbon/human/H) - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return if(!H) return @@ -60,7 +60,7 @@ /proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H) - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return if(!H) return @@ -95,7 +95,7 @@ /proc/statistic_cycle() set waitfor = 0 - if(!sqllogging) + if(!CONFIG_GET(flag/log_sql)) return while(1) sql_poll_population() diff --git a/code/game/antagonist/alien/borer.dm b/code/game/antagonist/alien/borer.dm index f3465f5c66..c36cd16d31 100644 --- a/code/game/antagonist/alien/borer.dm +++ b/code/game/antagonist/alien/borer.dm @@ -63,7 +63,7 @@ var/datum/antagonist/borer/borers borer.forceMove(get_turf(pick(get_vents()))) /datum/antagonist/borer/attempt_random_spawn() - if(config.aliens_allowed) ..() + if(CONFIG_GET(flag/aliens_allowed)) ..() /datum/antagonist/borer/proc/get_vents() var/list/vents = list() diff --git a/code/game/antagonist/alien/xenomorph.dm b/code/game/antagonist/alien/xenomorph.dm index 493a5ed40c..2da4170fff 100644 --- a/code/game/antagonist/alien/xenomorph.dm +++ b/code/game/antagonist/alien/xenomorph.dm @@ -27,7 +27,7 @@ var/datum/antagonist/xenos/xenomorphs xenomorphs = src /datum/antagonist/xenos/attempt_random_spawn() - if(config.aliens_allowed) ..() + if(CONFIG_GET(flag/aliens_allowed)) ..() /datum/antagonist/xenos/proc/get_vents() var/list/vents = list() diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index e1f97252e1..d9d11999f3 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -91,7 +91,7 @@ get_starting_locations() if(!role_text_plural) role_text_plural = role_text - if(config.protect_roles_from_antagonist) + if(CONFIG_GET(flag/protect_roles_from_antagonist)) restricted_jobs |= protected_jobs if(antaghud_indicator) if(!hud_icon_reference) @@ -112,7 +112,7 @@ if(ghosts_only && !istype(player.current, /mob/observer/dead)) candidates -= player log_debug("[key_name(player)] is not eligible to become a [role_text]: Only ghosts may join as this role! They have been removed from the draft.") - else if(config.use_age_restriction_for_antags && player.current.client.player_age < minimum_player_age) + else if(CONFIG_GET(flag/use_age_restriction_for_antags) && player.current.client.player_age < minimum_player_age) candidates -= player log_debug("[key_name(player)] is not eligible to become a [role_text]: Is only [player.current.client.player_age] day\s old, has to be [minimum_player_age] day\s!") else if(player.special_role) diff --git a/code/game/antagonist/antagonist_create.dm b/code/game/antagonist/antagonist_create.dm index 50c18a85ed..7ea5782aa5 100644 --- a/code/game/antagonist/antagonist_create.dm +++ b/code/game/antagonist/antagonist_create.dm @@ -106,13 +106,13 @@ to_chat(player.current, span_notice("[leader_welcome_text]")) else to_chat(player.current, span_notice("[welcome_text]")) - if (config.objectives_disabled) + if (CONFIG_GET(flag/objectives_disabled)) to_chat(player.current, span_notice("[antag_text]")) if((flags & ANTAG_HAS_NUKE) && !spawned_nuke) create_nuke() - if (!config.objectives_disabled) + if (!CONFIG_GET(flag/objectives_disabled)) show_objectives(player) return 1 diff --git a/code/game/antagonist/antagonist_helpers.dm b/code/game/antagonist/antagonist_helpers.dm index ebf212f065..fc08d68e56 100644 --- a/code/game/antagonist/antagonist_helpers.dm +++ b/code/game/antagonist/antagonist_helpers.dm @@ -8,7 +8,7 @@ if(!ignore_role) if(player.assigned_role in restricted_jobs) return FALSE - if(config.protect_roles_from_antagonist && (player.assigned_role in protected_jobs)) + if(CONFIG_GET(flag/protect_roles_from_antagonist) && (player.assigned_role in protected_jobs)) return FALSE if(avoid_silicons) var/datum/job/J = SSjob.get_job(player.assigned_role) @@ -53,4 +53,4 @@ return 1 /datum/antagonist/proc/is_latejoin_template() - return (flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB)) \ No newline at end of file + return (flags & (ANTAG_OVERRIDE_MOB|ANTAG_OVERRIDE_JOB)) diff --git a/code/game/antagonist/antagonist_objectives.dm b/code/game/antagonist/antagonist_objectives.dm index 766e9c25ba..b8a5af5ada 100644 --- a/code/game/antagonist/antagonist_objectives.dm +++ b/code/game/antagonist/antagonist_objectives.dm @@ -1,12 +1,12 @@ /datum/antagonist/proc/create_global_objectives() - if(config.objectives_disabled) + if(CONFIG_GET(flag/objectives_disabled)) return 0 if(global_objectives && global_objectives.len) return 0 return 1 /datum/antagonist/proc/create_objectives(var/datum/mind/player) - if(config.objectives_disabled) + if(CONFIG_GET(flag/objectives_disabled)) return 0 if(create_global_objectives() || global_objectives.len) player.objectives |= global_objectives @@ -17,7 +17,7 @@ /datum/antagonist/proc/check_victory() var/result = 1 - if(config.objectives_disabled) + if(CONFIG_GET(flag/objectives_disabled)) return 1 if(global_objectives && global_objectives.len) for(var/datum/objective/O in global_objectives) diff --git a/code/game/antagonist/outsider/ninja.dm b/code/game/antagonist/outsider/ninja.dm index fdade370bf..7df32b76aa 100644 --- a/code/game/antagonist/outsider/ninja.dm +++ b/code/game/antagonist/outsider/ninja.dm @@ -23,7 +23,7 @@ var/datum/antagonist/ninja/ninjas ninjas = src /datum/antagonist/ninja/attempt_random_spawn() - if(config.ninjas_allowed) ..() + if(CONFIG_GET(flag/ninjas_allowed)) ..() /datum/antagonist/ninja/create_objectives(var/datum/mind/ninja) diff --git a/code/game/antagonist/outsider/raider.dm b/code/game/antagonist/outsider/raider.dm index da69efdc57..afdc49d211 100644 --- a/code/game/antagonist/outsider/raider.dm +++ b/code/game/antagonist/outsider/raider.dm @@ -152,7 +152,7 @@ var/datum/antagonist/raider/raiders var/win_msg = "" //No objectives, go straight to the feedback. - if(config.objectives_disabled || !global_objectives.len) + if(CONFIG_GET(flag/objectives_disabled) || !global_objectives.len) return var/success = global_objectives.len diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index 5a89afbddb..614eb7e981 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -428,7 +428,7 @@ occupantData["isViableSubject"] = 0 occupantData["health"] = connected.occupant.health occupantData["maxHealth"] = connected.occupant.maxHealth - occupantData["minHealth"] = config.health_threshold_dead + occupantData["minHealth"] = CONFIG_GET(number/health_threshold_dead) occupantData["uniqueEnzymes"] = connected.occupant.dna.unique_enzymes occupantData["uniqueIdentity"] = connected.occupant.dna.uni_identity occupantData["structuralEnzymes"] = connected.occupant.dna.struc_enzymes diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index d043c4aba2..15900cdeca 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -277,7 +277,7 @@ var/list/sacrificed = list() H.sdisabilities &= ~BLIND for(var/obj/item/organ/E in H.bad_external_organs) var/obj/item/organ/external/affected = E - if((affected.damage < affected.min_broken_damage * config.organ_health_multiplier) && (affected.status & ORGAN_BROKEN)) + if((affected.damage < affected.min_broken_damage * CONFIG_GET(number/organ_health_multiplier)) && (affected.status & ORGAN_BROKEN)) affected.status &= ~ORGAN_BROKEN for(var/datum/wound/W in affected.wounds) if(istype(W, /datum/wound/internal_bleeding)) diff --git a/code/game/gamemodes/cult/soulstone.dm b/code/game/gamemodes/cult/soulstone.dm index f0e78bc176..59c9c62e82 100644 --- a/code/game/gamemodes/cult/soulstone.dm +++ b/code/game/gamemodes/cult/soulstone.dm @@ -109,7 +109,7 @@ if(src.imprinted != "empty") to_chat(U, span_danger("Capture failed!") + ": The soul stone has already been imprinted with [src.imprinted]'s mind!") return - if ((T.health + T.halloss) > config.health_threshold_crit && T.stat != DEAD) + if ((T.health + T.halloss) > CONFIG_GET(number/health_threshold_crit) && T.stat != DEAD) to_chat(U, span_danger("Capture failed!") + ": Kill or maim the victim first!") return if(T.client == null) diff --git a/code/game/gamemodes/events/holidays/Other.dm b/code/game/gamemodes/events/holidays/Other.dm index bd64fda833..4f29575e09 100644 --- a/code/game/gamemodes/events/holidays/Other.dm +++ b/code/game/gamemodes/events/holidays/Other.dm @@ -3,8 +3,8 @@ hadevent = 1 message_admins("The apocalypse has begun! (this holiday event can be disabled by toggling events off within 60 seconds)") spawn(600) - if(!config.allow_random_events) return + if(!CONFIG_GET(flag/allow_random_events)) return Show2Group4Delay(ScreenText(null,"
GAME OVER
"),null,150) for(var/i=1,i<=4,i++) spawn_dynamic_event() - sleep(50) \ No newline at end of file + sleep(50) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index a9b4a81412..63da8cc334 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -148,10 +148,10 @@ var/global/list/additional_antag_types = list() playerC++ if(master_mode=="secret") - if(playerC < config.player_requirements_secret[config_tag]) + if(playerC < CONFIG_GET(keyed_list/player_requirements_secret)[config_tag]) return 0 else - if(playerC < config.player_requirements[config_tag]) + if(playerC < CONFIG_GET(keyed_list/player_requirements)[config_tag]) return 0 if(!(antag_templates && antag_templates.len)) @@ -272,7 +272,7 @@ var/global/list/additional_antag_types = list() for(var/datum/antagonist/antag in antag_templates) if(!antag.antags_are_dead()) return 0 - if(config.continous_rounds) + if(CONFIG_GET(flag/continuous_rounds)) emergency_shuttle.auto_recall = 0 return 0 return 1 @@ -444,7 +444,7 @@ var/global/list/additional_antag_types = list() /datum/game_mode/proc/create_antagonists() - if(!config.traitor_scaling) + if(!CONFIG_GET(flag/traitor_scaling)) antag_scaling_coeff = 0 if(antag_tags && antag_tags.len) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 0939c80ed4..9d60efdb65 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -33,7 +33,7 @@ var/list/nuke_disks = list() return 0 /datum/game_mode/nuclear/declare_completion() - if(config.objectives_disabled) + if(CONFIG_GET(flag/objectives_disabled)) ..() return var/disk_rescued = 1 diff --git a/code/game/gamemodes/technomancer/spells/mend_organs.dm b/code/game/gamemodes/technomancer/spells/mend_organs.dm index e9b7b39c1b..18856d5d35 100644 --- a/code/game/gamemodes/technomancer/spells/mend_organs.dm +++ b/code/game/gamemodes/technomancer/spells/mend_organs.dm @@ -44,7 +44,7 @@ for(var/obj/item/organ/E in H.bad_external_organs) // Fix bones var/obj/item/organ/external/affected = E - if((affected.damage < affected.min_broken_damage * config.organ_health_multiplier) && (affected.status & ORGAN_BROKEN)) + if((affected.damage < affected.min_broken_damage * CONFIG_GET(number/organ_health_multiplier)) && (affected.status & ORGAN_BROKEN)) affected.status &= ~ORGAN_BROKEN for(var/datum/wound/W in affected.wounds) // Fix IB diff --git a/code/game/jobs/job/assistant.dm b/code/game/jobs/job/assistant.dm index 9b2f4ef277..6aa9753352 100644 --- a/code/game/jobs/job/assistant.dm +++ b/code/game/jobs/job/assistant.dm @@ -24,7 +24,7 @@ ) */ //VOREStation Removal: no alt-titles for visitors /datum/job/assistant/get_access() - if(config.assistant_maint) + if(CONFIG_GET(flag/assistant_maint)) return list(access_maint_tunnels) else return list() diff --git a/code/game/jobs/job/assistant_vr.dm b/code/game/jobs/job/assistant_vr.dm index b52c28e635..c28d801acb 100644 --- a/code/game/jobs/job/assistant_vr.dm +++ b/code/game/jobs/job/assistant_vr.dm @@ -77,11 +77,11 @@ /datum/job/intern/New() ..() if(config) - total_positions = config.limit_interns - spawn_positions = config.limit_interns + total_positions = CONFIG_GET(number/limit_interns) + spawn_positions = CONFIG_GET(number/limit_interns) /datum/job/intern/get_access() - if(config.assistant_maint) + if(CONFIG_GET(flag/assistant_maint)) return list(access_maint_tunnels) else return list() @@ -102,8 +102,8 @@ /datum/job/assistant/New() ..() if(config) - total_positions = config.limit_visitors - spawn_positions = config.limit_visitors + total_positions = CONFIG_GET(number/limit_visitors) + spawn_positions = CONFIG_GET(number/limit_visitors) /datum/job/assistant/get_access() return list() diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index 70ac8c585d..b191d67072 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -98,7 +98,7 @@ . = outfit.equip_base(H, title, alt_title) /datum/job/proc/get_access() - if(!config || config.jobs_have_minimal_access) + if(!config || CONFIG_GET(flag/jobs_have_minimal_access)) return src.minimal_access.Copy() else return src.access.Copy() @@ -108,7 +108,7 @@ return (available_in_days(C) == 0) //Available in 0 days = available right now = player is old enough to play. /datum/job/proc/available_in_days(client/C) - if(C && config.use_age_restriction_for_jobs && isnum(C.player_age) && isnum(minimal_player_age)) + if(C && CONFIG_GET(flag/use_age_restriction_for_jobs) && isnum(C.player_age) && isnum(minimal_player_age)) return max(0, minimal_player_age - C.player_age) return 0 diff --git a/code/game/jobs/job/job_vr.dm b/code/game/jobs/job/job_vr.dm index ac8b6be0b4..3796714b5e 100644 --- a/code/game/jobs/job/job_vr.dm +++ b/code/game/jobs/job/job_vr.dm @@ -30,7 +30,7 @@ return (available_in_playhours(C) == 0) /datum/job/proc/available_in_playhours(client/C) - if(C && config.use_playtime_restriction_for_jobs && dept_time_required) + if(C && CONFIG_GET(flag/use_playtime_restriction_for_jobs) && dept_time_required) if(isnum(C.play_hours[pto_type])) // Has played that department before return max(0, dept_time_required - C.play_hours[pto_type]) else // List doesn't have that entry, maybe never played, maybe invalid PTO type (you should fix that...) @@ -41,7 +41,7 @@ // Captain gets every department combined /datum/job/captain/available_in_playhours(client/C) - if(C && config.use_playtime_restriction_for_jobs && dept_time_required) + if(C && CONFIG_GET(flag/use_playtime_restriction_for_jobs) && dept_time_required) var/remaining_time_needed = dept_time_required for(var/key in C.play_hours) if(isnum(C.play_hours[key]) && !(key == PTO_TALON)) @@ -51,7 +51,7 @@ // HoP gets civilian, cargo, and exploration combined /datum/job/hop/available_in_playhours(client/C) - if(C && config.use_playtime_restriction_for_jobs && dept_time_required) + if(C && CONFIG_GET(flag/use_playtime_restriction_for_jobs) && dept_time_required) var/remaining_time_needed = dept_time_required if(isnum(C.play_hours[PTO_CIVILIAN])) remaining_time_needed = max(0, remaining_time_needed - C.play_hours[PTO_CIVILIAN]) @@ -63,4 +63,4 @@ return 0 /datum/job/proc/get_request_reasons() - return list() \ No newline at end of file + return list() diff --git a/code/game/jobs/job/special_vr.dm b/code/game/jobs/job/special_vr.dm index da98eae50e..2d5f291ffc 100644 --- a/code/game/jobs/job/special_vr.dm +++ b/code/game/jobs/job/special_vr.dm @@ -76,7 +76,7 @@ title = JOB_ALT_FOOL /datum/job/clown/get_access() - if(config.assistant_maint) + if(CONFIG_GET(flag/assistant_maint)) return list(access_maint_tunnels, access_entertainment, access_clown, access_tomfoolery) else return list(access_entertainment, access_clown, access_tomfoolery) @@ -104,7 +104,7 @@ title = JOB_ALT_PASEUR /datum/job/mime/get_access() - if(config.assistant_maint) + if(CONFIG_GET(flag/assistant_maint)) return list(access_maint_tunnels, access_entertainment, access_tomfoolery, access_mime) else return list(access_entertainment, access_tomfoolery, access_mime) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 51bea0d1cc..30738ecd45 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -582,7 +582,7 @@ var/global/datum/controller/occupations/job_master return H /datum/controller/occupations/proc/LoadJobs(jobsfile) //ran during round setup, reads info from jobs.txt -- Urist - if(!config.load_jobs_from_txt) + if(!CONFIG_GET(flag/load_jobs_from_txt)) return 0 var/list/jobEntries = file2list(jobsfile) diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index d32da8494c..666209e628 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -3,7 +3,7 @@ var/list/whitelist = list() /hook/startup/proc/loadWhitelist() - if(config.usewhitelist) + if(CONFIG_GET(flag/usewhitelist)) load_whitelist() return 1 @@ -19,7 +19,7 @@ var/list/whitelist = list() /var/list/alien_whitelist = list() /hook/startup/proc/loadAlienWhitelist() - if(config.usealienwhitelist) + if(CONFIG_GET(flag/usealienwhitelist)) load_alienwhitelist() return 1 @@ -111,7 +111,7 @@ var/list/whitelist = list() return 1 /proc/whitelist_overrides(mob/M) - if(!config.usealienwhitelist) + if(!CONFIG_GET(flag/usealienwhitelist)) return TRUE if(check_rights(R_ADMIN|R_EVENT, 0, M)) return TRUE diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index fb5169200a..eb79632a00 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -190,7 +190,7 @@ occupantData["stat"] = occupant.stat occupantData["health"] = occupant.health occupantData["maxHealth"] = occupant.maxHealth - occupantData["minHealth"] = config.health_threshold_dead + occupantData["minHealth"] = CONFIG_GET(number/health_threshold_dead) occupantData["bruteLoss"] = occupant.getBruteLoss() occupantData["oxyLoss"] = occupant.getOxyLoss() occupantData["toxLoss"] = occupant.getToxLoss() diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index 7b65f83c74..ed07a6158b 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -68,7 +68,7 @@ occupantData["stat"] = occupant.stat occupantData["health"] = occupant.health occupantData["maxHealth"] = occupant.maxHealth - occupantData["minHealth"] = config.health_threshold_dead + occupantData["minHealth"] = CONFIG_GET(number/health_threshold_dead) occupantData["bruteLoss"] = occupant.getBruteLoss() occupantData["oxyLoss"] = occupant.getOxyLoss() occupantData["toxLoss"] = occupant.getToxLoss() diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index c98d4fb380..9efcb48130 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -336,7 +336,7 @@ set_temp("Error: Not enough biomass.", "danger") else if(pod.mess) set_temp("Error: The cloning pod is malfunctioning.", "danger") - else if(!config.revival_cloning) + else if(!CONFIG_GET(flag/revival_cloning)) set_temp("Error: Unable to initiate cloning cycle.", "danger") else cloneresult = pod.growclone(C) diff --git a/code/game/machinery/computer/timeclock_vr.dm b/code/game/machinery/computer/timeclock_vr.dm index 96c625609e..410ce817bd 100644 --- a/code/game/machinery/computer/timeclock_vr.dm +++ b/code/game/machinery/computer/timeclock_vr.dm @@ -101,7 +101,7 @@ "timeoff_factor" = job.timeoff_factor, "pto_department" = job.pto_type ) - if(config.time_off && config.pto_job_change) + if(CONFIG_GET(flag/time_off) && CONFIG_GET(flag/pto_job_change)) data["allow_change_job"] = TRUE if(job && job.timeoff_factor < 0) // Currently are Off Duty, so gotta lookup what on-duty jobs are open data["job_choices"] = getOpenOnDutyJobs(user, job.pto_type) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 17d8575629..70716c5ecf 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -113,7 +113,7 @@ occupantData["stat"] = occupant.stat occupantData["health"] = occupant.health occupantData["maxHealth"] = occupant.getMaxHealth() - occupantData["minHealth"] = config.health_threshold_dead + occupantData["minHealth"] = CONFIG_GET(number/health_threshold_dead) occupantData["bruteLoss"] = occupant.getBruteLoss() occupantData["oxyLoss"] = occupant.getOxyLoss() occupantData["toxLoss"] = occupant.getToxLoss() diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 8d8e52f6f1..7338689e33 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -19,7 +19,7 @@ generic_filth = TRUE means when the decal is saved, it will be switched out for age = _age if(random_icon_states && length(src.random_icon_states) > 0) src.icon_state = pick(src.random_icon_states) - if(!mapload || !config.persistence_ignore_mapload) + if(!mapload || !CONFIG_GET(flag/persistence_ignore_mapload)) SSpersistence.track_value(src, /datum/persistent/filth) jan_icon = new/obj/effect/decal/jan_hud(src.loc) . = ..() diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index f54adf376f..7e5f8cd930 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -1,7 +1,7 @@ //TODO: Flash range does nothing currently /proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, z_transfer = UP|DOWN, shaped) - var/multi_z_scalar = config.multi_z_explosion_scalar + var/multi_z_scalar = CONFIG_GET(number/multi_z_explosion_scalar) spawn(0) var/start = world.timeofday epicenter = get_turf(epicenter) @@ -71,7 +71,7 @@ var/x0 = epicenter.x var/y0 = epicenter.y var/z0 = epicenter.z - if(config.use_recursive_explosions) + if(CONFIG_GET(flag/use_recursive_explosions)) var/power = devastation_range * 2 + heavy_impact_range + light_impact_range //The ranges add up, ie light 14 includes both heavy 7 and devestation 3. So this calculation means devestation counts for 4, heavy for 2 and light for 1 power, giving us a cap of 27 power. explosion_rec(epicenter, power, shaped) else diff --git a/code/game/objects/items/contraband_vr.dm b/code/game/objects/items/contraband_vr.dm index f2d1a2b421..1052a490b6 100644 --- a/code/game/objects/items/contraband_vr.dm +++ b/code/game/objects/items/contraband_vr.dm @@ -59,7 +59,7 @@ /obj/item/toy/nanotrasenballoon, /obj/item/toy/syndicateballoon, /obj/item/aiModule/syndicate, - /obj/item/book/manual/engineering_hacking, + /obj/item/book/manual/wiki/engineering_hacking, /obj/item/card/emag, /obj/item/card/emag_broken, /obj/item/card/id/syndicate, diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 1d579f13ef..de7ca97e88 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -99,7 +99,7 @@ to_chat(user, "You finish drawing.") var/msg = "[user.client.key] ([user]) has drawn [drawtype] (with [src]) at [target.x],[target.y],[target.z]." - if(config.log_graffiti) + if(CONFIG_GET(flag/log_graffiti)) message_admins(msg) log_game(msg) //We will log it anyways. diff --git a/code/game/objects/items/devices/communicator/phone.dm b/code/game/objects/items/devices/communicator/phone.dm index 83e29b28fc..41b665535a 100644 --- a/code/game/objects/items/devices/communicator/phone.dm +++ b/code/game/objects/items/devices/communicator/phone.dm @@ -290,7 +290,7 @@ if(confirm != "Yes") return - if(config.antag_hud_restricted && has_enabled_antagHUD == 1) + if(CONFIG_GET(flag/antag_hud_restricted) && has_enabled_antagHUD == 1) to_chat(src, span_danger("You have used the antagHUD and cannot respawn or use communicators!")) return diff --git a/code/game/objects/items/devices/defib.dm b/code/game/objects/items/devices/defib.dm index 3efe3f8405..3c5da0ca3e 100644 --- a/code/game/objects/items/devices/defib.dm +++ b/code/game/objects/items/devices/defib.dm @@ -295,10 +295,10 @@ H.updatehealth() if(H.isSynthetic()) - if(H.health + H.getOxyLoss() + H.getToxLoss() <= config.health_threshold_dead) + if(H.health + H.getOxyLoss() + H.getToxLoss() <= CONFIG_GET(number/health_threshold_dead)) return "buzzes, \"Resuscitation failed - Severe damage detected. Begin manual repair before further attempts futile.\"" - else if(H.health + H.getOxyLoss() <= config.health_threshold_dead || (HUSK in H.mutations) || !H.can_defib) + else if(H.health + H.getOxyLoss() <= CONFIG_GET(number/health_threshold_dead) || (HUSK in H.mutations) || !H.can_defib) return "buzzes, \"Resuscitation failed - Severe tissue damage makes recovery of patient impossible via defibrillator. Further attempts futile.\"" var/bad_vital_organ = check_vital_organs(H) @@ -431,7 +431,7 @@ H.apply_damage(burn_damage_amt, BURN, BP_TORSO) //set oxyloss so that the patient is just barely in crit, if possible - var/barely_in_crit = config.health_threshold_crit - 1 + var/barely_in_crit = CONFIG_GET(number/health_threshold_crit) - 1 var/adjust_health = barely_in_crit - H.health //need to increase health by this much H.adjustOxyLoss(-adjust_health) @@ -516,7 +516,7 @@ // If the brain'd `defib_timer` var gets below this number, brain damage will happen at a linear rate. // This is measures in `Life()` ticks. E.g. 10 minute defib timer = 300 `Life()` ticks. // Original math was VERY off. Life() tick occurs every ~2 seconds, not every 2 world.time ticks. - var/brain_damage_timer = ((config.defib_timer MINUTES) / 20) - ((config.defib_braindamage_timer MINUTES) / 20) + var/brain_damage_timer = ((CONFIG_GET(number/defib_timer) MINUTES) / 20) - ((CONFIG_GET(number/defib_braindamage_timer) MINUTES) / 20) if(brain.defib_timer > brain_damage_timer) return // They got revived before brain damage got a chance to set in. diff --git a/code/game/objects/items/trash.dm b/code/game/objects/items/trash.dm index d2fd489351..41bab1e08f 100644 --- a/code/game/objects/items/trash.dm +++ b/code/game/objects/items/trash.dm @@ -17,7 +17,7 @@ age = _age /obj/item/trash/Initialize(mapload) - if(!mapload || !config.persistence_ignore_mapload) + if(!mapload || !CONFIG_GET(flag/persistence_ignore_mapload)) SSpersistence.track_value(src, /datum/persistent/filth/trash) . = ..() @@ -488,4 +488,4 @@ /obj/item/trash/candy/cb10 name = "\improper Shantak Bar wrapper" - icon_state = "cb10" \ No newline at end of file + icon_state = "cb10" diff --git a/code/game/objects/items/weapons/manuals.dm b/code/game/objects/items/weapons/manuals.dm index 1e2f22391a..d74de331de 100644 --- a/code/game/objects/items/weapons/manuals.dm +++ b/code/game/objects/items/weapons/manuals.dm @@ -5,29 +5,6 @@ due_date = 0 // Game time in 1/10th seconds unique = 1 // 0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified - -/obj/item/book/manual/engineering_construction - name = "Station Repairs and Construction" - icon_state ="bookEngineering" - item_state = "book3" - author = "Engineering Encyclopedia" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned - title = "Station Repairs and Construction" - -/obj/item/book/manual/engineering_construction/New() - ..() - dat = {" - - - - - - - - - - - "} - /obj/item/book/manual/engineering_particle_accelerator name = "Particle Accelerator User's Guide" icon_state ="bookParticleAccelerator" @@ -273,29 +250,6 @@ "} -/obj/item/book/manual/engineering_hacking - name = "Hacking" - icon_state ="bookHacking" - item_state = "book2" - author = "Engineering Encyclopedia" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned - title = "Hacking" - -/obj/item/book/manual/engineering_hacking/New() - ..() - dat = {" - - - - - - - - - - - "} - - /obj/item/book/manual/engineering_singularity_safety name = "Singularity Safety in Special Circumstances" icon_state ="bookEngineeringSingularitySafety" @@ -629,24 +583,6 @@ "} -/obj/item/book/manual/robotics_manual - name = "Guide to Robotics" - icon_state ="evabook" - item_state = "book3" - author = "Simple Robotics" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned - title = "Guide to Robotics" - -/obj/item/book/manual/robotics_manual/New() - ..() - dat = {" - - - - - - - "} - /obj/item/book/manual/robotics_cyborgs name = JOB_CYBORG + "s for Dummies" icon_state = "borgbook" @@ -852,103 +788,6 @@ "} - -/obj/item/book/manual/security_space_law - name = "Corporate Regulations" - desc = "A set of corporate guidelines for keeping law and order on privately-owned space stations." - icon_state = "bookSpaceLaw" - item_state = "book13" - author = "The Company" - title = "Corporate Regulations" - -/obj/item/book/manual/security_space_law/New() - ..() - dat = {" - - - - - - - - - - - "} - - - -/obj/item/book/manual/medical_diagnostics_manual - name = "Medical Diagnostics Manual" - desc = "First, do no harm. A detailed medical practitioner's guide." - icon_state = "bookMedical" - item_state = "book12" - author = "Medical Department" - title = "Medical Diagnostics Manual" - -/obj/item/book/manual/medical_diagnostics_manual/New() - ..() - dat = {" - - - - -
-

The Oath

- - The Medical Oath sworn by recognised medical practitioners in the employ of [using_map.company_name]
- -
    -
  1. Now, as a new doctor, I solemnly promise that I will, to the best of my ability, serve humanity-caring for the sick, promoting good health, and alleviating pain and suffering.
  2. -
  3. I recognise that the practice of medicine is a privilege with which comes considerable responsibility and I will not abuse my position.
  4. -
  5. I will practise medicine with integrity, humility, honesty, and compassion-working with my fellow doctors and other colleagues to meet the needs of my patients.
  6. -
  7. I shall never intentionally do or administer anything to the overall harm of my patients.
  8. -
  9. I will not permit considerations of gender, race, religion, political affiliation, sexual orientation, nationality, or social standing to influence my duty of care.
  10. -
  11. I will oppose policies in breach of human rights and will not participate in them. I will strive to change laws that are contrary to my profession's ethics and will work towards a fairer distribution of health resources.
  12. -
  13. I will assist my patients to make informed decisions that coincide with their own values and beliefs and will uphold patient confidentiality.
  14. -
  15. I will recognise the limits of my knowledge and seek to maintain and increase my understanding and skills throughout my professional life. I will acknowledge and try to remedy my own mistakes and honestly assess and respond to those of others.
  16. -
  17. I will seek to promote the advancement of medical knowledge through teaching and research.
  18. -
  19. I make this declaration solemnly, freely, and upon my honour.
  20. -

- -
- - - - - - "} - - -/obj/item/book/manual/engineering_guide - name = "Engineering Textbook" - icon_state ="bookEngineering2" - item_state = "book3" - author = "Engineering Encyclopedia" - title = "Engineering Textbook" - -/obj/item/book/manual/engineering_guide/New() - ..() - dat = {" - - - - - - - - - - "} - - /obj/item/book/manual/chef_recipes name = JOB_CHEF + " Recipes" icon_state = "cooked_book" diff --git a/code/game/objects/items/weapons/manuals_vr.dm b/code/game/objects/items/weapons/manuals_vr.dm index 563e49df9f..5411ab9c9d 100644 --- a/code/game/objects/items/weapons/manuals_vr.dm +++ b/code/game/objects/items/weapons/manuals_vr.dm @@ -6,7 +6,7 @@ author = "NanoTrasen" title = "Standard Operating Procedure" -/obj/item/book/manual/standard_operating_procedure/New() +/obj/item/book/manual/standard_operating_procedure/Initialize() ..() dat = {" @@ -14,7 +14,7 @@ - + @@ -29,7 +29,7 @@ author = "Jeremiah Acacius" title = "Corporate Regulations" -/obj/item/book/manual/command_guide/New() +/obj/item/book/manual/command_guide/Initialize() ..() dat = {" @@ -37,7 +37,7 @@ - + @@ -733,4 +733,4 @@ -"} \ No newline at end of file +"} diff --git a/code/game/objects/items/weapons/wiki_manuals.dm b/code/game/objects/items/weapons/wiki_manuals.dm new file mode 100644 index 0000000000..8ba6b68dab --- /dev/null +++ b/code/game/objects/items/weapons/wiki_manuals.dm @@ -0,0 +1,145 @@ +// Wiki books that are linked to the configured wiki link. + +/// The size of the window that the wiki books open in. +#define BOOK_WINDOW_BROWSE_SIZE "970x710" +/// This macro will resolve to code that will open up the associated wiki page in the window. +#define WIKI_PAGE_IFRAME(wikiurl, link_identifier) {" + + + + + + + +

You start skimming through the manual...

+ + + + "} + +// A book that links to the wiki +/obj/item/book/manual/wiki + dat = "Nanotrasen presently does not have any resources on this topic. If you would like to know more, contact your local Central Command representative." // safety + /// The ending URL of the page that we link to. + var/page_link = "" + +/obj/item/book/manual/wiki/display_content(mob/living/user) + var/wiki_url = CONFIG_GET(string/wikiurl) + if(!wiki_url) + //user.balloon_alert(user, "this book is empty!") + to_chat(user, span_info("this book is empty!")) + return + + //credit_book_to_reader(user) + DIRECT_OUTPUT(user, browse(WIKI_PAGE_IFRAME(wiki_url, page_link), "window=manual;size=[BOOK_WINDOW_BROWSE_SIZE]")) // if you change this GUARANTEE that it works. + +/obj/item/book/manual/wiki/engineering_construction + name = "Station Repairs and Construction" + icon_state ="bookEngineering" + item_state = "book3" + author = "Engineering Encyclopedia" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned + title = "Station Repairs and Construction" + + page_link = "Guide_to_Construction" + +/obj/item/book/manual/wiki/engineering_hacking + name = "Hacking" + icon_state ="bookHacking" + item_state = "book2" + author = "Engineering Encyclopedia" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned + title = "Hacking" + + page_link = "Hacking" + +/obj/item/book/manual/wiki/robotics_manual + name = "Guide to Robotics" + icon_state ="evabook" + item_state = "book3" + author = "Simple Robotics" // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned + title = "Guide to Robotics" + + page_link = "Guide_to_Robotics" + +/obj/item/book/manual/wiki/security_space_law + name = "Corporate Regulations" + desc = "A set of corporate guidelines for keeping law and order on privately-owned space stations." + icon_state = "bookSpaceLaw" + item_state = "book13" + author = "The Company" + title = "Corporate Regulations" + + page_link = "Corporate_Regulations" + +/obj/item/book/manual/wiki/medical_diagnostics_manual + name = "Medical Diagnostics Manual" + desc = "First, do no harm. A detailed medical practitioner's guide." + icon_state = "bookMedical" + item_state = "book12" + author = "Medical Department" + title = "Medical Diagnostics Manual" + +/obj/item/book/manual/wiki/medical_diagnostics_manual/display_content(mob/living/user) + var/wiki_url = CONFIG_GET(string/wikiurl) + if(!wiki_url) + //user.balloon_alert(user, "this book is empty!") + to_chat(user, span_info("this book is empty!")) + return + + var/dat = {" + + + + +
+

The Oath

+ + The Medical Oath sworn by recognised medical practitioners in the employ of [using_map.company_name]
+ +
    +
  1. Now, as a new doctor, I solemnly promise that I will, to the best of my ability, serve humanity-caring for the sick, promoting good health, and alleviating pain and suffering.
  2. +
  3. I recognise that the practice of medicine is a privilege with which comes considerable responsibility and I will not abuse my position.
  4. +
  5. I will practise medicine with integrity, humility, honesty, and compassion-working with my fellow doctors and other colleagues to meet the needs of my patients.
  6. +
  7. I shall never intentionally do or administer anything to the overall harm of my patients.
  8. +
  9. I will not permit considerations of gender, race, religion, political affiliation, sexual orientation, nationality, or social standing to influence my duty of care.
  10. +
  11. I will oppose policies in breach of human rights and will not participate in them. I will strive to change laws that are contrary to my profession's ethics and will work towards a fairer distribution of health resources.
  12. +
  13. I will assist my patients to make informed decisions that coincide with their own values and beliefs and will uphold patient confidentiality.
  14. +
  15. I will recognise the limits of my knowledge and seek to maintain and increase my understanding and skills throughout my professional life. I will acknowledge and try to remedy my own mistakes and honestly assess and respond to those of others.
  16. +
  17. I will seek to promote the advancement of medical knowledge through teaching and research.
  18. +
  19. I make this declaration solemnly, freely, and upon my honour.
  20. +

+ +
+ + + + + + "} + + //credit_book_to_reader(user) + DIRECT_OUTPUT(user, browse(dat, "window=manual;size=[BOOK_WINDOW_BROWSE_SIZE]")) // if you change this GUARANTEE that it works. + +/obj/item/book/manual/wiki/engineering_guide + name = "Engineering Textbook" + icon_state ="bookEngineering2" + item_state = "book3" + author = "Engineering Encyclopedia" + title = "Engineering Textbook" + + page_link = "Guide_to_Engineering" diff --git a/code/game/objects/structures/gravemarker.dm b/code/game/objects/structures/gravemarker.dm index f793a39bf0..fe00579c78 100644 --- a/code/game/objects/structures/gravemarker.dm +++ b/code/game/objects/structures/gravemarker.dm @@ -122,7 +122,7 @@ return if(usr.stat || usr.restrained()) return - if(ismouse(usr) || (isobserver(usr) && !config.ghost_interaction)) + if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction))) return src.set_dir(turn(src.dir, 270)) @@ -141,7 +141,7 @@ return if(usr.stat || usr.restrained()) return - if(ismouse(usr) || (isobserver(usr) && !config.ghost_interaction)) + if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction))) return src.set_dir(turn(src.dir, 90)) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 18337512c9..890f0bd345 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -75,7 +75,7 @@ return if(usr.stat || usr.restrained()) return - if(ismouse(usr) || (isobserver(usr) && !config.ghost_interaction)) + if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction))) return src.set_dir(turn(src.dir, 270)) @@ -89,7 +89,7 @@ return if(usr.stat || usr.restrained()) return - if(ismouse(usr) || (isobserver(usr) && !config.ghost_interaction)) + if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction))) return src.set_dir(turn(src.dir, 90)) diff --git a/code/game/objects/structures/trash_pile_vr.dm b/code/game/objects/structures/trash_pile_vr.dm index b77417d916..26d9b82066 100644 --- a/code/game/objects/structures/trash_pile_vr.dm +++ b/code/game/objects/structures/trash_pile_vr.dm @@ -83,7 +83,7 @@ return ..() /obj/structure/trash_pile/attack_ghost(mob/observer/user as mob) - if(config.disable_player_mice) + if(CONFIG_GET(flag/disable_player_mice)) to_chat(user, span_warning("Spawning as a mouse is currently disabled.")) return @@ -115,7 +115,7 @@ host = new /mob/living/simple_mob/animal/passive/mouse(get_turf(src)) if(host) - if(config.uneducated_mice) + if(CONFIG_GET(flag/uneducated_mice)) host.universal_understand = 0 announce_ghost_joinleave(src, 0, "They are now a mouse.") host.ckey = user.ckey diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 6d4c24f2d5..400e0d405d 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -13,7 +13,7 @@ var/forced_dirs = 0 //Force this one to pretend it's an overedge turf /turf/space/Initialize() - if(config.starlight) + if(CONFIG_GET(flag/starlight)) update_starlight() //Sprite stuff only beyond here @@ -75,7 +75,7 @@ /turf/space/proc/update_starlight() if(locate(/turf/simulated) in orange(src,1)) - set_light(config.starlight) + set_light(CONFIG_GET(flag/starlight)) else set_light(0) diff --git a/code/game/world.dm b/code/game/world.dm index bdeff6725f..3e4a5db544 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -32,16 +32,21 @@ to_world_log("Your server's byond version does not meet the recommended requirements for this server. Please update BYOND") TgsNew() - VgsNew() // VOREStation Edit - VGS - config.post_load() + config.Load(params[OVERRIDE_CONFIG_DIRECTORY_PARAMETER]) - if(config && config.server_name != null && config.server_suffix && world.port > 0) + ConfigLoaded() + makeDatumRefLists() + VgsNew() + + var servername = CONFIG_GET(string/servername) + if(config && servername != null && CONFIG_GET(flag/server_suffix) && world.port > 0) // dumb and hardcoded but I don't care~ - config.server_name += " #[(world.port % 1000) / 100]" + servername += " #[(world.port % 1000) / 100]" + CONFIG_SET(string/servername, servername) // TODO - Figure out what this is. Can you assign to world.log? - // if(config && config.log_runtime) + // if(config && CONFIG_FLAG(flag/log_runtime)) // log = file("data/logs/runtime/[time2text(world.realtime,"YYYY-MM-DD-(hh-mm-ss)")]-runtime.log") GLOB.timezoneOffset = get_timezone_offset() @@ -83,13 +88,29 @@ #endif spawn(3000) //so we aren't adding to the round-start lag - if(config.ToRban) + if(CONFIG_GET(flag/ToRban)) ToRban_autoupdate() #undef RECOMMENDED_VERSION return +/// Runs after config is loaded but before Master is initialized +/world/proc/ConfigLoaded() + // Everything in here is prioritized in a very specific way. + // If you need to add to it, ask yourself hard if what your adding is in the right spot + // (i.e. basically nothing should be added before load_admins() in here) + + // Try to set round ID + //SSdbcore.InitializeRound() TODO: Implement roundid on database subsystem and uncomment + + //apply a default value to config.python_path, if needed + if (!CONFIG_GET(string/python_path)) + if(world.system_type == UNIX) + CONFIG_SET(string/python_path, "/usr/bin/env python2") + else //probably windows, if not this should work anyway + CONFIG_SET(string/python_path, "python") + var/world_topic_spam_protect_ip = "0.0.0.0" var/world_topic_spam_protect_time = world.timeofday @@ -116,11 +137,11 @@ var/world_topic_spam_protect_time = world.timeofday var/list/s = list() s["version"] = game_version s["mode"] = master_mode - s["respawn"] = config.abandon_allowed - s["persistance"] = config.persistence_disabled - s["enter"] = config.enter_allowed - s["vote"] = config.allow_vote_mode - s["ai"] = config.allow_ai + s["respawn"] = CONFIG_GET(flag/abandon_allowed) + s["persistance"] = CONFIG_GET(flag/persistence_disabled) + s["enter"] = CONFIG_GET(flag/enter_allowed) + s["vote"] = CONFIG_GET(flag/allow_vote_mode) + s["ai"] = CONFIG_GET(flag/allow_ai) s["host"] = host ? host : null // This is dumb, but spacestation13.com's banners break if player count isn't the 8th field of the reply, so... this has to go here. @@ -238,7 +259,7 @@ var/world_topic_spam_protect_time = world.timeofday else if(copytext(T,1,5) == "info") var/input[] = params2list(T) - if(input["key"] != config.comms_password) + if(input["key"] != CONFIG_GET(string/comms_password)) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -325,7 +346,7 @@ var/world_topic_spam_protect_time = world.timeofday var/input[] = params2list(T) - if(input["key"] != config.comms_password) + if(input["key"] != CONFIG_GET(string/comms_password)) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -375,7 +396,7 @@ var/world_topic_spam_protect_time = world.timeofday 2. validationkey = the key the bot has, it should match the gameservers commspassword in it's configuration. */ var/input[] = params2list(T) - if(input["key"] != config.comms_password) + if(input["key"] != CONFIG_GET(string/comms_password)) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -390,7 +411,7 @@ var/world_topic_spam_protect_time = world.timeofday else if(copytext(T,1,4) == "age") var/input[] = params2list(T) - if(input["key"] != config.comms_password) + if(input["key"] != CONFIG_GET(string/comms_password)) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) world_topic_spam_protect_time = world.time @@ -426,8 +447,8 @@ var/world_topic_spam_protect_time = world.timeofday else Master.Shutdown() //run SS shutdowns for(var/client/C in GLOB.clients) - if(config.server) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite - C << link("byond://[config.server]") + if(CONFIG_GET(string/server)) //if you set a server location in config.txt, it sends you there instead of trying to reconnect to the same world address. -- NeoFite + C << link("byond://[CONFIG_GET(string/server)]") TgsReboot() log_world("World rebooted at [time_stamp()]") @@ -461,13 +482,14 @@ var/world_topic_spam_protect_time = world.timeofday /world/proc/load_motd() join_motd = file2text("config/motd.txt") - +/* Replaced with configuration controller /proc/load_configuration() config = new /datum/configuration() config.load("config/config.txt") config.load("config/game_options.txt","game_options") config.loadsql("config/dbconfig.txt") config.loadforumsql("config/forumdbconfig.txt") +*/ /hook/startup/proc/loadMods() world.load_mods() @@ -475,7 +497,7 @@ var/world_topic_spam_protect_time = world.timeofday return 1 /world/proc/load_mods() - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) var/text = file2text("config/moderators.txt") if (!text) error("Failed to load config/mods.txt") @@ -496,7 +518,7 @@ var/world_topic_spam_protect_time = world.timeofday D.associate(GLOB.directory[ckey]) /world/proc/load_mentors() - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) var/text = file2text("config/mentors.txt") if (!text) error("Failed to load config/mentors.txt") @@ -515,8 +537,8 @@ var/world_topic_spam_protect_time = world.timeofday /world/proc/update_status() var/s = "" - if (config && config.server_name) - s += span_bold("[config.server_name]") + " — " + if (config && CONFIG_GET(string/servername)) + s += span_bold("[CONFIG_GET(string/servername)]") + " — " s += span_bold("[station_name()]"); s += " (" @@ -534,19 +556,19 @@ var/world_topic_spam_protect_time = world.timeofday else features += span_bold("STARTING") - if (!config.enter_allowed) + if (!CONFIG_GET(flag/enter_allowed)) features += "closed" - features += config.abandon_allowed ? "respawn" : "no respawn" + features += CONFIG_GET(flag/abandon_allowed) ? "respawn" : "no respawn" - features += config.persistence_disabled ? "persistence disabled" : "persistence enabled" + features += CONFIG_GET(flag/persistence_disabled) ? "persistence disabled" : "persistence enabled" - features += config.persistence_ignore_mapload ? "persistence mapload disabled" : "persistence mapload enabled" + features += CONFIG_GET(flag/persistence_ignore_mapload) ? "persistence mapload disabled" : "persistence mapload enabled" - if (config && config.allow_vote_mode) + if (config && CONFIG_GET(flag/allow_vote_mode)) features += "vote" - if (config && config.allow_ai) + if (config && CONFIG_GET(flag/allow_ai)) features += "AI allowed" var/n = 0 @@ -560,8 +582,8 @@ var/world_topic_spam_protect_time = world.timeofday features += "~[n] player" - if (config && config.hostedby) - features += "hosted by [config.hostedby]" + if (config && CONFIG_GET(string/hostedby)) + features += "hosted by [CONFIG_GET(string/hostedby)]" if (features) s += ": [jointext(features, ", ")]" @@ -575,7 +597,7 @@ var/failed_db_connections = 0 var/failed_old_db_connections = 0 /hook/startup/proc/connectDB() - if(!config.sql_enabled) + if(!CONFIG_GET(flag/sql_enabled)) to_world_log("SQL connection disabled in config.") else if(!setup_database_connection()) to_world_log("Your server failed to establish a connection with the feedback database.") @@ -584,7 +606,7 @@ var/failed_old_db_connections = 0 return 1 /proc/setup_database_connection() - if(!config.sql_enabled) + if(!CONFIG_GET(flag/sql_enabled)) return 0 if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore. return 0 @@ -592,11 +614,11 @@ var/failed_old_db_connections = 0 if(!dbcon) dbcon = new() - var/user = sqlfdbklogin - var/pass = sqlfdbkpass - var/db = sqlfdbkdb - var/address = sqladdress - var/port = sqlport + var/user = CONFIG_GET(string/feedback_login) + var/pass = CONFIG_GET(string/feedback_password) + var/db = CONFIG_GET(string/feedback_database) + var/address = CONFIG_GET(string/address) + var/port = CONFIG_GET(number/port) dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]") . = dbcon.IsConnected() @@ -618,53 +640,6 @@ var/failed_old_db_connections = 0 else return 1 - -/hook/startup/proc/connectOldDB() - if(!config.sql_enabled) - to_world_log("SQL connection disabled in config.") - else if(!setup_old_database_connection()) - to_world_log("Your server failed to establish a connection with the SQL database.") - else - to_world_log("SQL database connection established.") - return 1 - -//These two procs are for the old database, while it's being phased out. See the tgstation.sql file in the SQL folder for more information. -/proc/setup_old_database_connection() - if(!config.sql_enabled) - return 0 - - if(failed_old_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore. - return 0 - - if(!dbcon_old) - dbcon_old = new() - - var/user = sqllogin - var/pass = sqlpass - var/db = sqldb - var/address = sqladdress - var/port = sqlport - - dbcon_old.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]") - . = dbcon_old.IsConnected() - if ( . ) - failed_old_db_connections = 0 //If this connection succeeded, reset the failed connections counter. - else - failed_old_db_connections++ //If it failed, increase the failed connections counter. - to_world_log(dbcon.ErrorMsg()) - - return . - -//This proc ensures that the connection to the feedback database (global variable dbcon) is established -/proc/establish_old_db_connection() - if(failed_old_db_connections > FAILED_DB_CONNECTION_CUTOFF) - return 0 - - if(!dbcon_old || !dbcon_old.IsConnected()) - return setup_old_database_connection() - else - return 1 - // Cleans up DB connections and recreates them /proc/reset_database_connections() var/list/results = list("-- Resetting DB connections --") @@ -679,7 +654,7 @@ var/failed_old_db_connections = 0 if(dbcon_old?.IsConnected()) results += "WARNING: dbcon_old is connected, not touching it, but is this intentional?" - if(!config.sql_enabled) + if(!CONFIG_GET(flag/sql_enabled)) results += "stopping because config.sql_enabled = false" else . = setup_database_connection() @@ -727,10 +702,10 @@ var/failed_old_db_connections = 0 /proc/get_world_url() . = "byond://" - if(config.serverurl) - . += config.serverurl - else if(config.server) - . += config.server + if(CONFIG_GET(string/serverurl)) + . += CONFIG_GET(string/serverurl) + else if(CONFIG_GET(string/server)) + . += CONFIG_GET(string/server) else . += "[world.address]:[world.port]" diff --git a/code/global.dm b/code/global.dm index 652345f980..3626077f06 100644 --- a/code/global.dm +++ b/code/global.dm @@ -83,8 +83,6 @@ var/list/reverse_dir = list( // reverse_dir[dir] = reverse of dir ) var/global/const/SQRT_TWO = 1.41421356237 -var/datum/configuration/config = null - var/list/combatlog = list() var/list/IClog = list() var/list/OOClog = list() diff --git a/code/global_init.dm b/code/global_init.dm index a9abaae9ad..bc9d0e4da5 100644 --- a/code/global_init.dm +++ b/code/global_init.dm @@ -23,9 +23,7 @@ var/global/datum/global_init/init = new () debug_log = file("[log_path]-debug.log") debug_log << "[log_end]\n[log_end]\nStarting up. [time_stamp()][log_end]\n---------------------[log_end]" */ //VOREStation Removal End - decls_repository = new() - load_configuration() - makeDatumRefLists() + decls_repository = new() initialize_integrated_circuits_list() diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 8248b3c683..af128e5722 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -5,21 +5,21 @@ return ..() //Guest Checking - if(!config.guests_allowed && IsGuestKey(key)) + if(!CONFIG_GET(flag/guests_allowed) && IsGuestKey(key)) log_adminwarn("Failed Login: [key] - Guests not allowed") message_admins(span_blue("Failed Login: [key] - Guests not allowed")) return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.") //check if the IP address is a known TOR node - if(config && config.ToRban && ToRban_isbanned(address)) + if(config && CONFIG_GET(flag/ToRban) && ToRban_isbanned(address)) log_adminwarn("Failed Login: [src] - Banned: ToR") message_admins(span_blue("Failed Login: [src] - Banned: ToR")) //ban their computer_id and ckey for posterity AddBan(ckey(key), computer_id, "Use of ToR", "Automated Ban", 0, 0) - return list("reason"="Using ToR", "desc"="\nReason: The network you are using to connect has been banned.\nIf you believe this is a mistake, please request help at [config.banappeals]") + return list("reason"="Using ToR", "desc"="\nReason: The network you are using to connect has been banned.\nIf you believe this is a mistake, please request help at [CONFIG_GET(string/banappeals)]") - if(config.ban_legacy_system) + if(CONFIG_GET(flag/ban_legacy_system)) //Ban Checking . = CheckBan( ckey(key), computer_id, address ) diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 345e44637a..75f50ca7c8 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -10,8 +10,8 @@ var/savefile/Banlist . = list() var/appeal - if(config && config.banappeals) - appeal = "\nFor more information on your ban, or to appeal, head to [config.banappeals]" + if(config && CONFIG_GET(string/banappeals)) + appeal = "\nFor more information on your ban, or to appeal, head to [CONFIG_GET(string/banappeals)]" Banlist.cd = "/base" if( "[ckey][id]" in Banlist.dir ) Banlist.cd = "[ckey][id]" diff --git a/code/modules/admin/ToRban.dm b/code/modules/admin/ToRban.dm index d8e39edfd9..939755222b 100644 --- a/code/modules/admin/ToRban.dm +++ b/code/modules/admin/ToRban.dm @@ -52,11 +52,11 @@ ToRban_update() if("toggle") if(config) - if(config.ToRban) - config.ToRban = 0 + if(CONFIG_GET(flag/ToRban)) + CONFIG_SET(flag/ToRban, FALSE) message_admins(span_red("ToR banning disabled.")) else - config.ToRban = 1 + CONFIG_SET(flag/ToRban, TRUE) message_admins(span_green("ToR banning enabled.")) if("show") var/savefile/F = new(TORFILE) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 4eb8e4172e..359e64b0db 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -757,8 +757,8 @@ var/datum/announcement/minor/admin_min_announcer = new if(!check_rights(R_ADMIN)) return - config.ooc_allowed = !(config.ooc_allowed) - if (config.ooc_allowed) + CONFIG_SET(flag/ooc_allowed, !CONFIG_GET(flag/ooc_allowed)) + if (CONFIG_GET(flag/ooc_allowed)) to_world(span_world("The OOC channel has been globally enabled!")) else to_world(span_world("The OOC channel has been globally disabled!")) @@ -773,8 +773,8 @@ var/datum/announcement/minor/admin_min_announcer = new if(!check_rights(R_ADMIN)) return - config.looc_allowed = !(config.looc_allowed) - if (config.looc_allowed) + CONFIG_SET(flag/looc_allowed, !CONFIG_GET(flag/looc_allowed)) + if (CONFIG_GET(flag/looc_allowed)) to_world(span_world("The LOOC channel has been globally enabled!")) else to_world(span_world("The LOOC channel has been globally disabled!")) @@ -790,8 +790,8 @@ var/datum/announcement/minor/admin_min_announcer = new if(!check_rights(R_ADMIN)) return - config.dsay_allowed = !(config.dsay_allowed) - if (config.dsay_allowed) + CONFIG_SET(flag/dsay_allowed, !CONFIG_GET(flag/dsay_allowed)) + if (CONFIG_GET(flag/dsay_allowed)) to_world(span_world("Deadchat has been globally enabled!")) else to_world(span_world("Deadchat has been globally disabled!")) @@ -807,7 +807,7 @@ var/datum/announcement/minor/admin_min_announcer = new if(!check_rights(R_ADMIN)) return - config.dooc_allowed = !( config.dooc_allowed ) + CONFIG_SET(flag/dooc_allowed, !CONFIG_GET(flag/dooc_allowed)) log_admin("[key_name(usr)] toggled Dead OOC.") message_admins("[key_name_admin(usr)] toggled Dead OOC.", 1) feedback_add_details("admin_verb","TDOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -829,9 +829,9 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Toggle traitor scaling" set name="Toggle Traitor Scaling" - config.traitor_scaling = !config.traitor_scaling - log_admin("[key_name(usr)] toggled Traitor Scaling to [config.traitor_scaling].") - message_admins("[key_name_admin(usr)] toggled Traitor Scaling [config.traitor_scaling ? "on" : "off"].", 1) + CONFIG_SET(flag/traitor_scaling, !CONFIG_GET(flag/traitor_scaling)) + log_admin("[key_name(usr)] toggled Traitor Scaling to [CONFIG_GET(flag/traitor_scaling)].") + message_admins("[key_name_admin(usr)] toggled Traitor Scaling [CONFIG_GET(flag/traitor_scaling) ? "on" : "off"].", 1) feedback_add_details("admin_verb","TTS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/startnow() @@ -861,8 +861,8 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="People can't enter" set name="Toggle Entering" - config.enter_allowed = !(config.enter_allowed) - if (!(config.enter_allowed)) + CONFIG_SET(flag/enter_allowed, !CONFIG_GET(flag/enter_allowed)) + if (!CONFIG_GET(flag/enter_allowed)) to_world(span_world("New players may no longer enter the game.")) else to_world(span_world("New players may now enter the game.")) @@ -875,8 +875,8 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="People can't be AI" set name="Toggle AI" - config.allow_ai = !( config.allow_ai ) - if (!( config.allow_ai )) + CONFIG_SET(flag/allow_ai, !CONFIG_GET(flag/allow_ai)) + if (!CONFIG_GET(flag/allow_ai)) to_world(span_world("The AI job is no longer chooseable.")) else to_world(span_world("The AI job is chooseable now.")) @@ -888,13 +888,13 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Respawn basically" set name="Toggle Respawn" - config.abandon_allowed = !(config.abandon_allowed) - if(config.abandon_allowed) + CONFIG_SET(flag/abandon_allowed, !CONFIG_GET(flag/abandon_allowed)) + if(CONFIG_GET(flag/abandon_allowed)) to_world(span_world("You may now respawn.")) else to_world(span_world("You may no longer respawn :(")) - message_admins(span_blue("[key_name_admin(usr)] toggled respawn to [config.abandon_allowed ? "On" : "Off"]."), 1) - log_admin("[key_name(usr)] toggled respawn to [config.abandon_allowed ? "On" : "Off"].") + message_admins(span_blue("[key_name_admin(usr)] toggled respawn to [CONFIG_GET(flag/abandon_allowed) ? "On" : "Off"]."), 1) + log_admin("[key_name(usr)] toggled respawn to [CONFIG_GET(flag/abandon_allowed) ? "On" : "Off"].") world.update_status() feedback_add_details("admin_verb","TR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -902,13 +902,13 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Whether persistent data will be saved from now on." set name="Toggle Persistent Data" - config.persistence_disabled = !(config.persistence_disabled) - if(!config.persistence_disabled) + CONFIG_SET(flag/persistence_disabled, !CONFIG_GET(flag/persistence_disabled)) + if(!CONFIG_GET(flag/persistence_disabled)) to_world(span_world("Persistence is now enabled.")) else to_world(span_world("Persistence is no longer enabled.")) - message_admins(span_blue("[key_name_admin(usr)] toggled persistence to [config.persistence_disabled ? "Off" : "On"]."), 1) - log_admin("[key_name(usr)] toggled persistence to [config.persistence_disabled ? "Off" : "On"].") + message_admins(span_blue("[key_name_admin(usr)] toggled persistence to [CONFIG_GET(flag/persistence_disabled) ? "Off" : "On"]."), 1) + log_admin("[key_name(usr)] toggled persistence to [CONFIG_GET(flag/persistence_disabled) ? "Off" : "On"].") world.update_status() feedback_add_details("admin_verb","TPD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -916,13 +916,13 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Whether mapload persistent data will be saved from now on." set name="Toggle Mapload Persistent Data" - config.persistence_ignore_mapload = !(config.persistence_ignore_mapload) - if(!config.persistence_ignore_mapload) + CONFIG_SET(flag/persistence_ignore_mapload, !CONFIG_GET(flag/persistence_ignore_mapload)) + if(!CONFIG_GET(flag/persistence_ignore_mapload)) to_world(span_world("Persistence is now enabled.")) else to_world(span_world("Persistence is no longer enabled.")) - message_admins(span_blue("[key_name_admin(usr)] toggled persistence to [config.persistence_ignore_mapload ? "Off" : "On"]."), 1) - log_admin("[key_name(usr)] toggled persistence to [config.persistence_ignore_mapload ? "Off" : "On"].") + message_admins(span_blue("[key_name_admin(usr)] toggled persistence to [CONFIG_GET(flag/persistence_ignore_mapload) ? "Off" : "On"]."), 1) + log_admin("[key_name(usr)] toggled persistence to [CONFIG_GET(flag/persistence_ignore_mapload) ? "Off" : "On"].") world.update_status() feedback_add_details("admin_verb","TMPD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -930,18 +930,18 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Toggle alien mobs" set name="Toggle Aliens" - config.aliens_allowed = !config.aliens_allowed - log_admin("[key_name(usr)] toggled Aliens to [config.aliens_allowed].") - message_admins("[key_name_admin(usr)] toggled Aliens [config.aliens_allowed ? "on" : "off"].", 1) + CONFIG_SET(flag/aliens_allowed, !CONFIG_GET(flag/aliens_allowed)) + log_admin("[key_name(usr)] toggled Aliens to [CONFIG_GET(flag/aliens_allowed)].") + message_admins("[key_name_admin(usr)] toggled Aliens [CONFIG_GET(flag/aliens_allowed) ? "on" : "off"].", 1) feedback_add_details("admin_verb","TA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/toggle_space_ninja() set category = "Server" set desc="Toggle space ninjas spawning." set name="Toggle Space Ninjas" - config.ninjas_allowed = !config.ninjas_allowed - log_admin("[key_name(usr)] toggled Space Ninjas to [config.ninjas_allowed].") - message_admins("[key_name_admin(usr)] toggled Space Ninjas [config.ninjas_allowed ? "on" : "off"].", 1) + CONFIG_SET(flag/ninjas_allowed, !CONFIG_GET(flag/ninjas_allowed)) + log_admin("[key_name(usr)] toggled Space Ninjas to [CONFIG_GET(flag/ninjas_allowed)].") + message_admins("[key_name_admin(usr)] toggled Space Ninjas [CONFIG_GET(flag/ninjas_allowed) ? "on" : "off"].", 1) feedback_add_details("admin_verb","TSN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/delay() @@ -968,24 +968,24 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Toggle admin jumping" set name="Toggle Jump" - config.allow_admin_jump = !(config.allow_admin_jump) - message_admins(span_blue("Toggled admin jumping to [config.allow_admin_jump].")) + CONFIG_SET(flag/allow_admin_jump, !CONFIG_GET(flag/allow_admin_jump)) + message_admins(span_blue("Toggled admin jumping to [CONFIG_GET(flag/allow_admin_jump)].")) feedback_add_details("admin_verb","TJ") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/adspawn() set category = "Server" set desc="Toggle admin spawning" set name="Toggle Spawn" - config.allow_admin_spawning = !(config.allow_admin_spawning) - message_admins(span_blue("Toggled admin item spawning to [config.allow_admin_spawning].")) + CONFIG_SET(flag/allow_admin_spawning, !CONFIG_GET(flag/allow_admin_spawning)) + message_admins(span_blue("Toggled admin item spawning to [CONFIG_GET(flag/allow_admin_spawning)].")) feedback_add_details("admin_verb","TAS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/adrev() set category = "Server" set desc="Toggle admin revives" set name="Toggle Revive" - config.allow_admin_rev = !(config.allow_admin_rev) - message_admins(span_blue("Toggled reviving to [config.allow_admin_rev].")) + CONFIG_SET(flag/allow_admin_rev, !CONFIG_GET(flag/allow_admin_rev)) + message_admins(span_blue("Toggled reviving to [CONFIG_GET(flag/allow_admin_rev)].")) feedback_add_details("admin_verb","TAR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/immreboot() @@ -1010,7 +1010,7 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Admin" set name = "Unprison" if (M.z == 2) - if (config.allow_admin_jump) + if (CONFIG_GET(flag/allow_admin_jump)) M.loc = pick(latejoin) message_admins("[key_name_admin(usr)] has unprisoned [key_name_admin(M)]", 1) log_admin("[key_name(usr)] has unprisoned [key_name(M)]") @@ -1242,8 +1242,8 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Debug" set desc="Reduces view range when wearing welding helmets" set name="Toggle tinted welding helmets." - config.welder_vision = !( config.welder_vision ) - if (config.welder_vision) + CONFIG_SET(flag/welder_vision, !CONFIG_GET(flag/welder_vision)) + if (CONFIG_GET(flag/welder_vision)) to_world(span_world("Reduced welder vision has been enabled!")) else to_world(span_world("Reduced welder vision has been disabled!")) @@ -1255,13 +1255,13 @@ var/datum/announcement/minor/admin_min_announcer = new set category = "Server" set desc="Guests can't enter" set name="Toggle guests" - config.guests_allowed = !(config.guests_allowed) - if (!(config.guests_allowed)) + CONFIG_SET(flag/guests_allowed, !CONFIG_GET(flag/guests_allowed)) + if (!CONFIG_GET(flag/guests_allowed)) to_world(span_world("Guests may no longer enter the game.")) else to_world(span_world("Guests may now enter the game.")) - log_admin("[key_name(usr)] toggled guests game entering [config.guests_allowed?"":"dis"]allowed.") - message_admins(span_blue("[key_name_admin(usr)] toggled guests game entering [config.guests_allowed?"":"dis"]allowed."), 1) + log_admin("[key_name(usr)] toggled guests game entering [CONFIG_GET(flag/guests_allowed)?"":"dis"]allowed.") + message_admins(span_blue("[key_name_admin(usr)] toggled guests game entering [CONFIG_GET(flag/guests_allowed)?"":"dis"]allowed."), 1) feedback_add_details("admin_verb","TGU") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /datum/admins/proc/output_ai_laws() diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm index 567f5c7669..c2317542fb 100644 --- a/code/modules/admin/admin_investigate.dm +++ b/code/modules/admin/admin_investigate.dm @@ -39,7 +39,7 @@ src << browse(F,"window=investigate[subject];size=800x300") if("hrefs") //persistant logs and stuff - if(config && config.log_hrefs) + if(config && CONFIG_GET(flag/log_hrefs)) if(href_logfile) src << browse(href_logfile,"window=investigate[subject];size=800x300") else diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index d1dd7b7eda..1105ebcf09 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -69,7 +69,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights C.holder = null GLOB.admins.Cut() - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) load_admin_ranks() //load text from file @@ -109,7 +109,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights if(!dbcon.IsConnected()) error("Failed to connect to database in load_admins(). Reverting to legacy system.") log_misc("Failed to connect to database in load_admins(). Reverting to legacy system.") - config.admin_legacy_system = 1 + CONFIG_SET(flag/admin_legacy_system, TRUE) load_admins() return @@ -129,7 +129,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights if(!admin_datums) error("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.") log_misc("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.") - config.admin_legacy_system = 1 + CONFIG_SET(flag/admin_legacy_system, TRUE) load_admins() return diff --git a/code/modules/admin/admin_verb_lists_vr.dm b/code/modules/admin/admin_verb_lists_vr.dm index 4ab7d8c6e6..28c9550ef8 100644 --- a/code/modules/admin/admin_verb_lists_vr.dm +++ b/code/modules/admin/admin_verb_lists_vr.dm @@ -577,7 +577,7 @@ var/list/admin_verbs_event_manager = list( if(holder.rights & R_SERVER) add_verb(src, admin_verbs_server) if(holder.rights & R_DEBUG) add_verb(src, admin_verbs_debug) - if(config.debugparanoid && !(holder.rights & R_ADMIN)) + if(CONFIG_GET(flag/debugparanoid) && !(holder.rights & R_ADMIN)) remove_verb(src, admin_verbs_paranoid_debug) //Right now it's just callproc but we can easily add others later on. if(holder.rights & R_POSSESS) add_verb(src, admin_verbs_possess) if(holder.rights & R_PERMISSIONS) add_verb(src, admin_verbs_permissions) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 8554744549..5e2685917e 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -125,7 +125,7 @@ set name = "Display Job bans" set category = "Admin" if(holder) - if(config.ban_legacy_system) + if(CONFIG_GET(flag/ban_legacy_system)) holder.Jobbans() else holder.DB_ban_panel() @@ -136,7 +136,7 @@ set name = "Unban Panel" set category = "Admin" if(holder) - if(config.ban_legacy_system) + if(CONFIG_GET(flag/ban_legacy_system)) holder.unbanpanel() else holder.DB_ban_panel() @@ -409,8 +409,8 @@ set category = "Server" if(!holder) return if(config) - config.log_hrefs = !config.log_hrefs - message_admins(span_bold("[key_name_admin(usr)] [config.log_hrefs ? "started" : "stopped"] logging hrefs")) + CONFIG_SET(flag/log_hrefs, !CONFIG_GET(flag/log_hrefs)) + message_admins(span_bold("[key_name_admin(usr)] [CONFIG_GET(flag/log_hrefs) ? "started" : "stopped"] logging hrefs")) /client/proc/check_ai_laws() set name = "Check AI Laws" @@ -511,16 +511,16 @@ set category = "Server" if(!holder) return if(config) - config.cult_ghostwriter = !config.cult_ghostwriter - message_admins("Admin [key_name_admin(usr)] has [config.cult_ghostwriter ? "en" : "dis"]abled ghost writers.", 1) + CONFIG_SET(flag/cult_ghostwriter, !CONFIG_GET(flag/cult_ghostwriter)) + message_admins("Admin [key_name_admin(usr)] has [CONFIG_GET(flag/cult_ghostwriter) ? "en" : "dis"]abled ghost writers.", 1) /client/proc/toggledrones() set name = "Toggle maintenance drones" set category = "Server" if(!holder) return if(config) - config.allow_drone_spawn = !config.allow_drone_spawn - message_admins("Admin [key_name_admin(usr)] has [config.allow_drone_spawn ? "en" : "dis"]abled maintenance drones.", 1) + CONFIG_SET(flag/allow_drone_spawn, !CONFIG_GET(flag/allow_drone_spawn)) + message_admins("Admin [key_name_admin(usr)] has [CONFIG_GET(flag/allow_drone_spawn) ? "en" : "dis"]abled maintenance drones.", 1) /client/proc/man_up(mob/T as mob in mob_list) set category = "Fun" diff --git a/code/modules/admin/admin_verbs_vr.dm b/code/modules/admin/admin_verbs_vr.dm index 1003187251..d6552d1e56 100644 --- a/code/modules/admin/admin_verbs_vr.dm +++ b/code/modules/admin/admin_verbs_vr.dm @@ -94,7 +94,7 @@ var/dat = "Book Inventory Management\n" dat += "

ADMINISTRATIVE MANAGEMENT

" - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) dat += "ERROR: Unable to contact External Archive. Please contact your system administrator for assistance." @@ -132,8 +132,8 @@ var/which = tgui_alert(usr, "Which do you want to toggle?", "Choose Recolour Toggle", list("Robot", "Simple Mob")) switch(which) if("Robot") - config.allow_robot_recolor = !config.allow_robot_recolor - to_chat(usr, "You have [config.allow_robot_recolor ? "enabled" : "disabled"] newly spawned cyborgs to spawn with the recolour verb") + CONFIG_SET(flag/allow_robot_recolor, !CONFIG_GET(flag/allow_robot_recolor)) + to_chat(usr, "You have [CONFIG_GET(flag/allow_robot_recolor) ? "enabled" : "disabled"] newly spawned cyborgs to spawn with the recolour verb") if("Simple Mob") - config.allow_simple_mob_recolor = !config.allow_simple_mob_recolor - to_chat(usr, "You have [config.allow_simple_mob_recolor ? "enabled" : "disabled"] newly spawned simple mobs to spawn with the recolour verb") + CONFIG_SET(flag/allow_simple_mob_recolor, !CONFIG_GET(flag/allow_simple_mob_recolor)) + to_chat(usr, "You have [CONFIG_GET(flag/allow_simple_mob_recolor) ? "enabled" : "disabled"] newly spawned simple mobs to spawn with the recolour verb") diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index 15d169fb26..cf45b9d0db 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -21,9 +21,9 @@ var/jobban_keylist[0] //to store the keys & ranks */ if (guest_jobbans(rank)) - if(config.guest_jobban && IsGuestKey(M.key)) + if(CONFIG_GET(flag/guest_jobban) && IsGuestKey(M.key)) return "Guest Job-ban" - if(config.usewhitelist && !check_whitelist(M)) + if(CONFIG_GET(flag/usewhitelist) && !check_whitelist(M)) return "Whitelisted Job" return ckey_is_jobbanned(M.ckey, rank) @@ -59,7 +59,7 @@ DEBUG return 1 /proc/jobban_loadbanfile() - if(config.ban_legacy_system) + if(CONFIG_GET(flag/ban_legacy_system)) var/savefile/S=new("data/job_full.ban") S["keys[0]"] >> jobban_keylist log_admin("Loading jobban_rank") @@ -72,7 +72,7 @@ DEBUG if(!establish_db_connection()) error("Database connection failed. Reverting to the legacy ban system.") log_misc("Database connection failed. Reverting to the legacy ban system.") - config.ban_legacy_system = 1 + CONFIG_SET(flag/ban_legacy_system, TRUE) jobban_loadbanfile() return diff --git a/code/modules/admin/permissionverbs/permissionedit.dm b/code/modules/admin/permissionverbs/permissionedit.dm index 4545220433..d94aec94bd 100644 --- a/code/modules/admin/permissionverbs/permissionedit.dm +++ b/code/modules/admin/permissionverbs/permissionedit.dm @@ -45,7 +45,7 @@ usr << browse(output,"window=editrights;size=600x500") /datum/admins/proc/log_admin_rank_modification(var/adm_ckey, var/new_rank) - if(config.admin_legacy_system) return + if(CONFIG_GET(flag/admin_legacy_system)) return if(!usr.client) return @@ -95,7 +95,7 @@ to_chat(usr, span_filter_adminlog("[span_blue("Admin rank changed.")]")) /datum/admins/proc/log_admin_permission_modification(var/adm_ckey, var/new_permission) - if(config.admin_legacy_system) return + if(CONFIG_GET(flag/admin_legacy_system)) return if(!usr.client) return diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 87c5ff332d..8cd661c468 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -175,19 +175,19 @@ if(null,"") return if("*New Rank*") new_rank = tgui_input_text(usr, "Please input a new rank", "New custom rank") - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) new_rank = ckeyEx(new_rank) if(!new_rank) to_chat(usr, span_filter_adminlog(span_warning("Error: Topic 'editrights': Invalid rank"))) return - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) if(admin_ranks.len) if(new_rank in admin_ranks) rights = admin_ranks[new_rank] //we typed a rank which already exists, use its rights else admin_ranks[new_rank] = 0 //add the new rank to admin_ranks else - if(config.admin_legacy_system) + if(CONFIG_GET(flag/admin_legacy_system)) new_rank = ckeyEx(new_rank) rights = admin_ranks[new_rank] //we input an existing rank, use its rights @@ -679,7 +679,7 @@ to_chat(usr, span_filter_adminlog(span_warning("You do not have the appropriate permissions to add job bans!"))) return - if(check_rights(R_MOD,0) && !check_rights(R_ADMIN,0) && !config.mods_can_job_tempban) // If mod and tempban disabled + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN,0) && !CONFIG_GET(flag/mods_can_job_tempban)) // If mod and tempban disabled to_chat(usr, span_filter_adminlog(span_warning("Mod jobbanning is disabled!"))) return @@ -782,14 +782,14 @@ if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0)) to_chat(usr, span_filter_adminlog(span_warning("You cannot issue temporary job-bans!"))) return - if(config.ban_legacy_system) + if(CONFIG_GET(flag/ban_legacy_system)) to_chat(usr, span_filter_adminlog(span_warning("Your server is using the legacy banning system, which does not support temporary job bans. Consider upgrading. Aborting ban."))) return var/mins = tgui_input_number(usr,"How long (in minutes)?","Ban time",1440) if(!mins) return - if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > config.mod_job_tempban_max) - to_chat(usr, span_filter_adminlog(span_warning("Moderators can only job tempban up to [config.mod_job_tempban_max] minutes!"))) + if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > CONFIG_GET(number/mod_job_tempban_max)) + to_chat(usr, span_filter_adminlog(span_warning("Moderators can only job tempban up to [CONFIG_GET(number/mod_job_tempban_max)] minutes!"))) return var/reason = sanitize(tgui_input_text(usr,"Reason?","Please State Reason","")) if(!reason) @@ -841,7 +841,7 @@ //Unbanning joblist //all jobs in joblist are banned already OR we didn't give a reason (implying they shouldn't be banned) if(joblist.len) //at least 1 banned job exists in joblist so we have stuff to unban. - if(!config.ban_legacy_system) + if(!CONFIG_GET(flag/ban_legacy_system)) to_chat(usr, span_filter_adminlog("Unfortunately, database based unbanning cannot be done through this panel")) DB_ban_panel(M.ckey) return @@ -904,7 +904,7 @@ to_chat(usr, span_warning("You do not have the appropriate permissions to add bans!")) return - if(check_rights(R_MOD,0) && !check_rights(R_ADMIN, 0) && !config.mods_can_job_tempban) // If mod and tempban disabled + if(check_rights(R_MOD,0) && !check_rights(R_ADMIN, 0) && !CONFIG_GET(flag/mods_can_job_tempban)) // If mod and tempban disabled to_chat(usr, span_warning("Mod jobbanning is disabled!")) return @@ -920,8 +920,8 @@ var/mins = tgui_input_number(usr,"How long (in minutes)?","Ban time",1440) if(!mins) return - if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > config.mod_tempban_max) - to_chat(usr, span_warning("Moderators can only job tempban up to [config.mod_tempban_max] minutes!")) + if(check_rights(R_MOD, 0) && !check_rights(R_BAN, 0) && mins > CONFIG_GET(number/mod_tempban_max)) + to_chat(usr, span_warning("Moderators can only job tempban up to [CONFIG_GET(number/mod_tempban_max)] minutes!")) return if(mins >= 525600) mins = 525599 var/reason = sanitize(tgui_input_text(usr,"Reason?","reason","Griefer")) @@ -935,8 +935,8 @@ feedback_inc("ban_tmp",1) DB_ban_record(BANTYPE_TEMP, M, mins, reason) feedback_inc("ban_tmp_mins",mins) - if(config.banappeals) - to_chat(M, span_filter_system(span_warning("To try to resolve this matter head to [config.banappeals]"))) + if(CONFIG_GET(string/banappeals)) + to_chat(M, span_filter_system(span_warning("To try to resolve this matter head to [CONFIG_GET(string/banappeals)]"))) else to_chat(M, span_filter_system(span_warning("No ban appeals URL has been set."))) log_admin("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis will be removed in [mins] minutes.") @@ -959,8 +959,8 @@ AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0) to_chat(M, span_filter_system(span_critical("You have been banned by [usr.client.ckey].\nReason: [reason]."))) to_chat(M, span_filter_system(span_warning("This is a permanent ban."))) - if(config.banappeals) - to_chat(M, span_filter_system(span_warning("To try to resolve this matter head to [config.banappeals]"))) + if(CONFIG_GET(string/banappeals)) + to_chat(M, span_filter_system(span_warning("To try to resolve this matter head to [CONFIG_GET(string/banappeals)]"))) else to_chat(M, span_filter_system(span_warning("No ban appeals URL has been set."))) ban_unban_log_save("[usr.client.ckey] has permabanned [M.ckey]. - Reason: [reason] - This is a permanent ban.") @@ -1253,7 +1253,7 @@ to_chat(usr, span_filter_adminlog("This can only be used on instances of type /mob/living")) return - if(config.allow_admin_rev) + if(CONFIG_GET(flag/allow_admin_rev)) L.revive() message_admins(span_red("Admin [key_name_admin(usr)] healed / revived [key_name_admin(L)]!"), 1) log_admin("[key_name(usr)] healed / Rrvived [key_name(L)]") @@ -1361,13 +1361,13 @@ to_chat(X, take_msg) to_chat(M, span_filter_pm(span_boldnotice("Your adminhelp is being attended to by [usr.client]. Thanks for your patience!"))) // VoreStation Edit Start - if (config.chat_webhook_url) + if (CONFIG_GET(string/chat_webhook_url)) spawn(0) var/query_string = "type=admintake" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&admin=[url_encode(key_name(usr.client))]" query_string += "&user=[url_encode(key_name(M))]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") // VoreStation Edit End else to_chat(usr, span_warning("Unable to locate mob.")) @@ -1580,7 +1580,7 @@ else if(href_list["jumpto"]) if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(!config.allow_admin_jump) + if(!CONFIG_GET(flag/allow_admin_jump)) tgui_alert_async(usr, "Admin jumping disabled") return @@ -1600,7 +1600,7 @@ else if(href_list["getmob"]) if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(!config.allow_admin_jump) + if(!CONFIG_GET(flag/allow_admin_jump)) tgui_alert_async(usr, "Admin jumping disabled") return if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes") @@ -1619,7 +1619,7 @@ else if(href_list["sendmob"]) if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(!config.allow_admin_jump) + if(!CONFIG_GET(flag/allow_admin_jump)) tgui_alert_async(usr, "Admin jumping disabled") return @@ -1687,7 +1687,7 @@ else if(href_list["object_list"]) //this is the laggiest thing ever if(!check_rights(R_SPAWN)) return - if(!config.allow_admin_spawning) + if(!CONFIG_GET(flag/allow_admin_spawning)) to_chat(usr, span_filter_adminlog("Spawning of items is not allowed.")) return diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index e25c1cd4cc..6c3da08252 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -435,10 +435,10 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) log_admin(msg) AddInteraction("[key_name_admin(usr)] is now handling this ticket.") var/query_string = "type=admintake" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&admin=[url_encode(key_name(usr))]" query_string += "&user=[url_encode(key_name(initiator))]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") diff --git a/code/modules/admin/verbs/adminhelp_vr.dm b/code/modules/admin/verbs/adminhelp_vr.dm index 4f694ee1b9..eb02d4aa0a 100644 --- a/code/modules/admin/verbs/adminhelp_vr.dm +++ b/code/modules/admin/verbs/adminhelp_vr.dm @@ -1,5 +1,5 @@ /datum/admin_help/proc/send2adminchat() - if(!config.chat_webhook_url) + if(!CONFIG_GET(string/chat_webhook_url)) return var/list/adm = get_admin_counts() @@ -8,12 +8,12 @@ spawn(0) //Unreliable world.Exports() var/query_string = "type=adminhelp" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&from=[url_encode(key_name(initiator))]" query_string += "&msg=[url_encode(html_decode(name))]" query_string += "&admin_number=[allmins.len]" query_string += "&admin_number_afk=[afkmins.len]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") /client/verb/adminspice() set category = "Admin" diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index aa4374ac06..7b902c675d 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -11,7 +11,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(!config.allow_admin_jump) + if(!CONFIG_GET(flag/allow_admin_jump)) tgui_alert_async(usr, "Admin jumping disabled") return @@ -36,7 +36,7 @@ set category = "Admin" if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) log_admin("[key_name(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]") message_admins("[key_name_admin(usr)] jumped to [T.x],[T.y],[T.z] in [T.loc]", 1) usr.on_mob_jump() @@ -59,7 +59,7 @@ /// Performs the jumps, also called from admin Topic() for JMP links /client/proc/do_jumptomob(var/mob/M) - if(!config.allow_admin_jump) + if(!CONFIG_GET(flag/allow_admin_jump)) tgui_alert_async(usr, "Admin jumping disabled") return @@ -86,7 +86,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if (config.allow_admin_jump) + if (CONFIG_GET(flag/allow_admin_jump)) if(src.mob) var/mob/A = src.mob A.on_mob_jump() @@ -108,7 +108,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) var/list/keys = list() for(var/mob/M in player_list) keys += M.client @@ -132,7 +132,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) if(!M) //VOREStation Edit M = tgui_input_list(usr, "Pick a mob:", "Get Mob", mob_list) //VOREStation Edit if(!M) @@ -155,7 +155,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) var/list/keys = list() for(var/mob/M in player_list) keys += M.client @@ -183,7 +183,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) var/area/A = tgui_input_list(usr, "Pick an area:", "Send Mob", return_sorted_areas()) if(!A) return @@ -208,7 +208,7 @@ if(!check_rights(R_ADMIN|R_DEBUG|R_EVENT)) return - if(config.allow_admin_jump) + if(CONFIG_GET(flag/allow_admin_jump)) if(isnull(tx)) tx = tgui_input_number(usr, "Select X coordinate", "Move Atom", null, null) if(!tx) return diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index c5624d5ab0..792e6e04a9 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -184,7 +184,7 @@ recipient << 'sound/effects/adminhelp.ogg' //AdminPM popup for ApocStation and anybody else who wants to use it. Set it with POPUP_ADMIN_PM in config.txt ~Carn - if(config.popup_admin_pm) + if(CONFIG_GET(flag/popup_admin_pm)) spawn() //so we don't hold the caller proc up var/sender = src var/sendername = key diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 6544f4d65d..685e1fd175 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -64,9 +64,9 @@ to_chat(user, span_notice("\The [I] does [DPS] damage per second.")) if(DPS > 0) to_chat(user, span_notice("At your maximum health ([user.getMaxHealth()]), it would take approximately;")) - to_chat(user, span_notice("[(user.getMaxHealth() - config.health_threshold_softcrit) / DPS] seconds to softcrit you. ([config.health_threshold_softcrit] health)")) - to_chat(user, span_notice("[(user.getMaxHealth() - config.health_threshold_crit) / DPS] seconds to hardcrit you. ([config.health_threshold_crit] health)")) - to_chat(user, span_notice("[(user.getMaxHealth() - config.health_threshold_dead) / DPS] seconds to kill you. ([config.health_threshold_dead] health)")) + to_chat(user, span_notice("[(user.getMaxHealth() - CONFIG_GET(number/health_threshold_softcrit)) / DPS] seconds to softcrit you. ([CONFIG_GET(number/health_threshold_softcrit)] health)")) + to_chat(user, span_notice("[(user.getMaxHealth() - CONFIG_GET(number/health_threshold_crit)) / DPS] seconds to hardcrit you. ([CONFIG_GET(number/health_threshold_crit)] health)")) + to_chat(user, span_notice("[(user.getMaxHealth() - CONFIG_GET(number/health_threshold_dead)) / DPS] seconds to kill you. ([CONFIG_GET(number/health_threshold_dead)] health)")) else to_chat(user, span_warning("You need to be a living mob, with hands, and for an object to be in your active hand, to use this verb.")) @@ -206,9 +206,9 @@ set category = "Server" set name = "Toggle Aliens" - config.aliens_allowed = !config.aliens_allowed - log_admin("[key_name(src)] has turned aliens [config.aliens_allowed ? "on" : "off"].") - message_admins("[key_name_admin(src)] has turned aliens [config.aliens_allowed ? "on" : "off"].", 0) + CONFIG_SET(flag/aliens_allowed, !CONFIG_GET(flag/aliens_allowed)) + log_admin("[key_name(src)] has turned aliens [CONFIG_GET(flag/aliens_allowed) ? "on" : "off"].") + message_admins("[key_name_admin(src)] has turned aliens [CONFIG_GET(flag/aliens_allowed) ? "on" : "off"].", 0) feedback_add_details("admin_verb","TAL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/cmd_display_del_log() diff --git a/code/modules/admin/verbs/fps.dm b/code/modules/admin/verbs/fps.dm index 069c2281f6..76f177535a 100644 --- a/code/modules/admin/verbs/fps.dm +++ b/code/modules/admin/verbs/fps.dm @@ -8,12 +8,12 @@ if(!check_rights(R_DEBUG)) return - var/new_fps = round(tgui_input_number(usr, "Sets game frames-per-second. Can potentially break the game (default: [config.fps])", "FPS", world.fps), round(config.fps * 1.5)) + var/new_fps = round(tgui_input_number(usr, "Sets game frames-per-second. Can potentially break the game (default: [CONFIG_GET(number/fps)])", "FPS", world.fps), round(CONFIG_GET(number/fps) * 1.5)) if(new_fps <= 0) to_chat(src, span_danger("Error: set_server_fps(): Invalid world.fps value. No changes made.")) return - if(new_fps > config.fps * 1.5) - if(tgui_alert(src, "You are setting fps to a high value:\n\t[new_fps] frames-per-second\n\tconfig.fps = [config.fps]", "Warning!", list("Confirm", "ABORT-ABORT-ABORT")) != "Confirm") + if(new_fps > CONFIG_GET(number/fps) * 1.5) + if(tgui_alert(src, "You are setting fps to a high value:\n\t[new_fps] frames-per-second\n\tconfig.fps = [CONFIG_GET(number/fps)]", "Warning!", list("Confirm", "ABORT-ABORT-ABORT")) != "Confirm") return var/msg = "[key_name(src)] has modified world.fps to [new_fps]" diff --git a/code/modules/admin/verbs/panicbunker.dm b/code/modules/admin/verbs/panicbunker.dm index b01c39337c..f4fdc3612e 100644 --- a/code/modules/admin/verbs/panicbunker.dm +++ b/code/modules/admin/verbs/panicbunker.dm @@ -5,14 +5,14 @@ if(!check_rights(R_ADMIN)) return - if (!config.sql_enabled) + if (!CONFIG_GET(flag/sql_enabled)) to_chat(usr, span_adminnotice("The Database is not enabled!")) return - config.panic_bunker = (!config.panic_bunker) + CONFIG_SET(flag/panic_bunker, !CONFIG_GET(flag/panic_bunker)) - log_and_message_admins("[key_name(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"on":"off")].") - if (config.panic_bunker && (!dbcon || !dbcon.IsConnected())) + log_and_message_admins("[key_name(usr)] has toggled the Panic Bunker, it is now [(CONFIG_GET(flag/panic_bunker) ? "on":"off")].") + if (CONFIG_GET(flag/panic_bunker) && (!dbcon || !dbcon.IsConnected())) message_admins("The database is not connected! Panic bunker will not work until the connection is reestablished.") feedback_add_details("admin_verb","PANIC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -23,10 +23,10 @@ if(!check_rights(R_ADMIN)) return - config.paranoia_logging = (!config.paranoia_logging) + CONFIG_SET(flag/paranoia_logging, !CONFIG_GET(flag/paranoia_logging)) - log_and_message_admins("[key_name(usr)] has toggled Paranoia Logging, it is now [(config.paranoia_logging?"on":"off")].") - if (config.paranoia_logging && (!dbcon || !dbcon.IsConnected())) + log_and_message_admins("[key_name(usr)] has toggled Paranoia Logging, it is now [(CONFIG_GET(flag/paranoia_logging) ? "on":"off")].") + if (CONFIG_GET(flag/paranoia_logging) && (!dbcon || !dbcon.IsConnected())) message_admins("The database is not connected! Paranoia logging will not be able to give 'player age' (time since first connection) warnings, only Byond account warnings.") feedback_add_details("admin_verb","PARLOG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -37,9 +37,9 @@ if(!check_rights(R_ADMIN)) return - config.ip_reputation = (!config.ip_reputation) + CONFIG_SET(flag/ip_reputation, !CONFIG_GET(flag/ip_reputation)) - log_and_message_admins("[key_name(usr)] has toggled IP reputation checks, it is now [(config.ip_reputation?"on":"off")].") - if (config.ip_reputation && (!dbcon || !dbcon.IsConnected())) + log_and_message_admins("[key_name(usr)] has toggled IP reputation checks, it is now [(CONFIG_GET(flag/ip_reputation) ? "on":"off")].") + if (CONFIG_GET(flag/ip_reputation) && (!dbcon || !dbcon.IsConnected())) message_admins("The database is not connected! IP reputation logging will not be able to allow existing players to bypass the reputation checks (if that is enabled).") feedback_add_details("admin_verb","IPREP") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index afeab793f1..c3b5673442 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -119,7 +119,7 @@ var/list/sounds_cache = list() /proc/web_sound(mob/user, input, credit) if(!check_rights(R_SOUNDS)) return - var/ytdl = config.invoke_youtubedl + var/ytdl = CONFIG_GET(string/invoke_youtubedl) if(!ytdl) to_chat(user, span_boldwarning("Youtube-dl was not configured, action unavailable"), confidential = TRUE) //Check config.txt for the INVOKE_YOUTUBEDL value return @@ -220,7 +220,7 @@ var/list/sounds_cache = list() if(!check_rights(R_SOUNDS)) return - var/ytdl = config.invoke_youtubedl + var/ytdl = CONFIG_GET(string/invoke_youtubedl) if(!ytdl) to_chat(src, span_boldwarning("Youtube-dl was not configured, action unavailable"), confidential = TRUE) //Check config.txt for the INVOKE_YOUTUBEDL value return diff --git a/code/modules/admin/verbs/possess.dm b/code/modules/admin/verbs/possess.dm index 9324583bac..0ce3fd727e 100644 --- a/code/modules/admin/verbs/possess.dm +++ b/code/modules/admin/verbs/possess.dm @@ -3,7 +3,7 @@ set category = "Object" if(istype(O,/obj/singularity)) - if(config.forbid_singulo_possession) + if(CONFIG_GET(flag/forbid_singulo_possession)) to_chat(usr, "It is forbidden to possess singularities.") return diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 9b287c83e2..31da1afe1b 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -173,7 +173,7 @@ /proc/cmd_admin_mute(mob/M as mob, mute_type, automute = 0) if(automute) - if(!config.automute_on) + if(!CONFIG_GET(flag/automute_on)) return else if(!usr || !usr.client) @@ -321,7 +321,7 @@ Ccomp's first proc. return var/action="" - if(config.antag_hud_allowed) + if(CONFIG_GET(flag/antag_hud_allowed)) for(var/mob/observer/dead/g in get_ghosts()) if(!g.client.holder) //Remove the verb from non-admin ghosts remove_verb(g, /mob/observer/dead/verb/toggle_antagHUD) @@ -329,7 +329,7 @@ Ccomp's first proc. g.antagHUD = 0 // Disable it on those that have it enabled g.has_enabled_antagHUD = 2 // We'll allow them to respawn to_chat(g, span_boldwarning("The Administrator has disabled AntagHUD ")) - config.antag_hud_allowed = 0 + CONFIG_SET(flag/antag_hud_allowed, FALSE) to_chat(src, span_boldwarning("AntagHUD usage has been disabled")) action = "disabled" else @@ -337,7 +337,7 @@ Ccomp's first proc. if(!g.client.holder) // Add the verb back for all non-admin ghosts add_verb(g, /mob/observer/dead/verb/toggle_antagHUD) to_chat(g, span_boldnotice("The Administrator has enabled AntagHUD")) // Notify all observers they can now use AntagHUD - config.antag_hud_allowed = 1 + CONFIG_SET(flag/antag_hud_allowed, TRUE) action = "enabled" to_chat(src, span_boldnotice("AntagHUD usage has been enabled")) @@ -356,11 +356,11 @@ Ccomp's first proc. return var/action="" - if(config.antag_hud_restricted) + if(CONFIG_GET(flag/antag_hud_restricted)) for(var/mob/observer/dead/g in get_ghosts()) to_chat(g, span_boldnotice("The administrator has lifted restrictions on joining the round if you use AntagHUD")) action = "lifted restrictions" - config.antag_hud_restricted = 0 + CONFIG_SET(flag/antag_hud_restricted, FALSE) to_chat(src, span_boldnotice("AntagHUD restrictions have been lifted")) else for(var/mob/observer/dead/g in get_ghosts()) @@ -369,7 +369,7 @@ Ccomp's first proc. g.antagHUD = 0 g.has_enabled_antagHUD = 0 action = "placed restrictions" - config.antag_hud_restricted = 1 + CONFIG_SET(flag/antag_hud_restricted, TRUE) to_chat(src, span_boldwarning("AntagHUD restrictions have been enabled")) log_admin("[key_name(usr)] has [action] on joining the round if they use AntagHUD") @@ -634,7 +634,7 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!istype(M)) tgui_alert_async(usr, "Cannot revive a ghost") return - if(config.allow_admin_rev) + if(CONFIG_GET(flag/allow_admin_rev)) M.revive() log_admin("[key_name(usr)] healed / revived [key_name(M)]") @@ -1029,12 +1029,12 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!check_rights(R_SERVER)) return //VOREStation Edit - if(!config.allow_random_events) - config.allow_random_events = 1 + if(!CONFIG_GET(flag/allow_random_events)) + CONFIG_SET(flag/allow_random_events, TRUE) to_chat(usr, "Random events enabled") message_admins("Admin [key_name_admin(usr)] has enabled random events.", 1) else - config.allow_random_events = 0 + CONFIG_SET(flag/allow_random_events, FALSE) to_chat(usr, "Random events disabled") message_admins("Admin [key_name_admin(usr)] has disabled random events.", 1) feedback_add_details("admin_verb","TRE") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/asset_cache/asset_list.dm b/code/modules/asset_cache/asset_list.dm index c9e02cb927..5971a753c3 100644 --- a/code/modules/asset_cache/asset_list.dm +++ b/code/modules/asset_cache/asset_list.dm @@ -61,7 +61,7 @@ GLOBAL_LIST_EMPTY(asset_datums) /// Returns whether or not the asset should attempt to read from cache /datum/asset/proc/should_refresh() - return !cross_round_cachable || !config.cache_assets + return !cross_round_cachable || !CONFIG_GET(flag/cache_assets) /// Simply takes any generated file and saves it to the round-specific /logs folder. Useful for debugging potential issues with spritesheet generation/display. /// Only called when the SAVE_SPRITESHEETS config option is uncommented. @@ -180,7 +180,7 @@ GLOBAL_LIST_EMPTY(asset_datums) return // If it's cached, may as well load it now, while the loading is cheap - if(config.cache_assets && cross_round_cachable) + if(CONFIG_GET(flag/cache_assets) && cross_round_cachable) load_immediately = TRUE create_spritesheets() @@ -209,12 +209,12 @@ GLOBAL_LIST_EMPTY(asset_datums) text2file(generate_css(), file_directory) SSassets.transport.register_asset(css_name, fcopy_rsc(file_directory)) - if(config.save_spritesheets) + if(CONFIG_GET(flag/save_spritesheets)) save_to_logs(file_name = css_name, file_location = file_directory) fdel(file_directory) - if (config.cache_assets && cross_round_cachable) + if (CONFIG_GET(flag/cache_assets) && cross_round_cachable) write_to_cache() fully_generated = TRUE // If we were ever in there, remove ourselves @@ -267,7 +267,7 @@ GLOBAL_LIST_EMPTY(asset_datums) size[SPRSZ_STRIPPED] = icon(file_directory) // this is useful here for determining if weird sprite issues (like having a white background) are a cause of what we're doing DM-side or not since we can see the full flattened thing at-a-glance. - if(config.save_spritesheets) + if(CONFIG_GET(flag/save_spritesheets)) save_to_logs(file_name = png_name, file_location = file_directory) fdel(file_directory) @@ -321,7 +321,7 @@ GLOBAL_LIST_EMPTY(asset_datums) rustg_file_write(replaced_css, replaced_css_filename) SSassets.transport.register_asset(finalized_name, replaced_css_filename) - if(config.save_spritesheets) + if(CONFIG_GET(flag/save_spritesheets)) save_to_logs(file_name = finalized_name, file_location = replaced_css_filename) fdel(replaced_css_filename) diff --git a/code/modules/asset_cache/transports/asset_transport.dm b/code/modules/asset_cache/transports/asset_transport.dm index 288eecd8d3..db19277abf 100644 --- a/code/modules/asset_cache/transports/asset_transport.dm +++ b/code/modules/asset_cache/transports/asset_transport.dm @@ -12,14 +12,14 @@ /// Called when the transport is loaded by the config controller, not called on the default transport unless it gets loaded by a config change. /datum/asset_transport/proc/Load() - if (config.asset_simple_preload) + if (CONFIG_GET(flag/asset_simple_preload)) for(var/client/C in GLOB.clients) addtimer(CALLBACK(src, PROC_REF(send_assets_slow), C, preload), 1 SECONDS) /// Initialize - Called when SSassets initializes. /datum/asset_transport/proc/Initialize(list/assets) preload = assets.Copy() - if (!config.asset_simple_preload) + if (!CONFIG_GET(flag/asset_simple_preload)) return for(var/client/C in GLOB.clients) addtimer(CALLBACK(src, PROC_REF(send_assets_slow), C, preload), 1 SECONDS) diff --git a/code/modules/asset_cache/transports/webroot_transport.dm b/code/modules/asset_cache/transports/webroot_transport.dm index 9ee8768efd..e3cb33b8fa 100644 --- a/code/modules/asset_cache/transports/webroot_transport.dm +++ b/code/modules/asset_cache/transports/webroot_transport.dm @@ -25,7 +25,7 @@ /// Saves the asset to the webroot taking into account namespaces and hashes. /datum/asset_transport/webroot/proc/save_asset_to_webroot(datum/asset_cache_item/ACI) - var/webroot = config.asset_cdn_webroot + var/webroot = CONFIG_GET(string/asset_cdn_webroot) var/newpath = "[webroot][get_asset_suffex(ACI)]" if (fexists(newpath)) return @@ -39,7 +39,7 @@ /datum/asset_transport/webroot/get_asset_url(asset_name, datum/asset_cache_item/asset_cache_item) if (!istype(asset_cache_item)) asset_cache_item = SSassets.cache[asset_name] - var/url = config.asset_cdn_url //config loading will handle making sure this ends in a / + var/url = CONFIG_GET(string/asset_cdn_url) //config loading will handle making sure this ends in a / return "[url][get_asset_suffex(asset_cache_item)]" /datum/asset_transport/webroot/proc/get_asset_suffex(datum/asset_cache_item/asset_cache_item) @@ -76,11 +76,11 @@ return FALSE /datum/asset_transport/webroot/validate_config(log = TRUE) - if (!config.asset_cdn_url) + if (!CONFIG_GET(string/asset_cdn_url)) if (log) log_asset("ERROR: [type]: Invalid Config: ASSET_CDN_URL") return FALSE - if (!config.asset_cdn_webroot) + if (!CONFIG_GET(string/asset_cdn_webroot)) if (log) log_asset("ERROR: [type]: Invalid Config: ASSET_CDN_WEBROOT") return FALSE diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index 923cfcb0e0..149d2e9d28 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -43,7 +43,7 @@ GLOBAL_DATUM(gateway_station, /obj/machinery/gateway/centerstation) GLOB.gateway_station = src update_icon() - wait = world.time + config.gateway_delay //+ thirty minutes default + wait = world.time + CONFIG_GET(number/gateway_delay) //+ thirty minutes default if(GLOB.gateway_away) awaygate = GLOB.gateway_away diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index e80ed93faa..ca4fb20248 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -117,7 +117,7 @@ stat_panel.reinitialize() //Logs all hrefs - if(config && config.log_hrefs && href_logfile) + if(config && CONFIG_GET(flag/log_hrefs) && href_logfile) WRITE_LOG(href_logfile, "[src] (usr:[usr]) || [hsrc ? "[hsrc] " : ""][href]") //byond bug ID:2256651 @@ -171,7 +171,7 @@ if(byond_version < MIN_CLIENT_VERSION) //Out of date client. return null - if(!config.guests_allowed && IsGuestKey(key)) + if(!CONFIG_GET(flag/guests_allowed) && IsGuestKey(key)) alert(src,"This server doesn't allow guest accounts to play. Please go to https://www.byond.com/ and register for a key.","Guest") // Not tgui_alert del(src) return @@ -278,7 +278,7 @@ src.changes() */ - if(config.paranoia_logging) + if(CONFIG_GET(flag/paranoia_logging)) var/alert = FALSE //VOREStation Edit start. if(isnum(player_age) && player_age == 0) log_and_message_admins("PARANOIA: [key_name(src)] has connected here for the first time.") @@ -405,30 +405,30 @@ //Panic bunker code if (isnum(player_age) && player_age == 0) //first connection - if (config.panic_bunker && !holder && !deadmin_holder) + if (CONFIG_GET(flag/panic_bunker) && !holder && !deadmin_holder) log_adminwarn("Failed Login: [key] - New account attempting to connect during panic bunker") message_admins(span_adminnotice("Failed Login: [key] - New account attempting to connect during panic bunker")) disconnect_with_message("Sorry but the server is currently not accepting connections from never before seen players.") return 0 // IP Reputation Check - if(config.ip_reputation) - if(config.ipr_allow_existing && player_age >= config.ipr_minimum_age) + if(CONFIG_GET(flag/ip_reputation)) + if(CONFIG_GET(flag/ipr_allow_existing) && player_age >= CONFIG_GET(number/ipr_minimum_age)) log_admin("Skipping IP reputation check on [key] with [address] because of player age") else if(update_ip_reputation()) //It is set now - if(ip_reputation >= config.ipr_bad_score) //It's bad + if(ip_reputation >= CONFIG_GET(number/ipr_bad_score)) //It's bad //Log it - if(config.paranoia_logging) //We don't block, but we want paranoia log messages + if(CONFIG_GET(flag/paranoia_logging)) //We don't block, but we want paranoia log messages log_and_message_admins("[key] at [address] has bad IP reputation: [ip_reputation]. Will be kicked if enabled in config.") else //We just log it log_admin("[key] at [address] has bad IP reputation: [ip_reputation]. Will be kicked if enabled in config.") //Take action if required - if(config.ipr_block_bad_ips && config.ipr_allow_existing) //We allow players of an age, but you don't meet it - disconnect_with_message("Sorry, we only allow VPN/Proxy/Tor usage for players who have spent at least [config.ipr_minimum_age] days on the server. If you are unable to use the internet without your VPN/Proxy/Tor, please contact an admin out-of-game to let them know so we can accommodate this.") + if(CONFIG_GET(flag/ipr_block_bad_ips) && CONFIG_GET(flag/ipr_allow_existing)) //We allow players of an age, but you don't meet it + disconnect_with_message("Sorry, we only allow VPN/Proxy/Tor usage for players who have spent at least [CONFIG_GET(number/ipr_minimum_age)] days on the server. If you are unable to use the internet without your VPN/Proxy/Tor, please contact an admin out-of-game to let them know so we can accommodate this.") return 0 - else if(config.ipr_block_bad_ips) //We don't allow players of any particular age + else if(CONFIG_GET(flag/ipr_block_bad_ips)) //We don't allow players of any particular age disconnect_with_message("Sorry, we do not accept connections from users via VPN/Proxy/Tor connections. If you believe this is in error, contact an admin out-of-game.") return 0 else @@ -487,7 +487,7 @@ src << browse('code/modules/asset_cache/validate_assets.html', "window=asset_cache_browser") //Precache the client with all other assets slowly, so as to not block other browse() calls - if (config.asset_simple_preload) + if (CONFIG_GET(flag/asset_simple_preload)) addtimer(CALLBACK(SSassets.transport, TYPE_PROC_REF(/datum/asset_transport, send_assets_slow), src, SSassets.transport.preload), 5 SECONDS) /mob/proc/MayRespawn() @@ -534,7 +534,7 @@ //You're welcome to replace this proc with your own that does your own cool stuff. //Just set the client's ip_reputation var and make sure it makes sense with your config settings (higher numbers are worse results) /client/proc/update_ip_reputation() - var/request = "https://check.getipintel.net/check.php?ip=[address]&contact=[config.ipr_email]" + var/request = "https://check.getipintel.net/check.php?ip=[address]&contact=[CONFIG_GET(string/ipr_email)]" var/http[] = world.Export(request) /* Debug @@ -550,7 +550,7 @@ //429 is rate limit exceeded if(text2num(http["STATUS"]) == 429) log_and_message_admins("getipintel.net reports HTTP status 429. IP reputation checking is now disabled. If you see this, let a developer know.") - config.ip_reputation = FALSE + CONFIG_SET(flag/ip_reputation, FALSE) return FALSE var/content = file2text(http["CONTENT"]) //world.Export actually returns a file object in CONTENT @@ -581,7 +581,7 @@ log_and_message_admins(ipr_error) if(fatal) - config.ip_reputation = FALSE + CONFIG_SET(flag/ip_reputation, FALSE) log_and_message_admins("With this error, IP reputation checking is disabled for this shift. Let a developer know.") return FALSE diff --git a/code/modules/client/client procs_vr.dm b/code/modules/client/client procs_vr.dm index 7cea3d5776..fdc861aa18 100644 --- a/code/modules/client/client procs_vr.dm +++ b/code/modules/client/client procs_vr.dm @@ -17,10 +17,10 @@ //Service returns a single float in html body /client/proc/ipr_getipintel() - if(!config.ipr_email) + if(!CONFIG_GET(string/ipr_email)) return -1 - var/request = "https://check.getipintel.net/check.php?ip=[address]&contact=[config.ipr_email]" + var/request = "https://check.getipintel.net/check.php?ip=[address]&contact=[CONFIG_GET(string/ipr_email)]" var/http[] = world.Export(request) if(!http || !islist(http)) //If we couldn't check, the service might be down, fail-safe. @@ -30,7 +30,7 @@ //429 is rate limit exceeded if(text2num(http["STATUS"]) == 429) log_and_message_admins("getipintel.net reports HTTP status 429. IP reputation checking is now disabled. If you see this, let a developer know.") - config.ip_reputation = FALSE + CONFIG_SET(flag/ip_reputation, FALSE) return -1 var/content = file2text(http["CONTENT"]) //world.Export actually returns a file object in CONTENT @@ -61,7 +61,7 @@ log_and_message_admins(ipr_error) if(fatal) - config.ip_reputation = FALSE + CONFIG_SET(flag/ip_reputation, FALSE) log_and_message_admins("With this error, IP reputation checking is disabled for this shift. Let a developer know.") return -1 @@ -71,10 +71,10 @@ //Service returns JSON in html body /client/proc/ipr_ipqualityscore() - if(!config.ipqualityscore_apikey) + if(!CONFIG_GET(string/ipqualityscore_apikey)) return -1 - var/request = "https://www.ipqualityscore.com/api/json/ip/[config.ipqualityscore_apikey]/[address]?strictness=1&fast=true&byond_key=[key]" + var/request = "https://www.ipqualityscore.com/api/json/ip/[CONFIG_GET(string/ipqualityscore_apikey)]/[address]?strictness=1&fast=true&byond_key=[key]" var/http[] = world.Export(request) if(!http || !islist(http)) //If we couldn't check, the service might be down, fail-safe. diff --git a/code/modules/client/preference_setup/general/01_basic.dm b/code/modules/client/preference_setup/general/01_basic.dm index 2ed923cbfb..ac56b2b005 100644 --- a/code/modules/client/preference_setup/general/01_basic.dm +++ b/code/modules/client/preference_setup/general/01_basic.dm @@ -58,7 +58,7 @@ // Moved from /datum/preferences/proc/copy_to() /datum/category_item/player_setup_item/general/basic/copy_to_mob(var/mob/living/carbon/human/character) - if(config.humans_need_surnames) + if(CONFIG_GET(flag/humans_need_surnames)) var/firstspace = findtext(pref.real_name, " ") var/name_length = length(pref.real_name) if(!firstspace) //we need a surname @@ -93,7 +93,7 @@ . += span_bold("Pronouns:") + " [gender2text(pref.identifying_gender)]
" . += span_bold("Age:") + " [pref.age] Birthday: [pref.bday_month]/[pref.bday_day] - Announce?: [pref.bday_announce ? "Yes" : "No"]
" . += span_bold("Spawn Point") + ": [pref.spawnpoint]
" - if(config.allow_Metadata) + if(CONFIG_GET(flag/allow_metadata)) . += span_bold("OOC Notes: EditLikesDislikes") + "
" . = jointext(.,null) diff --git a/code/modules/client/preference_setup/general/02_language.dm b/code/modules/client/preference_setup/general/02_language.dm index 59e8d2f34f..06a7fc6f26 100644 --- a/code/modules/client/preference_setup/general/02_language.dm +++ b/code/modules/client/preference_setup/general/02_language.dm @@ -52,7 +52,8 @@ pref.alternate_languages -= language if(isnull(pref.language_prefixes) || !pref.language_prefixes.len) - pref.language_prefixes = config.language_prefixes.Copy() + var/list/prefixes = CONFIG_GET(str_list/language_prefixes) + pref.language_prefixes = prefixes.Copy() for(var/prefix in pref.language_prefixes) if(prefix in forbidden_prefixes) pref.language_prefixes -= prefix @@ -148,7 +149,8 @@ pref.language_prefixes = keys return TOPIC_REFRESH else if(href_list["reset_prefix"]) - pref.language_prefixes = config.language_prefixes.Copy() + var/list/prefixes = CONFIG_GET(str_list/language_prefixes) + pref.language_prefixes = prefixes.Copy() return TOPIC_REFRESH else if(href_list["set_custom_key"]) diff --git a/code/modules/client/preference_setup/global/01_ui.dm b/code/modules/client/preference_setup/global/01_ui.dm index 96a4d776ea..9c40d06396 100644 --- a/code/modules/client/preference_setup/global/01_ui.dm +++ b/code/modules/client/preference_setup/global/01_ui.dm @@ -179,4 +179,4 @@ return ..() /datum/category_item/player_setup_item/player_global/ui/proc/can_select_ooc_color(var/mob/user) - return config.allow_admin_ooccolor && check_rights(R_ADMIN|R_EVENT|R_FUN, 0, user) + return CONFIG_GET(flag/allow_admin_ooccolor) && check_rights(R_ADMIN|R_EVENT|R_FUN, 0, user) diff --git a/code/modules/client/preference_setup/global/02_settings.dm b/code/modules/client/preference_setup/global/02_settings.dm index 3a63b9f0cc..3fddd3552e 100644 --- a/code/modules/client/preference_setup/global/02_settings.dm +++ b/code/modules/client/preference_setup/global/02_settings.dm @@ -17,4 +17,4 @@ /datum/category_item/player_setup_item/player_global/settings/sanitize_preferences() pref.lastchangelog = sanitize_text(pref.lastchangelog, initial(pref.lastchangelog)) pref.lastnews = sanitize_text(pref.lastnews, initial(pref.lastnews)) - pref.default_slot = sanitize_integer(pref.default_slot, 1, config.character_slots, initial(pref.default_slot)) + pref.default_slot = sanitize_integer(pref.default_slot, 1, CONFIG_GET(number/character_slots), initial(pref.default_slot)) diff --git a/code/modules/client/preference_setup/loadout/loadout.dm b/code/modules/client/preference_setup/loadout/loadout.dm index ee8be1cf8b..5019e5c845 100644 --- a/code/modules/client/preference_setup/loadout/loadout.dm +++ b/code/modules/client/preference_setup/loadout/loadout.dm @@ -80,10 +80,10 @@ var/list/gear_datums = list() for(var/gear_name in gear_datums) var/datum/gear/G = gear_datums[gear_name] - if(G.whitelisted && config.loadout_whitelist != LOADOUT_WHITELIST_OFF && pref.client) //VOREStation Edit. - if(config.loadout_whitelist == LOADOUT_WHITELIST_STRICT && G.whitelisted != pref.species) + if(G.whitelisted && CONFIG_GET(flag/loadout_whitelist) != LOADOUT_WHITELIST_OFF && pref.client) //VOREStation Edit. + if(CONFIG_GET(flag/loadout_whitelist) == LOADOUT_WHITELIST_STRICT && G.whitelisted != pref.species) continue - if(config.loadout_whitelist == LOADOUT_WHITELIST_LAX && !is_alien_whitelisted(preference_mob(), GLOB.all_species[G.whitelisted])) + if(CONFIG_GET(flag/loadout_whitelist) == LOADOUT_WHITELIST_LAX && !is_alien_whitelisted(preference_mob(), GLOB.all_species[G.whitelisted])) continue if(max_cost && G.cost > max_cost) continue @@ -236,14 +236,14 @@ var/list/gear_datums = list() if(href_list["next_slot"]) //change the current slot number pref.gear_slot = pref.gear_slot+1 - if(pref.gear_slot>config.loadout_slots) + if(pref.gear_slot > CONFIG_GET(number/loadout_slots)) pref.gear_slot = 1 //If we're moving down a slot.. else if(href_list["prev_slot"]) //change current slot one down pref.gear_slot = pref.gear_slot-1 if(pref.gear_slot<1) - pref.gear_slot = config.loadout_slots + pref.gear_slot = CONFIG_GET(number/loadout_slots) // Set the currently selected gear to whatever's in the new slot if(pref.gear_list["[pref.gear_slot]"]) pref.gear = pref.gear_list["[pref.gear_slot]"] diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm index ab64437a2e..08befbebe7 100644 --- a/code/modules/client/preference_setup/occupation/occupation.dm +++ b/code/modules/client/preference_setup/occupation/occupation.dm @@ -263,7 +263,7 @@ dat += "You answer to [job.supervisors] normally." dat += "
" - if(config.wikiurl) + if(CONFIG_GET(string/wikiurl)) dat += "Open wiki page in browser" var/alt_title = pref.GetPlayerAltTitle(job) @@ -281,7 +281,7 @@ else if(href_list["job_wiki"]) var/rank = href_list["job_wiki"] - open_link(user,"[config.wikiurl][rank]") + open_link(user,"[CONFIG_GET(string/wikiurl)][rank]") return ..() diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 923ca25d3e..f28c224168 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -372,8 +372,8 @@ var/list/preferences_datums = list() if(!istype(user, /mob/new_player)) return if(href_list["preference"] == "open_whitelist_forum") - if(config.forumurl) - user << link(config.forumurl) + if(CONFIG_GET(string/forumurl)) + user << link(CONFIG_GET(string/forumurl)) else to_chat(user, span_danger("The forum URL is not set in the server configuration.")) return @@ -460,7 +460,7 @@ var/list/preferences_datums = list() var/default var/list/charlist = list() - for(var/i in 1 to config.character_slots) + for(var/i in 1 to CONFIG_GET(number/character_slots)) var/list/save_data = savefile.get_entry("character[i]", list()) var/name = save_data["real_name"] var/nickname = save_data["nickname"] @@ -501,7 +501,7 @@ var/list/preferences_datums = list() var/list/charlist = list() - for(var/i in 1 to config.character_slots) + for(var/i in 1 to CONFIG_GET(number/character_slots)) var/list/save_data = savefile.get_entry("character[i]", list()) var/name = save_data["real_name"] var/nickname = save_data["nickname"] diff --git a/code/modules/client/preferences/migrations/14_nifs.dm b/code/modules/client/preferences/migrations/14_nifs.dm index 4cc8f550c9..95f039591e 100644 --- a/code/modules/client/preferences/migrations/14_nifs.dm +++ b/code/modules/client/preferences/migrations/14_nifs.dm @@ -2,7 +2,7 @@ /datum/preferences/proc/migration_14_nifs(datum/json_savefile/S) var/datum/json_savefile/new_savefile = new /datum/json_savefile(nif_savefile_path(client_ckey)) - for(var/slot in 1 to config.character_slots) + for(var/slot in 1 to CONFIG_GET(number/character_slots)) var/list/prefs = S.get_entry("character[slot]", null) if(!islist(prefs)) continue diff --git a/code/modules/client/preferences/migrations/15_nif_path.dm b/code/modules/client/preferences/migrations/15_nif_path.dm index 1d23407220..cb68e8b568 100644 --- a/code/modules/client/preferences/migrations/15_nif_path.dm +++ b/code/modules/client/preferences/migrations/15_nif_path.dm @@ -2,7 +2,7 @@ /datum/preferences/proc/migration_15_nif_path(datum/json_savefile/S) var/datum/json_savefile/new_savefile = new /datum/json_savefile(nif_savefile_path(client_ckey)) - for(var/slot in 1 to config.character_slots) + for(var/slot in 1 to CONFIG_GET(number/character_slots)) var/list/prefs = new_savefile.get_entry("character[slot]", null) if(!islist(prefs)) continue diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 4111db2500..b0ec02a892 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -204,7 +204,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car if(!slot) slot = default_slot - slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot)) + slot = sanitize_integer(slot, 1, CONFIG_GET(number/character_slots), initial(default_slot)) if(slot != default_slot) default_slot = slot savefile.set_entry("default_slot", slot) @@ -261,7 +261,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car // This basically just changes default_slot without loading the correct data, so the next save call will overwrite // the slot - slot = sanitize_integer(slot, 1, config.character_slots, initial(default_slot)) + slot = sanitize_integer(slot, 1, CONFIG_GET(number/character_slots), initial(default_slot)) if(slot != default_slot) default_slot = slot nif_path = nif_durability = nif_savedata = null //VOREStation Add - Don't copy NIF diff --git a/code/modules/client/preferences_tgui.dm b/code/modules/client/preferences_tgui.dm index a7f1567497..69361e1478 100644 --- a/code/modules/client/preferences_tgui.dm +++ b/code/modules/client/preferences_tgui.dm @@ -93,7 +93,7 @@ /datum/preferences/proc/create_character_profiles() var/list/profiles = list() - for(var/index in 1 to config.character_slots) + for(var/index in 1 to CONFIG_GET(number/character_slots)) // TODO: It won't be updated in the savefile yet, so just read the name directly // if(index == default_slot) // profiles += read_preference(/datum/preference/name/real_name) diff --git a/code/modules/client/verbs/ooc.dm b/code/modules/client/verbs/ooc.dm index 40e6f3f838..5e6d1b5f5d 100644 --- a/code/modules/client/verbs/ooc.dm +++ b/code/modules/client/verbs/ooc.dm @@ -20,26 +20,26 @@ return if(!holder) - if(!config.ooc_allowed) + if(!CONFIG_GET(flag/ooc_allowed)) to_chat(src, span_danger("OOC is globally muted.")) return - if(!config.dooc_allowed && (mob.stat == DEAD)) + if(!CONFIG_GET(flag/dooc_allowed) && (mob.stat == DEAD)) to_chat(usr, span_danger("OOC for dead mobs has been turned off.")) return if(prefs.muted & MUTE_OOC) to_chat(src, span_danger("You cannot use OOC (muted).")) return - if(findtext(msg, "byond://") && !config.allow_byond_links) + if(findtext(msg, "byond://") && !CONFIG_GET(flag/allow_byond_links)) to_chat(src, span_bold("Advertising other servers is not allowed.")) log_admin("[key_name(src)] has attempted to advertise in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to advertise in OOC: [msg]") return - if(findtext(msg, "discord.gg") && !config.allow_discord_links) + if(findtext(msg, "discord.gg") && !CONFIG_GET(flag/allow_discord_links)) to_chat(src, span_bold("Advertising discords is not allowed.")) log_admin("[key_name(src)] has attempted to advertise a discord server in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to advertise a discord server in OOC: [msg]") return - if((findtext(msg, "http://") || findtext(msg, "https://")) && !config.allow_url_links) + if((findtext(msg, "http://") || findtext(msg, "https://")) && !CONFIG_GET(flag/allow_url_links)) to_chat(src, span_bold("Posting external links is not allowed.")) log_admin("[key_name(src)] has attempted to post a link in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to post a link in OOC: [msg]") @@ -76,7 +76,7 @@ display_name = "[holder.fakekey]/([src.key])" else display_name = holder.fakekey - if(holder && !holder.fakekey && (holder.rights & R_ADMIN|R_FUN|R_EVENT) && config.allow_admin_ooccolor && (src.prefs.ooccolor != initial(src.prefs.ooccolor))) // keeping this for the badmins + if(holder && !holder.fakekey && (holder.rights & R_ADMIN|R_FUN|R_EVENT) && CONFIG_GET(flag/allow_admin_ooccolor) && (src.prefs.ooccolor != initial(src.prefs.ooccolor))) // keeping this for the badmins to_chat(target, span_ooc("" + create_text_tag("ooc", "OOC:", target) + " [display_name]: [span_message(msg)]")) else to_chat(target, span_ooc("" + create_text_tag("ooc", "OOC:", target) + " [display_name]: " + span_message(msg)) + "") @@ -106,26 +106,26 @@ return if(!holder) - if(!config.looc_allowed) + if(!CONFIG_GET(flag/looc_allowed)) to_chat(src, span_danger("LOOC is globally muted.")) return - if(!config.dooc_allowed && (mob.stat == DEAD)) + if(!CONFIG_GET(flag/dooc_allowed) && (mob.stat == DEAD)) to_chat(usr, span_danger("OOC for dead mobs has been turned off.")) return if(prefs.muted & MUTE_LOOC) to_chat(src, span_danger("You cannot use OOC (muted).")) return - if(findtext(msg, "byond://") && !config.allow_byond_links) + if(findtext(msg, "byond://") && !CONFIG_GET(flag/allow_byond_links)) to_chat(src, span_bold("Advertising other servers is not allowed.")) log_admin("[key_name(src)] has attempted to advertise in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to advertise in OOC: [msg]") return - if(findtext(msg, "discord.gg") && !config.allow_discord_links) + if(findtext(msg, "discord.gg") && !CONFIG_GET(flag/allow_discord_links)) to_chat(src, span_bold("Advertising discords is not allowed.")) log_admin("[key_name(src)] has attempted to advertise a discord server in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to advertise a discord server in OOC: [msg]") return - if((findtext(msg, "http://") || findtext(msg, "https://")) && !config.allow_url_links) + if((findtext(msg, "http://") || findtext(msg, "https://")) && !CONFIG_GET(flag/allow_url_links)) to_chat(src, span_bold("Posting external links is not allowed.")) log_admin("[key_name(src)] has attempted to post a link in OOC: [msg]") message_admins("[key_name_admin(src)] has attempted to post a link in OOC: [msg]") diff --git a/code/modules/client/verbs/who.dm b/code/modules/client/verbs/who.dm index f3daef1751..a2b789af6a 100644 --- a/code/modules/client/verbs/who.dm +++ b/code/modules/client/verbs/who.dm @@ -113,13 +113,13 @@ msg = span_bold("Current Admins ([num_admins_online]):") + "\n" + msg - if(config.show_mods) + if(CONFIG_GET(flag/show_mods)) msg += "\n" + span_bold(" Current Game Masters ([num_mods_online]):") + "\n" + modmsg - if(config.show_devs) + if(CONFIG_GET(flag/show_devs)) msg += "\n" + span_bold(" Current Developers ([num_devs_online]):") + "\n" + devmsg - if(config.show_event_managers) + if(CONFIG_GET(flag/show_event_managers)) msg += "\n" + span_bold(" Current Miscellaneous ([num_event_managers_online]):") + "\n" + eventMmsg var/num_mentors_online = 0 @@ -141,7 +141,7 @@ mmsg += " (AFK - [round(seconds / 60)] minutes, [seconds % 60] seconds)" mmsg += "\n" - if(config.show_mentors) + if(CONFIG_GET(flag/show_mentors)) msg += "\n" + span_bold(" Current Mentors ([num_mentors_online]):") + "\n" + mmsg msg += "\n" + span_info("Adminhelps are also sent to Discord. If no admins are available in game try anyway and an admin on Discord may see it and respond.") diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm index 55cf7d5038..f684e2fc6d 100644 --- a/code/modules/events/event_container.dm +++ b/code/modules/events/event_container.dm @@ -28,7 +28,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT if(!next_event_time) set_event_delay() - if(delayed || !config.allow_random_events) + if(delayed || !CONFIG_GET(flag/allow_random_events)) next_event_time += (world.time - last_world_time) else if(world.time > next_event_time) start_event() @@ -85,16 +85,26 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT var/last_time = last_event_time[EM] if(last_time) var/time_passed = world.time - last_time - var/weight_modifier = max(0, round((config.expected_round_length - time_passed) / 300)) + var/weight_modifier = max(0, round((CONFIG_GET(number/expected_round_length) - time_passed) / 300)) weight = weight - weight_modifier return weight /datum/event_container/proc/set_event_delay() + var/list/event_delays + + switch(severity) + if(EVENT_LEVEL_MUNDANE) + event_delays = CONFIG_GET(keyed_list/event_first_run_mundane) + if(EVENT_LEVEL_MODERATE) + event_delays = CONFIG_GET(keyed_list/event_first_run_moderate) + if(EVENT_LEVEL_MAJOR) + event_delays = CONFIG_GET(keyed_list/event_first_run_major) + // If the next event time has not yet been set and we have a custom first time start - if(next_event_time == 0 && config.event_first_run[severity]) - var/lower = config.event_first_run[severity]["lower"] - var/upper = config.event_first_run[severity]["upper"] + if(next_event_time == 0 && event_delays) + var/lower = (event_delays["lower"] MINUTES) + var/upper = (event_delays["upper"] MINUTES) var/event_delay = rand(lower, upper) next_event_time = world.time + event_delay // Otherwise, follow the standard setup process @@ -113,7 +123,7 @@ var/global/list/severity_to_string = list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT playercount_modifier = 0.8 playercount_modifier = playercount_modifier * delay_modifier - var/event_delay = rand(config.event_delay_lower[severity], config.event_delay_upper[severity]) * playercount_modifier + var/event_delay = rand(CONFIG_GET(number_list/event_delay_lower)[severity] MINUTES, CONFIG_GET(number_list/event_delay_upper)[severity] MINUTES) * playercount_modifier next_event_time = world.time + event_delay log_debug("Next event of severity [severity_to_string[severity]] in [(next_event_time - world.time)/600] minutes.") diff --git a/code/modules/events/event_dynamic.dm b/code/modules/events/event_dynamic.dm index aff8f1e9ae..3f670aa9e5 100644 --- a/code/modules/events/event_dynamic.dm +++ b/code/modules/events/event_dynamic.dm @@ -24,7 +24,7 @@ var/list/event_last_fired = list() //Always triggers an event when called, dynamically chooses events based on job population /proc/spawn_dynamic_event() - if(!config.allow_random_events) + if(!CONFIG_GET(flag/allow_random_events)) return var/minutes_passed = world.time/600 diff --git a/code/modules/events/event_manager.dm b/code/modules/events/event_manager.dm index 83464c5075..cc0972f208 100644 --- a/code/modules/events/event_manager.dm +++ b/code/modules/events/event_manager.dm @@ -19,7 +19,7 @@ /datum/controller/subsystem/events/proc/GetInteractWindow() var/html = "Refresh" - html += "Pause All - [config.allow_random_events ? "Pause" : "Resume"]" + html += "Pause All - [CONFIG_GET(flag/allow_random_events) ? "Pause" : "Resume"]" if(selected_event_container) var/event_time = max(0, selected_event_container.next_event_time - world.time) @@ -153,8 +153,8 @@ EC.delayed = !EC.delayed log_and_message_admins("has [EC.delayed ? "paused" : "resumed"] countdown for [severity_to_string[EC.severity]] events.") else if(href_list["pause_all"]) - config.allow_random_events = text2num(href_list["pause_all"]) - log_and_message_admins("has [config.allow_random_events ? "resumed" : "paused"] countdown for all events.") + CONFIG_SET(flag/allow_random_events, text2num(href_list["pause_all"])) + log_and_message_admins("has [CONFIG_GET(flag/allow_random_events) ? "resumed" : "paused"] countdown for all events.") else if(href_list["interval"]) var/delay = tgui_input_number(usr, "Enter delay modifier. A value less than one means events fire more often, higher than one less often.", "Set Interval Modifier") if(delay && delay > 0) diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index 5cfeae553c..f5c1a0584d 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -26,16 +26,16 @@ */ /proc/send2mainirc(var/msg) - if(config.main_irc) - send2irc(config.main_irc, msg) + if(CONFIG_GET(string/main_irc)) + send2irc(CONFIG_GET(string/main_irc), msg) return /proc/send2adminirc(var/msg) - if(config.admin_irc) - send2irc(config.admin_irc, msg) + if(CONFIG_GET(string/admin_irc)) + send2irc(CONFIG_GET(string/admin_irc), msg) return /hook/startup/proc/ircNotify() - send2mainirc("Server starting up on byond://[config.serverurl ? config.serverurl : (config.server ? config.server : "[world.address]:[world.port]")]") + send2mainirc("Server starting up on byond://[CONFIG_GET(string/serverurl) ? CONFIG_GET(string/serverurl) : (CONFIG_GET(string/server) ? CONFIG_GET(string/server) : "[world.address]:[world.port]")]") return 1 diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 8047bdd024..45598b0126 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -131,9 +131,9 @@ Book Cart End /obj/structure/bookcase/manuals/medical/New() ..() new /obj/item/book/manual/medical_cloning(src) - new /obj/item/book/manual/medical_diagnostics_manual(src) - new /obj/item/book/manual/medical_diagnostics_manual(src) - new /obj/item/book/manual/medical_diagnostics_manual(src) + new /obj/item/book/manual/wiki/medical_diagnostics_manual(src) + new /obj/item/book/manual/wiki/medical_diagnostics_manual(src) + new /obj/item/book/manual/wiki/medical_diagnostics_manual(src) update_icon() @@ -142,10 +142,10 @@ Book Cart End /obj/structure/bookcase/manuals/engineering/New() ..() - new /obj/item/book/manual/engineering_construction(src) + new /obj/item/book/manual/wiki/engineering_construction(src) new /obj/item/book/manual/engineering_particle_accelerator(src) - new /obj/item/book/manual/engineering_hacking(src) - new /obj/item/book/manual/engineering_guide(src) + new /obj/item/book/manual/wiki/engineering_hacking(src) + new /obj/item/book/manual/wiki/engineering_guide(src) new /obj/item/book/manual/atmospipes(src) new /obj/item/book/manual/engineering_singularity_safety(src) new /obj/item/book/manual/evaguide(src) @@ -199,7 +199,7 @@ Book Cart End to_chat(user, span_notice("The pages of [title] have been cut out!")) return if(src.dat) - user << browse("Penned by [author].
" + "[dat]", "window=book") + display_content(user) user.visible_message("[user] opens a book titled \"[src.title]\" and begins reading intently.") playsound(src, 'sound/bureaucracy/bookopen.ogg', 50, 1) onclose(user, "book") @@ -207,6 +207,9 @@ Book Cart End else to_chat(user, "This book is completely blank!") +/obj/item/book/proc/display_content(mob/living/user) + user << browse("Penned by [author].
" + "[dat]", "window=book") + /obj/item/book/attackby(obj/item/W as obj, mob/user as mob) if(carved) if(!store) @@ -297,7 +300,7 @@ Book Cart End if(user.zone_sel.selecting == O_EYES) user.visible_message(span_notice("You open up the book and show it to [M]."), \ span_notice(" [user] opens up a book and shows it to [M].")) - M << browse("Penned by [author].
" + "[dat]", "window=book") + display_content(M) user.setClickCooldown(DEFAULT_QUICK_COOLDOWN) //to prevent spam /* diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index f5bc91f22e..06edbb0331 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -43,7 +43,7 @@ Filter by Author: [author]
\[Start Search\]
"} if(1) - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) dat += span_red(span_bold("ERROR") + ": Unable to contact External Archive. Please contact your system administrator for assistance.") + "
" else if(!SQLquery) @@ -273,7 +273,7 @@ No.
"} if(8) dat += "

External Archive

" //VOREStation Edit - establish_old_db_connection() + establish_db_connection() //dat += "

" + span_red("arning: System Administrator has slated this archive for removal. Personal uploads should be taken to the NT board of internal literature.") + "

" //VOREStation Removal @@ -316,7 +316,7 @@ var/dat = "Book Inventory Management\n" // dat += "

ADMINISTRATIVE MANAGEMENT

" - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) dat += span_red(span_bold("ERROR") + ": Unable to contact External Archive. Please contact your system administrator for assistance.") @@ -436,7 +436,7 @@ if(scanner.cache.unique) tgui_alert_async(usr, "This book has been rejected from the database. Aborting!") else - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.") else @@ -460,7 +460,7 @@ if(href_list["targetid"]) var/sqlid = sanitizeSQL(href_list["targetid"]) - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.") if(bibledelay) @@ -491,7 +491,7 @@ if(!check_rights(R_ADMIN)) return var/sqlid = sanitizeSQL(href_list["delid"]) - establish_old_db_connection() + establish_db_connection() if(!dbcon_old.IsConnected()) tgui_alert_async(usr, "Connection to Archive has been severed. Aborting.") else diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm index 8e11827997..b01cb45cae 100644 --- a/code/modules/lighting/lighting_overlay.dm +++ b/code/modules/lighting/lighting_overlay.dm @@ -28,7 +28,7 @@ affected_turf.lighting_object = src affected_turf.set_luminosity(0) - if(config.starlight) + if(CONFIG_GET(flag/starlight)) for(var/turf/space/space_tile in RANGE_TURFS(1, affected_turf)) space_tile.update_starlight() diff --git a/code/modules/maps/tg/map_template.dm b/code/modules/maps/tg/map_template.dm index f8aaca0276..ced27a1838 100644 --- a/code/modules/maps/tg/map_template.dm +++ b/code/modules/maps/tg/map_template.dm @@ -232,7 +232,7 @@ specific_sanity-- var/orientation - if(chosen_template.fixed_orientation || !config.random_submap_orientation) + if(chosen_template.fixed_orientation || !CONFIG_GET(flag/random_submap_orientation)) orientation = 0 else orientation = pick(list(0, 90, 180, 270)) diff --git a/code/modules/mob/_modifiers/unholy.dm b/code/modules/mob/_modifiers/unholy.dm index 925d57b945..0f4ab94db9 100644 --- a/code/modules/mob/_modifiers/unholy.dm +++ b/code/modules/mob/_modifiers/unholy.dm @@ -132,7 +132,7 @@ for(var/obj/item/organ/E in H.bad_external_organs) // Fix bones var/obj/item/organ/external/affected = E - if((affected.damage < affected.min_broken_damage * config.organ_health_multiplier) && (affected.status & ORGAN_BROKEN)) + if((affected.damage < affected.min_broken_damage * CONFIG_GET(number/organ_health_multiplier)) && (affected.status & ORGAN_BROKEN)) affected.status &= ~ORGAN_BROKEN for(var/datum/wound/W in affected.wounds) // Fix IB diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index c87e4d2e85..dea1e3ea13 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -207,7 +207,7 @@ Works together with spawning an observer, noted above. B.update() if(ghost.client) ghost.client.time_died_as_mouse = ghost.timeofdeath - if(ghost.client && !ghost.client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. + if(ghost.client && !ghost.client.holder && !CONFIG_GET(flag/antag_hud_allowed)) // For new ghosts we remove the verb from even showing up if it's not allowed. remove_verb(ghost, /mob/observer/dead/verb/toggle_antagHUD) // Poor guys, don't know what they are missing! return ghost @@ -322,13 +322,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Toggle AntagHUD" set desc = "Toggles AntagHUD allowing you to see who is the antagonist" - if(!config.antag_hud_allowed && !client.holder) + if(!CONFIG_GET(flag/antag_hud_allowed) && !client.holder) to_chat(src, span_filter_notice(span_red("Admins have disabled this for this round."))) return if(jobban_isbanned(src, JOB_ANTAGHUD)) to_chat(src, span_filter_notice(span_red(span_bold("You have been banned from using this feature")))) return - if(config.antag_hud_restricted && !has_enabled_antagHUD && !client.holder) + if(CONFIG_GET(flag/antag_hud_restricted) && !has_enabled_antagHUD && !client.holder) var/response = tgui_alert(src, "If you turn this on, you will not be able to take any part in the round.","Are you sure you want to turn this feature on?",list("Yes","No")) if(response != "Yes") return can_reenter_corpse = FALSE @@ -649,7 +649,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Become mouse" set category = "Ghost" - if(config.disable_player_mice) + if(CONFIG_GET(flag/disable_player_mice)) to_chat(src, span_warning("Spawning as a mouse is currently disabled.")) return @@ -692,7 +692,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp to_chat(src, span_warning("Unable to find any unwelded vents to spawn mice at.")) if(host) - if(config.uneducated_mice) + if(CONFIG_GET(flag/uneducated_mice)) host.universal_understand = 0 announce_ghost_joinleave(src, 0, "They are now a mouse.") host.ckey = src.ckey @@ -722,7 +722,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Write in blood" set desc = "If the round is sufficiently spooky, write a short message in blood on the floor or a wall. Remember, no IC in OOC or OOC in IC." - if(!(config.cult_ghostwriter)) + if(!CONFIG_GET(flag/cult_ghostwriter)) to_chat(src, span_filter_notice(span_red("That verb is not currently permitted."))) return @@ -734,7 +734,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/ghosts_can_write if(ticker.mode.name == "cult") - if(cult.current_antagonists.len > config.cult_ghostwriter_req_cultists) + if(cult.current_antagonists.len > CONFIG_GET(number/cult_ghostwriter_req_cultists)) ghosts_can_write = 1 if(!ghosts_can_write && !check_rights(R_ADMIN|R_EVENT|R_FUN, 0)) //Let's allow for admins to write in blood for events and the such. @@ -905,7 +905,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(feedback) to_chat(src, span_warning("Your non-dead body prevent you from respawning.")) return 0 - if(config.antag_hud_restricted && has_enabled_antagHUD == 1) + if(CONFIG_GET(flag/antag_hud_restricted) && has_enabled_antagHUD == 1) if(feedback) to_chat(src, span_warning("antagHUD restrictions prevent you from respawning.")) return 0 diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 6f50d8bbdf..218289215a 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -16,7 +16,7 @@ return if(!src.client.holder) - if(!config.dsay_allowed) + if(!CONFIG_GET(flag/dsay_allowed)) to_chat(src, span_danger("Deadchat is globally muted.")) return diff --git a/code/modules/mob/language/language.dm b/code/modules/mob/language/language.dm index a295bea93a..f6d433a391 100644 --- a/code/modules/mob/language/language.dm +++ b/code/modules/mob/language/language.dm @@ -250,13 +250,13 @@ if(client && client.prefs.language_prefixes && client.prefs.language_prefixes.len) return client.prefs.language_prefixes[1] - return config.language_prefixes[1] + return CONFIG_GET(str_list/language_prefixes)[1] /mob/proc/is_language_prefix(var/prefix) if(client && client.prefs.language_prefixes && client.prefs.language_prefixes.len) return prefix in client.prefs.language_prefixes - return prefix in config.language_prefixes + return prefix in CONFIG_GET(str_list/language_prefixes) //TBD /mob/proc/check_lang_data() diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 2d152debdf..e31e3a615e 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -93,7 +93,7 @@ blinded = 1 silent = 0 else //ALIVE. LIGHTS ARE ON - if( !container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)) ) + if( !container && (health < CONFIG_GET(number/health_threshold_dead) || ((world.time - timeofhostdeath) > CONFIG_GET(number/revival_brain_life))) ) death() blinded = 1 silent = 0 diff --git a/code/modules/mob/living/carbon/breathe.dm b/code/modules/mob/living/carbon/breathe.dm index 1945db3e90..f4d90e9712 100644 --- a/code/modules/mob/living/carbon/breathe.dm +++ b/code/modules/mob/living/carbon/breathe.dm @@ -2,7 +2,7 @@ //Start of a breath chain, calls breathe() /mob/living/carbon/handle_breathing() - if(air_master.current_cycle%4==2 || failed_last_breath || (health < config.health_threshold_crit)) //First, resolve location and get a breath + if(air_master.current_cycle%4==2 || failed_last_breath || (health < CONFIG_GET(number/health_threshold_crit))) //First, resolve location and get a breath breathe() /mob/living/carbon/proc/breathe() @@ -12,7 +12,7 @@ var/datum/gas_mixture/breath = null //First, check if we can breathe at all - if(health < config.health_threshold_crit && !(CE_STABLE in chem_effects)) //crit aka circulatory shock + if(health < CONFIG_GET(number/health_threshold_crit) && !(CE_STABLE in chem_effects)) //crit aka circulatory shock AdjustLosebreath(1) if(losebreath>0) //Suffocating so do not take a breath diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 2949c387a2..1caf251fcf 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -194,7 +194,7 @@ return shock_damage /mob/living/carbon/proc/help_shake_act(mob/living/carbon/M) - if (src.health >= config.health_threshold_crit) + if (src.health >= CONFIG_GET(number/health_threshold_crit)) if(src == M && istype(src, /mob/living/carbon/human)) var/mob/living/carbon/human/H = src var/datum/gender/T = gender_datums[H.get_visible_gender()] diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index c2f767cbcb..6397b86fc1 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -53,7 +53,7 @@ update_hair() return 1 - + /mob/living/carbon/human/proc/change_hair_gradient(var/hair_gradient) if(!hair_gradient) return @@ -124,7 +124,7 @@ update_hair() return 1 - + /mob/living/carbon/human/proc/change_grad_color(var/red, var/green, var/blue) if(red == r_grad && green == g_grad && blue == b_grad) return @@ -180,7 +180,7 @@ for(var/current_species_name in GLOB.all_species) var/datum/species/current_species = GLOB.all_species[current_species_name] - if(check_whitelist && config.usealienwhitelist && !check_rights(R_ADMIN|R_EVENT, 0, src)) //If we're using the whitelist, make sure to check it! + if(check_whitelist && CONFIG_GET(flag/usealienwhitelist) && !check_rights(R_ADMIN|R_EVENT, 0, src)) //If we're using the whitelist, make sure to check it! if(!(current_species.spawn_flags & SPECIES_CAN_JOIN)) continue if(whitelist.len && !(current_species_name in whitelist)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index aa06a0cd17..75c4c2d9ce 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -237,7 +237,7 @@ if(update) UpdateDamageIcon() /mob/living/carbon/human/proc/implant_loyalty(override = FALSE) // Won't override by default. - if(!config.use_loyalty_implants && !override) return // Nuh-uh. + if(!CONFIG_GET(flag/use_loyalty_implants) && !override) return // Nuh-uh. var/obj/item/implant/loyalty/L = new/obj/item/implant/loyalty(src) if(L.handle_implant(src, BP_HEAD)) @@ -1774,7 +1774,7 @@ return ..() /mob/living/carbon/human/pull_damage() - if(((health - halloss) <= config.health_threshold_softcrit)) + if(((health - halloss) <= CONFIG_GET(number/health_threshold_softcrit))) for(var/name in organs_by_name) var/obj/item/organ/external/e = organs_by_name[name] if(!e) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 638febe0d5..34054954e9 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -75,7 +75,7 @@ if (istype(H) && attempt_to_scoop(H)) return 0; // VOREStation Edit - End - if(istype(H) && health < config.health_threshold_crit) + if(istype(H) && health < CONFIG_GET(number/health_threshold_crit)) if(!H.check_has_mouth()) to_chat(H, span_danger("You don't have a mouth, you cannot perform CPR!")) return @@ -104,7 +104,7 @@ H.visible_message(span_danger("\The [H] performs CPR on \the [src]!")) to_chat(H, span_warning("Repeat at least every 7 seconds.")) - if(istype(H) && health > config.health_threshold_dead) + if(istype(H) && health > CONFIG_GET(number/health_threshold_dead)) adjustOxyLoss(-(min(getOxyLoss(), 5))) updatehealth() to_chat(src, span_notice("You feel a breath of fresh air enter your lungs. It feels good.")) diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index 9733256081..6ccfeb5fb8 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -18,7 +18,7 @@ health = getMaxHealth() - getOxyLoss() - getToxLoss() - getCloneLoss() - total_burn - total_brute //TODO: fix husking - if( ((getMaxHealth() - total_burn) < config.health_threshold_dead * huskmodifier) && stat == DEAD) + if( ((getMaxHealth() - total_burn) < CONFIG_GET(number/health_threshold_dead) * huskmodifier) && stat == DEAD) ChangeToHusk() return diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 3106dfd248..8d8fbfd5b3 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -369,7 +369,7 @@ emp_act effective_force -= round(effective_force*0.8) //want the dislocation chance to be such that the limb is expected to dislocate after dealing a fraction of the damage needed to break the limb - var/dislocate_chance = effective_force/(dislocate_mult * organ.min_broken_damage * config.organ_health_multiplier)*100 + var/dislocate_chance = effective_force/(dislocate_mult * organ.min_broken_damage * CONFIG_GET(number/organ_health_multiplier))*100 if(prob(dislocate_chance * (100 - blocked)/100)) visible_message(span_danger("[src]'s [organ.joint] [pick("gives way","caves in","crumbles","collapses")]!")) organ.dislocate(1) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index acb8a5e8ad..338c72451f 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -116,7 +116,7 @@ . *= 0.5 . -= chem_effects[CE_SPEEDBOOST] // give 'em a buff on top. - . = max(HUMAN_LOWEST_SLOWDOWN, . + config.human_delay) // Minimum return should be the same as force_max_speed + . = max(HUMAN_LOWEST_SLOWDOWN, . + CONFIG_GET(number/human_delay)) // Minimum return should be the same as force_max_speed . += ..() /mob/living/carbon/human/Moved() @@ -257,7 +257,7 @@ return if(is_incorporeal()) return - if(!config.footstep_volume || !T.footstep_sounds || !T.footstep_sounds.len) + if(!CONFIG_GET(number/footstep_volume) || !T.footstep_sounds || !T.footstep_sounds.len) return // Future Upgrades - Multi species support var/list/footstep_sounds = T.footstep_sounds["human"] @@ -276,7 +276,7 @@ if(m_intent == "run" && step_count++ % 2 != 0) return - var/volume = config.footstep_volume + var/volume = CONFIG_GET(number/footstep_volume) // Reduce volume while walking or barefoot if(!shoes || m_intent == "walk") diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 056dbf7f03..7d64ac51cf 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -551,7 +551,7 @@ if(!breath || (breath.total_moles == 0)) failed_last_breath = 1 - if(health > config.health_threshold_crit) + if(health > CONFIG_GET(number/health_threshold_crit)) adjustOxyLoss(HUMAN_MAX_OXYLOSS) else adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS) @@ -1201,14 +1201,14 @@ else //ALIVE. LIGHTS ARE ON updatehealth() //TODO - if(health <= config.health_threshold_dead || (should_have_organ("brain") && !has_brain())) + if(health <= CONFIG_GET(number/health_threshold_dead) || (should_have_organ("brain") && !has_brain())) death() blinded = 1 silent = 0 return 1 //UNCONSCIOUS. NO-ONE IS HOME - if((getOxyLoss() > (species.total_health/2)) || (health <= config.health_threshold_crit)) + if((getOxyLoss() > (species.total_health/2)) || (health <= CONFIG_GET(number/health_threshold_crit))) Paralyse(3) if(hallucination) @@ -1581,7 +1581,7 @@ clear_fullscreen("belly3") clear_fullscreen("belly4") - if(config.welder_vision) + if(CONFIG_GET(flag/welder_vision)) var/found_welder if(species.short_sighted) found_welder = 1 @@ -1832,12 +1832,12 @@ if(status_flags & GODMODE) return 0 //godmode if(!can_feel_pain()) return - if(health < config.health_threshold_softcrit)// health 0 makes you immediately collapse + if(health < CONFIG_GET(number/health_threshold_softcrit))// health 0 makes you immediately collapse shock_stage = max(shock_stage, 61) if(traumatic_shock >= 80) shock_stage += 1 - else if(health < config.health_threshold_softcrit) + else if(health < CONFIG_GET(number/health_threshold_softcrit)) shock_stage = max(shock_stage, 61) else shock_stage = min(shock_stage, 160) @@ -2012,7 +2012,7 @@ if(stat == DEAD) holder.icon_state = "-100" // X_X else - holder.icon_state = RoundHealth((health-config.health_threshold_crit)/(getMaxHealth()-config.health_threshold_crit)*100) + holder.icon_state = RoundHealth((health-CONFIG_GET(number/health_threshold_crit))/(getMaxHealth()-CONFIG_GET(number/health_threshold_crit))*100) if(block_hud) holder.icon_state = "hudblank" apply_hud(HEALTH_HUD, holder) diff --git a/code/modules/mob/living/carbon/human/species/species_getters.dm b/code/modules/mob/living/carbon/human/species/species_getters.dm index efffe3d002..298179fa5a 100644 --- a/code/modules/mob/living/carbon/human/species/species_getters.dm +++ b/code/modules/mob/living/carbon/human/species/species_getters.dm @@ -41,7 +41,7 @@ return ((H && H.isSynthetic()) ? "encounters a hardware fault and suddenly reboots!" : knockout_message) /datum/species/proc/get_death_message(var/mob/living/carbon/human/H) - if(config.show_human_death_message) + if(CONFIG_GET(flag/show_human_death_message)) return ((H && H.isSynthetic()) ? "gives one shrill beep before falling lifeless." : death_message) else return DEATHGASP_NO_MESSAGE diff --git a/code/modules/mob/living/carbon/human/species/station/alraune.dm b/code/modules/mob/living/carbon/human/species/station/alraune.dm index 38fbfa66f0..6889cb3bbb 100644 --- a/code/modules/mob/living/carbon/human/species/station/alraune.dm +++ b/code/modules/mob/living/carbon/human/species/station/alraune.dm @@ -138,7 +138,7 @@ if(!breath || (breath.total_moles == 0)) H.failed_last_breath = 1 - if(H.health > config.health_threshold_crit) + if(H.health > CONFIG_GET(number/health_threshold_crit)) H.adjustOxyLoss(ALRAUNE_MAX_OXYLOSS) else H.adjustOxyLoss(ALRAUNE_CRIT_MAX_OXYLOSS) diff --git a/code/modules/mob/living/carbon/human/species/xenomorphs/alien_powers.dm b/code/modules/mob/living/carbon/human/species/xenomorphs/alien_powers.dm index 10f21ec169..7c69a214c1 100644 --- a/code/modules/mob/living/carbon/human/species/xenomorphs/alien_powers.dm +++ b/code/modules/mob/living/carbon/human/species/xenomorphs/alien_powers.dm @@ -83,7 +83,7 @@ set desc = "Lay an egg that will eventually hatch into a new xenomorph larva. Life finds a way." set category = "Abilities" - if(!config.aliens_allowed) + if(!CONFIG_GET(flag/aliens_allowed)) to_chat(src, "You begin to lay an egg, but hesitate. You suspect it isn't allowed.") remove_verb(src, /mob/living/carbon/human/proc/lay_egg) return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 7564d37ae3..729119068e 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -713,7 +713,7 @@ set category = "OOC" set src in view() //VOREStation Edit Start - Making it so SSD people have prefs with fallback to original style. - if(config.allow_Metadata) + if(CONFIG_GET(flag/allow_metadata)) if(ooc_notes) ooc_notes_window(usr) // to_chat(usr, span_filter_notice("[src]'s Metainfo:
[ooc_notes]")) @@ -1137,7 +1137,7 @@ add_attack_logs(src,M,"Thrown via grab to [end_T.x],[end_T.y],[end_T.z]") if(ishuman(M)) var/mob/living/carbon/human/N = M - if((N.health + N.halloss) < config.health_threshold_crit || N.stat == DEAD) + if((N.health + N.halloss) < CONFIG_GET(number/health_threshold_crit) || N.stat == DEAD) N.adjustBruteLoss(rand(10,30)) src.drop_from_inventory(G) diff --git a/code/modules/mob/living/silicon/ai/ai_remote_control.dm b/code/modules/mob/living/silicon/ai/ai_remote_control.dm index adb410ab45..cfe1d2873a 100644 --- a/code/modules/mob/living/silicon/ai/ai_remote_control.dm +++ b/code/modules/mob/living/silicon/ai/ai_remote_control.dm @@ -2,12 +2,12 @@ var/mob/living/silicon/robot/deployed_shell = null //For shell control /mob/living/silicon/ai/Initialize() - if(config.allow_ai_shells) + if(CONFIG_GET(flag/allow_ai_shells)) add_verb(src, /mob/living/silicon/ai/proc/deploy_to_shell_act) return ..() /mob/living/silicon/ai/proc/deploy_to_shell(var/mob/living/silicon/robot/target) - if(!config.allow_ai_shells) + if(!CONFIG_GET(flag/allow_ai_shells)) to_chat(src, span_warning("AI Shells are not allowed on this server. You shouldn't have this verb because of it, so consider making a bug report.")) return diff --git a/code/modules/mob/living/silicon/ai/malf.dm b/code/modules/mob/living/silicon/ai/malf.dm index 6727a983fa..5a4d018bcd 100644 --- a/code/modules/mob/living/silicon/ai/malf.dm +++ b/code/modules/mob/living/silicon/ai/malf.dm @@ -105,7 +105,7 @@ // Returns percentage of AI's remaining hardware integrity (maxhealth - (bruteloss + fireloss)) /mob/living/silicon/ai/proc/hardware_integrity() - return (health-config.health_threshold_dead)/2 + return (health - CONFIG_GET(number/health_threshold_dead)) / 2 // Shows capacitor charge and hardware integrity information to the AI in Status tab. /mob/living/silicon/ai/show_system_integrity() diff --git a/code/modules/mob/living/silicon/decoy/life.dm b/code/modules/mob/living/silicon/decoy/life.dm index 66e55020cf..724390796a 100644 --- a/code/modules/mob/living/silicon/decoy/life.dm +++ b/code/modules/mob/living/silicon/decoy/life.dm @@ -2,7 +2,7 @@ if (src.stat == 2) return else - if (src.health <= config.health_threshold_dead && src.stat != 2) + if (src.health <= CONFIG_GET(number/health_threshold_dead) && src.stat != 2) death() return diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index f2932bedda..ba2c6ef4fa 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -239,7 +239,7 @@ var/list/mob_hat_cache = list() var/datum/gender/TU = gender_datums[user.get_visible_gender()] if(stat == 2) - if(!config.allow_drone_spawn || emagged || health < -35) //It's dead, Dave. + if(!CONFIG_GET(flag/allow_drone_spawn) || emagged || health < -35) //It's dead, Dave. to_chat(user, span_danger("The interface is fried, and a distressing burned smell wafts from the robot's interior. You're not rebooting this one.")) return @@ -251,7 +251,7 @@ var/list/mob_hat_cache = list() var/drones = 0 for(var/mob/living/silicon/robot/drone/D in player_list) drones++ - if(drones < config.max_maint_drones) + if(drones < CONFIG_GET(number/max_maint_drones)) request_player() return diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index 2085cabed2..18da101324 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -57,14 +57,14 @@ icon_state = "drone_fab_active" var/elapsed = world.time - time_last_drone - drone_progress = round((elapsed/config.drone_build_time)*100) + drone_progress = round((elapsed / CONFIG_GET(number/drone_build_time)) * 100) if(drone_progress >= 100) visible_message("\The [src] voices a strident beep, indicating a drone chassis is prepared.") /obj/machinery/drone_fabricator/examine(mob/user) . = ..() - if(produce_drones && drone_progress >= 100 && istype(user,/mob/observer/dead) && config.allow_drone_spawn && count_drones() < config.max_maint_drones) + if(produce_drones && drone_progress >= 100 && istype(user,/mob/observer/dead) && CONFIG_GET(flag/allow_drone_spawn) && count_drones() < CONFIG_GET(number/max_maint_drones)) . += "
A drone is prepared. Select 'Join As Drone' from the Ghost tab to spawn as a maintenance drone." /obj/machinery/drone_fabricator/proc/create_drone(var/client/player) @@ -72,7 +72,7 @@ if(stat & NOPOWER) return - if(!produce_drones || !config.allow_drone_spawn || count_drones() >= config.max_maint_drones) + if(!produce_drones || !CONFIG_GET(flag/allow_drone_spawn) || count_drones() >= CONFIG_GET(number/max_maint_drones)) return if(player && !istype(player.mob,/mob/observer/dead)) @@ -102,7 +102,7 @@ to_chat(src, span_danger("The game hasn't started yet!")) return - if(!(config.allow_drone_spawn)) + if(!CONFIG_GET(flag/allow_drone_spawn)) to_chat(src, span_danger("That verb is not currently permitted.")) return @@ -117,7 +117,7 @@ return // VOREStation Addition Start - if(config.use_age_restriction_for_jobs && isnum(src.client.player_age)) + if(CONFIG_GET(flag/use_age_restriction_for_jobs) && isnum(src.client.player_age)) var/time_till_play = max(0, 3 - src.client.player_age) if(time_till_play) to_chat(usr, span_danger("You have not been playing on the server long enough to join as drone.")) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 3019869da8..3f7a39f07e 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -82,7 +82,7 @@ //if(src.resting) // VOREStation edit. Our borgos would rather not. // Weaken(5) - if(health < config.health_threshold_dead && src.stat != 2) //die only once + if(health < CONFIG_GET(number/health_threshold_dead) && src.stat != 2) //die only once death() if (src.stat != 2) //Alive. @@ -242,7 +242,7 @@ src.healths.icon_state = "health3" else if(health >= 0) src.healths.icon_state = "health4" - else if(health >= config.health_threshold_dead) + else if(health >= CONFIG_GET(number/health_threshold_dead)) src.healths.icon_state = "health5" else src.healths.icon_state = "health6" diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 3ea4809865..6b2b84e024 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1305,13 +1305,13 @@ /mob/living/silicon/robot/proc/add_robot_verbs() add_verb(src, robot_verbs_default) add_verb(src, silicon_subsystems) - if(config.allow_robot_recolor) + if(CONFIG_GET(flag/allow_robot_recolor)) add_verb(src, /mob/living/silicon/robot/proc/ColorMate) /mob/living/silicon/robot/proc/remove_robot_verbs() remove_verb(src, robot_verbs_default) remove_verb(src, silicon_subsystems) - if(config.allow_robot_recolor) + if(CONFIG_GET(flag/allow_robot_recolor)) remove_verb(src, /mob/living/silicon/robot/proc/ColorMate) // Uses power from cyborg's cell. Returns 1 on success or 0 on failure. diff --git a/code/modules/mob/living/silicon/robot/robot_movement.dm b/code/modules/mob/living/silicon/robot/robot_movement.dm index d37a1a5947..252d23fe93 100644 --- a/code/modules/mob/living/silicon/robot/robot_movement.dm +++ b/code/modules/mob/living/silicon/robot/robot_movement.dm @@ -35,7 +35,7 @@ if(get_restraining_bolt()) // Borgs with Restraining Bolts move slower. . += 1 - . += config.robot_delay + . += CONFIG_GET(number/robot_delay) . += ..() diff --git a/code/modules/mob/living/silicon/robot/robot_remote_control.dm b/code/modules/mob/living/silicon/robot/robot_remote_control.dm index 4f38630848..56586dcf46 100644 --- a/code/modules/mob/living/silicon/robot/robot_remote_control.dm +++ b/code/modules/mob/living/silicon/robot/robot_remote_control.dm @@ -115,7 +115,7 @@ GLOBAL_LIST_EMPTY(available_ai_shells) undeploy("Remote session terminated.") /mob/living/silicon/robot/attack_ai(mob/user) - if(shell && config.allow_ai_shells && (!connected_ai || connected_ai == user)) + if(shell && CONFIG_GET(flag/allow_ai_shells) && (!connected_ai || connected_ai == user)) var/mob/living/silicon/ai/AI = user if(istype(AI)) // Just in case we're clicked by a borg AI.deploy_to_shell(src) @@ -132,6 +132,6 @@ GLOBAL_LIST_EMPTY(available_ai_shells) delete_me = TRUE /obj/effect/landmark/free_ai_shell/Initialize() - if(config.allow_ai_shells && config.give_free_ai_shell) + if(CONFIG_GET(flag/allow_ai_shells) && CONFIG_GET(flag/give_free_ai_shell)) new /mob/living/silicon/robot/ai_shell(get_turf(src)) return ..() diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm index ec4ff326ff..e063e5b94a 100644 --- a/code/modules/mob/living/simple_mob/simple_mob.dm +++ b/code/modules/mob/living/simple_mob/simple_mob.dm @@ -198,7 +198,7 @@ if(organ_names) organ_names = GET_DECL(organ_names) - if(config.allow_simple_mob_recolor) + if(CONFIG_GET(flag/allow_simple_mob_recolor)) add_verb(src, /mob/living/simple_mob/proc/ColorMate) @@ -282,7 +282,7 @@ . += injury_level // VOREStation Edit Stop - . += config.animal_delay + . += CONFIG_GET(number/animal_delay) . += ..() diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/pets/cat_vr.dm b/code/modules/mob/living/simple_mob/subtypes/animal/pets/cat_vr.dm index 771d373947..392ad3361f 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/pets/cat_vr.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/pets/cat_vr.dm @@ -50,7 +50,7 @@ if (has_AI() && friend) var/friend_dist = get_dist(src,friend) if (friend_dist <= 1) - if (friend.stat >= DEAD || friend.health <= config.health_threshold_softcrit) + if (friend.stat >= DEAD || friend.health <= CONFIG_GET(number/health_threshold_softcrit)) if (prob((friend.stat < DEAD)? 50 : 15)) var/verb = pick("meows", "mews", "mrowls") audible_emote(pick("[verb] in distress.", "[verb] anxiously.")) @@ -74,4 +74,3 @@ qdel(src) //Back from whence you came! . = ..(FALSE, deathmessage) - diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index dcb9c3d9a8..72168f1631 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -4,7 +4,7 @@ lastKnownIP = client.address computer_id = client.computer_id log_access_in(client) - if(config.log_access) + if(CONFIG_GET(flag/log_access)) for(var/mob/M in player_list) if(M == src) continue if( M.key && (M.key != key) ) @@ -14,7 +14,7 @@ if( (client.connection != "web") && (M.computer_id == client.computer_id) ) if(matches) matches += " and " matches += "ID ([client.computer_id])" - if(!config.disable_cid_warn_popup) + if(!CONFIG_GET(flag/disable_cid_warn_popup)) tgui_alert_async(usr, "You appear to have logged in with another key this round, which is not permitted. Please contact an administrator if you believe this message to be in error.") if(matches) if(M.client) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index ec16537753..d772f6d487 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -354,9 +354,9 @@ // Special cases, can never respawn if(ticker?.mode?.deny_respawn) time = -1 - else if(!config.abandon_allowed) + else if(!CONFIG_GET(flag/abandon_allowed)) time = -1 - else if(!config.respawn) + else if(!CONFIG_GET(flag/respawn)) time = -1 // Special case for observing before game start @@ -365,7 +365,7 @@ // Wasn't given a time, use the config time else if(!time) - time = config.respawn_time + time = CONFIG_GET(number/respawn_time) var/keytouse = ckey // Try harder to find a key to use @@ -377,7 +377,7 @@ GLOB.respawn_timers[keytouse] = world.time + time /mob/observer/dead/set_respawn_timer() - if(config.antag_hud_restricted && has_enabled_antagHUD) + if(CONFIG_GET(flag/antag_hud_restricted) && has_enabled_antagHUD) ..(-1) else return // Don't set it, no need diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 2df28b1bb6..5ff11814f6 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -16,9 +16,9 @@ if("run") if(drowsyness > 0) . += 6 - . += config.run_speed + . += CONFIG_GET(number/run_speed) if("walk") - . += config.walk_speed + . += CONFIG_GET(number/walk_speed) /client/proc/client_dir(input, direction=-1) return turn(input, direction*dir2angle(dir)) diff --git a/code/modules/mob/new_player/login.dm b/code/modules/mob/new_player/login.dm index 938002d796..dd2dc1d9aa 100644 --- a/code/modules/mob/new_player/login.dm +++ b/code/modules/mob/new_player/login.dm @@ -33,7 +33,7 @@ var/obj/effect/lobby_image = new /obj/effect/lobby_image to_chat(src, examine_block("
[join_motd]
")) if(has_respawned) - to_chat(usr, config.respawn_message) + to_chat(usr, CONFIG_GET(string/respawn_message)) has_respawned = FALSE if(!mind) @@ -90,10 +90,10 @@ var/obj/effect/lobby_image = new /obj/effect/lobby_image // So we can be more wordy and give links. to_chat(src, span_userdanger("Your client version has known issues.") + " Please consider using a different version: https://www.byond.com/download/build/.") var/chat_message = "" - if(config.suggested_byond_version) - chat_message += "We suggest using version [config.suggested_byond_version]." - if(config.suggested_byond_build) - chat_message += "[config.suggested_byond_build]." + if(CONFIG_GET(number/suggested_byond_version)) + chat_message += "We suggest using version [CONFIG_GET(number/suggested_byond_version)]." + if(CONFIG_GET(number/suggested_byond_build)) + chat_message += "[CONFIG_GET(number/suggested_byond_build)]." chat_message += " If you find this version doesn't work for you, let us know." to_chat(src, chat_message) to_chat(src, "Tip: You can always use the '.zip' versions of BYOND and keep multiple versions in folders wherever you want, rather than uninstalling/reinstalling. Just make sure BYOND is *really* closed (check your system tray for the icon) before starting a different version.") diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 7fe685edf9..76c28cb5a7 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -197,7 +197,7 @@ client.prefs.real_name = random_name(client.prefs.identifying_gender) observer.real_name = client.prefs.real_name observer.name = observer.real_name - if(!client.holder && !config.antag_hud_allowed) // For new ghosts we remove the verb from even showing up if it's not allowed. + if(!client.holder && !CONFIG_GET(flag/antag_hud_allowed)) // For new ghosts we remove the verb from even showing up if it's not allowed. remove_verb(observer, /mob/observer/dead/verb/toggle_antagHUD) // Poor guys, don't know what they are missing! observer.key = key observer.set_respawn_timer(time_till_respawn()) // Will keep their existing time if any, or return 0 and pass 0 into set_respawn_timer which will use the defaults @@ -413,7 +413,7 @@ if(!ticker || ticker.current_state != GAME_STATE_PLAYING) to_chat(usr, span_red("The round is either not ready, or has already finished...")) return 0 - if(!config.enter_allowed) + if(!CONFIG_GET(flag/enter_allowed)) to_chat(usr, span_notice("There is an administrative lock on entering the game!")) return 0 if(!IsJobAvailable(rank)) diff --git a/code/modules/mob/new_player/new_player_vr.dm b/code/modules/mob/new_player/new_player_vr.dm index 678a45102a..d1587a6f43 100644 --- a/code/modules/mob/new_player/new_player_vr.dm +++ b/code/modules/mob/new_player/new_player_vr.dm @@ -7,12 +7,12 @@ return TRUE //No Flavor Text - if (config.require_flavor && !(J.mob_type & JOB_SILICON) && (!client?.prefs?.flavor_texts["general"] || length(client.prefs.flavor_texts["general"]) < 30)) + if (CONFIG_GET(flag/require_flavor) && !(J.mob_type & JOB_SILICON) && (!client?.prefs?.flavor_texts["general"] || length(client.prefs.flavor_texts["general"]) < 30)) to_chat(src,span_warning("Please set your general flavor text to give a basic description of your character. Set it using the 'Set Flavor text' button on the 'General' tab in character setup, and choosing 'General' category.")) pass = FALSE //No OOC notes - if (config.allow_Metadata && (!client?.prefs?.metadata || length(client.prefs.metadata) < 15)) + if (CONFIG_GET(flag/allow_metadata) && (!client?.prefs?.metadata || length(client.prefs.metadata) < 15)) to_chat(src,span_warning("Please set informative OOC notes related to RP/ERP preferences. Set them using the 'OOC Notes' button on the 'General' tab in character setup.")) pass = FALSE diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 43e853b1b5..a5b7a6f00d 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -64,7 +64,7 @@ return // Clientless mobs shouldn't be trying to talk in deadchat. if(!client.holder) - if(!config.dsay_allowed) + if(!CONFIG_GET(flag/dsay_allowed)) to_chat(src, span_danger("Deadchat is globally muted.")) return diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm index 4446bc9f19..b044c91043 100644 --- a/code/modules/organs/internal/brain.dm +++ b/code/modules/organs/internal/brain.dm @@ -33,7 +33,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain) if(!owner || owner.stat == DEAD) defib_timer = max(--defib_timer, 0) else - defib_timer = min(++defib_timer, (config.defib_timer MINUTES) / 20) // Time vars measure things in ticks. Life tick happens every ~2 seconds, therefore dividing by 20 + defib_timer = min(++defib_timer, (CONFIG_GET(number/defib_timer) MINUTES) / 20) // Time vars measure things in ticks. Life tick happens every ~2 seconds, therefore dividing by 20 /obj/item/organ/internal/brain/proc/can_assist() return can_assist @@ -80,8 +80,8 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain) /obj/item/organ/internal/brain/New() ..() - health = config.default_brain_health - defib_timer = (config.defib_timer MINUTES) / 20 // Time vars measure things in ticks. Life tick happens every ~2 seconds, therefore dividing by 20 + health = CONFIG_GET(number/default_brain_health) + defib_timer = (CONFIG_GET(number/defib_timer) MINUTES) / 20 // Time vars measure things in ticks. Life tick happens every ~2 seconds, therefore dividing by 20 spawn(5) if(brainmob) butcherable = FALSE diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm index 1ef703cc9f..37f7d08b90 100644 --- a/code/modules/organs/organ.dm +++ b/code/modules/organs/organ.dm @@ -179,7 +179,7 @@ var/list/organ_cache = list() if(B && prob(40) && !isbelly(loc)) //VOREStation Edit reagents.remove_reagent("blood",0.1) blood_splatter(src,B,1) - if(config.organs_decay && decays) damage += rand(1,3) + if(CONFIG_GET(flag/organs_decay) && decays) damage += rand(1,3) if(damage >= max_damage) damage = max_damage adjust_germ_level(rand(2,6)) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index d2d4b714dc..dd8279f67f 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -308,7 +308,7 @@ // push them faster into paincrit though, as the additional damage is converted into shock. var/brute_overflow = 0 var/burn_overflow = 0 - if(is_damageable(brute + burn) || !config.limbs_can_break) + if(is_damageable(brute + burn) || !CONFIG_GET(flag/limbs_can_break)) if(brute) if(can_cut) if(sharp && !edge) @@ -322,7 +322,7 @@ else //If we can't inflict the full amount of damage, spread the damage in other ways //How much damage can we actually cause? - var/can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam) + var/can_inflict = max_damage * CONFIG_GET(number/organ_health_multiplier) - (brute_dam + burn_dam) var/spillover = 0 if(can_inflict) if (brute > 0) @@ -339,7 +339,7 @@ //How much brute damage is left to inflict spillover += max(0, brute - can_inflict) - can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam) //Refresh the can_inflict var, so burn doesn't overload the limb if it is set to take both. + can_inflict = max_damage * CONFIG_GET(number/organ_health_multiplier) - (brute_dam + burn_dam) //Refresh the can_inflict var, so burn doesn't overload the limb if it is set to take both. if (burn > 0 && can_inflict) //Inflict all burn damage we can @@ -350,7 +350,7 @@ //If there is pain to dispense. if(spillover) - owner.shock_stage += spillover * config.organ_damage_spillover_multiplier + owner.shock_stage += spillover * CONFIG_GET(number/organ_damage_spillover_multiplier) // sync the organ's damage with its wounds src.update_damages() @@ -359,7 +359,7 @@ //If limb took enough damage, try to cut or tear it off if(owner && loc == owner && !is_stump()) - if(!cannot_amputate && config.limbs_can_break && (brute_dam + burn_dam) >= (max_damage * config.organ_health_multiplier)) + if(!cannot_amputate && CONFIG_GET(flag/limbs_can_break) && (brute_dam + burn_dam) >= (max_damage * CONFIG_GET(number/organ_health_multiplier))) //organs can come off in three cases //1. If the damage source is edge_eligible and the brute damage dealt exceeds the edge threshold, then the organ is cut off. //2. If the damage amount dealt exceeds the disintegrate threshold, the organ is completely obliterated. @@ -550,7 +550,7 @@ This function completely restores a damaged organ to perfect condition. //Burn damage can cause fluid loss due to blistering and cook-off if((damage > 5 || damage + burn_dam >= 15) && type == BURN && (robotic < ORGAN_ROBOT) && !(species.flags & NO_BLOOD)) - var/fluid_loss = 0.4 * (damage/(owner.getMaxHealth() - config.health_threshold_dead)) * owner.species.blood_volume*(1 - owner.species.blood_level_fatal) + var/fluid_loss = 0.4 * (damage/(owner.getMaxHealth() - CONFIG_GET(number/health_threshold_dead))) * owner.species.blood_volume*(1 - owner.species.blood_level_fatal) owner.remove_blood(fluid_loss) // first check whether we can widen an existing wound @@ -777,7 +777,7 @@ Note that amputating the affected organ does in fact remove the infection from t //we only update wounds once in [wound_update_accuracy] ticks so have to emulate realtime heal_amt = heal_amt * wound_update_accuracy //configurable regen speed woo, no-regen hardcore or instaheal hugbox, choose your destiny - heal_amt = heal_amt * config.organ_regeneration_multiplier + heal_amt = heal_amt * CONFIG_GET(number/organ_regeneration_multiplier) // amount of healing is spread over all the wounds heal_amt = heal_amt / (wounds.len + 1) // making it look prettier on scanners @@ -827,7 +827,7 @@ Note that amputating the affected organ does in fact remove the infection from t status |= ORGAN_BLEEDING //Bone fractures - if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(robotic >= ORGAN_ROBOT)) + if(CONFIG_GET(flag/bones_can_break) && brute_dam > min_broken_damage * CONFIG_GET(number/organ_health_multiplier) && !(robotic >= ORGAN_ROBOT)) src.fracture() update_health() @@ -1112,7 +1112,7 @@ Note that amputating the affected organ does in fact remove the infection from t /obj/item/organ/external/proc/mend_fracture() if(robotic >= ORGAN_ROBOT) return 0 //ORGAN_BROKEN doesn't have the same meaning for robot limbs - if(brute_dam > min_broken_damage * config.organ_health_multiplier) + if(brute_dam > min_broken_damage * CONFIG_GET(number/organ_health_multiplier)) return 0 //will just immediately fracture again status &= ~ORGAN_BROKEN diff --git a/code/modules/organs/subtypes/standard.dm b/code/modules/organs/subtypes/standard.dm index 01c05fe2b9..0aca3669cf 100644 --- a/code/modules/organs/subtypes/standard.dm +++ b/code/modules/organs/subtypes/standard.dm @@ -283,7 +283,7 @@ var/eyes_over_markings = FALSE //VOREStation edit /obj/item/organ/external/head/Initialize() - if(config.allow_headgibs) + if(CONFIG_GET(flag/allow_headgibs)) cannot_gib = FALSE return ..() diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index 577b1e7681..45892c176c 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -470,16 +470,16 @@ Extracted to its own procedure for easier logic handling with paper bundles. if (istype(fax, /obj/item/paper)) var/obj/item/paper/P = fax var/text = "[P.name][P.info][P.stamps]"; - file("[config.fax_export_dir]/fax_[faxid].html") << text; + file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text; else if (istype(fax, /obj/item/photo)) var/obj/item/photo/H = fax - fcopy(H.img, "[config.fax_export_dir]/photo_[faxid].png") + fcopy(H.img, "[CONFIG_GET(string/fax_export_dir)]/photo_[faxid].png") var/text = "[H.name]" \ + "" \ + "" \ + "[H.scribble ? "
Written on the back:
[H.scribble]" : ""]"\ + "" - file("[config.fax_export_dir]/fax_[faxid].html") << text + file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text else if (istype(fax, /obj/item/paper_bundle)) var/obj/item/paper_bundle/B = fax var/data = "" @@ -488,7 +488,7 @@ Extracted to its own procedure for easier logic handling with paper bundles. var/page_faxid = export_fax(pageobj) data += "Page [page] - [pageobj.name]
" var/text = "[B.name][data]" - file("[config.fax_export_dir]/fax_[faxid].html") << text + file("[CONFIG_GET(string/fax_export_dir)]/fax_[faxid].html") << text return faxid @@ -497,16 +497,16 @@ Extracted to its own procedure for easier logic handling with paper bundles. * Call the chat webhook to transmit a notification of an admin fax to the admin chat. */ /obj/machinery/photocopier/faxmachine/proc/message_chat_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/faxid, font_colour="#006100") - if (config.chat_webhook_url) + if (CONFIG_GET(string/chat_webhook_url)) spawn(0) var/query_string = "type=fax" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&faxid=[url_encode(faxid)]" query_string += "&color=[url_encode(font_colour)]" query_string += "&faxname=[url_encode(faxname)]" query_string += "&sendername=[url_encode(sender.name)]" query_string += "&sentname=[url_encode(sent.name)]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") @@ -515,12 +515,12 @@ Extracted to its own procedure for easier logic handling with paper bundles. * Call the chat webhook to transmit a notification of a job request */ /obj/machinery/photocopier/faxmachine/proc/message_chat_rolerequest(var/font_colour="#006100", var/role_to_ping, var/reason, var/jobname) - if(config.chat_webhook_url) + if(CONFIG_GET(string/chat_webhook_url)) spawn(0) var/query_string = "type=rolerequest" - query_string += "&key=[url_encode(config.chat_webhook_key)]" + query_string += "&key=[url_encode(CONFIG_GET(string/chat_webhook_key))]" query_string += "&ping=[url_encode(role_to_ping)]" query_string += "&color=[url_encode(font_colour)]" query_string += "&reason=[url_encode(reason)]" query_string += "&job=[url_encode(jobname)]" - world.Export("[config.chat_webhook_url]?[query_string]") + world.Export("[CONFIG_GET(string/chat_webhook_url)]?[query_string]") diff --git a/code/modules/persistence/graffiti.dm b/code/modules/persistence/graffiti.dm index 03c634c277..033aa212d5 100644 --- a/code/modules/persistence/graffiti.dm +++ b/code/modules/persistence/graffiti.dm @@ -30,7 +30,7 @@ random_icon_states.Remove(W.icon_state) if(random_icon_states.len) icon_state = pick(random_icon_states) - if(!mapload || !config.persistence_ignore_mapload) + if(!mapload || !CONFIG_GET(flag/persistence_ignore_mapload)) SSpersistence.track_value(src, /datum/persistent/graffiti) . = ..() diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 8f8dae624d..609c951614 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -299,7 +299,7 @@ GLOBAL_LIST_EMPTY(solars_list) /obj/machinery/power/solar_control/proc/auto_start(forced = FALSE) // Automatically sets the solars, if allowed. - if(forced || auto_start == SOLAR_AUTO_START_YES || (auto_start == SOLAR_AUTO_START_CONFIG && config.autostart_solars) ) + if(forced || auto_start == SOLAR_AUTO_START_YES || (auto_start == SOLAR_AUTO_START_CONFIG && CONFIG_GET(flag/autostart_solars)) ) track = 2 // Auto tracking mode. search_for_connected() if(connected_tracker) diff --git a/code/modules/radiation/radiation.dm b/code/modules/radiation/radiation.dm index c467183cb5..f0f38ae54e 100644 --- a/code/modules/radiation/radiation.dm +++ b/code/modules/radiation/radiation.dm @@ -18,12 +18,12 @@ /datum/radiation_source/proc/update_rad_power(var/new_power = null) if(new_power == null || new_power == rad_power) return // No change - else if(new_power <= config.radiation_lower_limit) + else if(new_power <= CONFIG_GET(number/radiation_lower_limit)) qdel(src) // Decayed to nothing else rad_power = new_power if(!flat) - range = min(round(sqrt(rad_power / config.radiation_lower_limit)), 31) // R = rad_power / dist**2 - Solve for dist + range = min(round(sqrt(rad_power / CONFIG_GET(number/radiation_lower_limit))), 31) // R = rad_power / dist**2 - Solve for dist return /turf @@ -38,7 +38,7 @@ else if(O.density) //So open doors don't get counted var/datum/material/M = O.get_material() if(!M) continue - cached_rad_resistance += (M.weight + M.radiation_resistance) / config.radiation_material_resistance_divisor + cached_rad_resistance += (M.weight + M.radiation_resistance) / CONFIG_GET(number/radiation_material_resistance_divisor) // Looks like storing the contents length is meant to be a basic check if the cache is stale due to items enter/exiting. Better than nothing so I'm leaving it as is. ~Leshana SSradiation.resistance_cache[src] = (length(contents) + 1) return @@ -49,7 +49,7 @@ temp_rad_resistance += material.weight + material.radiation_resistance if(reinf_material) temp_rad_resistance += reinf_material.weight + reinf_material.radiation_resistance - cached_rad_resistance = (density ? (temp_rad_resistance) / config.radiation_material_resistance_divisor : 0) + cached_rad_resistance = (density ? (temp_rad_resistance) / CONFIG_GET(number/radiation_material_resistance_divisor) : 0) return /turf/simulated/mineral/calc_rad_resistance() diff --git a/code/modules/resleeving/computers.dm b/code/modules/resleeving/computers.dm index 71a46a30f2..35b697455c 100644 --- a/code/modules/resleeving/computers.dm +++ b/code/modules/resleeving/computers.dm @@ -338,7 +338,7 @@ return //Disabled in config. - else if(!config.revival_cloning) + else if(!CONFIG_GET(flag/revival_cloning)) set_temp("Error: Unable to initiate growing cycle.", "danger") active_br = null return diff --git a/code/modules/resleeving/machines.dm b/code/modules/resleeving/machines.dm index eb261c9763..f59494250d 100644 --- a/code/modules/resleeving/machines.dm +++ b/code/modules/resleeving/machines.dm @@ -191,7 +191,7 @@ /obj/machinery/clonepod/transhuman/get_completion() if(occupant) - return 100 * ((occupant.health + abs(config.health_threshold_dead)) / (occupant.maxHealth + abs(config.health_threshold_dead))) + return 100 * ((occupant.health + abs(CONFIG_GET(number/health_threshold_dead))) / (occupant.maxHealth + abs(CONFIG_GET(number/health_threshold_dead)))) return 0 /obj/machinery/clonepod/transhuman/examine(mob/user, infix, suffix) diff --git a/code/modules/security levels/keycard authentication.dm b/code/modules/security levels/keycard authentication.dm index 440960e759..307570a01e 100644 --- a/code/modules/security levels/keycard authentication.dm +++ b/code/modules/security levels/keycard authentication.dm @@ -89,7 +89,7 @@ if(screen == 1) dat += "Select an event to trigger: