diff --git a/code/_compile_options.dm b/code/_compile_options.dm index 12cd9086711..cac93fdbaf6 100644 --- a/code/_compile_options.dm +++ b/code/_compile_options.dm @@ -15,7 +15,7 @@ // Version check, terminates compilation if someone is using a version of BYOND that's too old #if DM_VERSION < 510 #error OUTDATED VERSION ERROR - \ -Due to BYOND features used in this codebase, you must update to version 508 or later to compile. \ +Due to BYOND features used in this codebase, you must update to version 510 or later to compile. \ This may require updating to a beta release. #endif diff --git a/code/game/objects/effects/datacore-effect.dm b/code/game/objects/effects/datacore-effect.dm index ce970c31916..a5e687956f8 100644 --- a/code/game/objects/effects/datacore-effect.dm +++ b/code/game/objects/effects/datacore-effect.dm @@ -198,7 +198,7 @@ var/global/ManifestJSON department = 1 if(depthead && ser.len != 1) ser.Swap(1,ser.len) - + if(real_rank in supply_positions) sup[++sup.len] = list("name" = name, "rank" = rank, "active" = isactive) department = 1 @@ -224,6 +224,6 @@ var/global/ManifestJSON "bot" = bot,\ "misc" = misc\ ) - ManifestJSON = list2json(PDA_Manifest) + ManifestJSON = json_encode(PDA_Manifest) return diff --git a/code/modules/atmos_automation/console.dm b/code/modules/atmos_automation/console.dm index 0a8aecb9150..c567a45e108 100644 --- a/code/modules/atmos_automation/console.dm +++ b/code/modules/atmos_automation/console.dm @@ -206,11 +206,11 @@ var/list/json[0] for(var/datum/automation/A in automations) json += list(A.Export()) - return list2json(json) + return json_encode(json) proc/ReadCode(var/jsonStr) automations.Cut() - var/list/json=json2list(jsonStr) + var/list/json = json_decode(jsonStr) if(json.len>0) for(var/list/cData in json) if(isnull(cData) || !("type" in cData)) diff --git a/code/modules/media/jukebox.dm b/code/modules/media/jukebox.dm index 33a44c5f23b..9cea989fde7 100644 --- a/code/modules/media/jukebox.dm +++ b/code/modules/media/jukebox.dm @@ -222,10 +222,7 @@ var/global/loopModeNames=list( stat &= BROKEN update_icon() return - var/json_reader/reader = new() - reader.tokens = reader.ScanJson(json) - reader.i = 1 - var/songdata = reader.read_value() + var/songdata = json_decode(json) for(var/list/record in songdata) playlist += new /datum/song_info(record) if(playlist.len==0) diff --git a/code/modules/nano/JSON Reader.dm b/code/modules/nano/JSON Reader.dm deleted file mode 100644 index 41d218cb43d..00000000000 --- a/code/modules/nano/JSON Reader.dm +++ /dev/null @@ -1,214 +0,0 @@ -json_token - var - value - New(v) - src.value = v - text - number - word - symbol - eof - -json_reader - var - list - string = list("'", "\"") - symbols = list("{", "}", "\[", "]", ":", "\"", "'", ",") - sequences = list("b" = 8, "t" = 9, "n" = 10, "f" = 12, "r" = 13) - tokens - json - i = 1 - - - proc - // scanner - ScanJson(json) - src.json = json - . = new/list() - src.i = 1 - while(src.i <= length(json)) - var/char = get_char() - if(is_whitespace(char)) - i++ - continue - if(string.Find(char)) - . += read_string(char) - else if(symbols.Find(char)) - . += new/json_token/symbol(char) - else if(is_digit(char)) - . += read_number() - else - . += read_word() - i++ - . += new/json_token/eof() - - read_word() - var/val = "" - while(i <= length(json)) - var/char = get_char() - if(is_whitespace(char) || symbols.Find(char)) - i-- // let scanner handle this character - return new/json_token/word(val) - val += char - i++ - - read_string(delim) - var - escape = FALSE - val = "" - while(++i <= length(json)) - var/char = get_char() - if(escape) - escape=FALSE // WHICH STUPID ASSHOLE FORGOT THIS - N3X - switch(char) - if("\\", "'", "\"", "/", "u") - val += char - else - // TODO: support octal, hex, unicode sequences - //testing("Having trouble with \"\\[char]\" in string \"[val]\"") - ASSERT(sequences.Find(char)) - val += ascii2text(sequences[char]) - else - if(char == delim) - return new/json_token/text(val) - else if(char == "\\") - escape = TRUE - else - val += char - CRASH("Unterminated string.") - - read_number() - var/val = "" - var/char = get_char() - while(is_digit(char) || char == "." || lowertext(char) == "e") - val += char - i++ - char = get_char() - i-- // allow scanner to read the first non-number character - return new/json_token/number(text2num(val)) - - check_char() - ASSERT(args.Find(get_char())) - - get_char() - return copytext(json, i, i+1) - - is_whitespace(char) - return char == " " || char == "\t" || char == "\n" || text2ascii(char) == 13 - - is_digit(char) - var/c = text2ascii(char) - return 48 <= c && c <= 57 || char == "+" || char == "-" - - - // parser - ReadArray(list/tokens) - src.tokens = tokens - i = 1 - return read_array() - - - // parser - ReadObject(list/tokens) - src.tokens = tokens - . = new/list() - i = 1 - read_token("{", /json_token/symbol) - while(i <= tokens.len) - var/json_token/K = get_token() - check_type(/json_token/word, /json_token/text) - next_token() - read_token(":", /json_token/symbol) - - .[K.value] = read_value() - - var/json_token/S = get_token() - check_type(/json_token/symbol) - switch(S.value) - if(",") - next_token() - continue - if("}") - next_token() - return - else - die() - - get_token() - return tokens[i] - - next_token() - return tokens[++i] - - read_token(val, type) - var/json_token/T = get_token() - if(!(T.value == val && istype(T, type))) - CRASH("Expected '[val]', found '[T.value]'.") - next_token() - return T - - check_type(...) - var/json_token/T = get_token() - for(var/type in args) - if(istype(T, type)) - return - CRASH("Bad token type: [T.type].") - - check_value(...) - var/json_token/T = get_token() - ASSERT(args.Find(T.value)) - - read_key() - var/char = get_char() - if(char == "\"" || char == "'") - return read_string(char) - - read_value() - var/json_token/T = get_token() - switch(T.type) - if(/json_token/text, /json_token/number) - next_token() - return T.value - if(/json_token/word) - next_token() - switch(T.value) - if("true") - return TRUE - if("false") - return FALSE - if("null") - return null - if(/json_token/symbol) - switch(T.value) - if("\[") - return read_array() - if("{") - return ReadObject(tokens.Copy(i)) - die() - - read_array() - read_token("\[", /json_token/symbol) - . = new/list() - var/list/L = . - while(i <= tokens.len) - // Avoid using Add() or += in case a list is returned. - L.len++ - L[L.len] = read_value() - var/json_token/T = get_token() - check_type(/json_token/symbol) - switch(T.value) - if(",") - next_token() - continue - if("]") - next_token() - return - else - die() - next_token() - CRASH("Unterminated array.") - - - die(json_token/T) - if(!T) T = get_token() - CRASH("Unexpected token: [T.value].") \ No newline at end of file diff --git a/code/modules/nano/JSON Writer.dm b/code/modules/nano/JSON Writer.dm deleted file mode 100644 index 2b70239e7e6..00000000000 --- a/code/modules/nano/JSON Writer.dm +++ /dev/null @@ -1,59 +0,0 @@ - -json_writer - var - use_cache = 0 - - proc - WriteObject(list/L, cached_data = null) - if(use_cache && L["__json_cache"]) - return L["__json_cache"] - - . = "{" - var/i = 1 - for(var/k in L) - var/val = L[k] - . += {"\"[k]\":[write(val)]"} - if(i++ < L.len) - . += "," - . += "}" - - write(val) - if(isnum(val)) - return num2text(val) - else if(isnull(val)) - return "null" - else if(istype(val, /list)) - if(is_associative(val)) - return WriteObject(val) - else - return write_array(val) - else - . += write_string("[val]") - - write_array(list/L) - . = "\[" - for(var/i = 1 to L.len) - . += write(L[i]) - if(i < L.len) - . += "," - . += "]" - - write_string(txt) - var/static/list/json_escape = list("\\" = "\\\\", "\"" = "\\\"", "\n" = "\\n") - for(var/targ in json_escape) - var/start = 1 - while(start <= lentext(txt)) - var/i = findtext(txt, targ, start) - if(!i) - break - var/lrep = length(json_escape[targ]) - txt = copytext(txt, 1, i) + json_escape[targ] + copytext(txt, i + length(targ)) - start = i + lrep - - return {""[txt]""} - - is_associative(list/L) - for(var/key in L) - // if the key is a list that means it's actually an array of lists (stupid Byond...) - if(!isnum(key) && !isnull(L[key]) && !istype(key, /list)) - return TRUE diff --git a/code/modules/nano/_JSON.dm b/code/modules/nano/_JSON.dm deleted file mode 100644 index 95791899817..00000000000 --- a/code/modules/nano/_JSON.dm +++ /dev/null @@ -1,17 +0,0 @@ -/* -n_Json v11.3.21 -*/ - -proc - json2list(json) - var/static/json_reader/_jsonr = new() - return _jsonr.ReadObject(_jsonr.ScanJson(json)) - - list2json(list/L) - var/static/json_writer/_jsonw = new() - return _jsonw.write(L) - - list2json_usecache(list/L) - var/static/json_writer/_jsonw = new() - _jsonw.use_cache = 1 - return _jsonw.write(L) diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index 7675d3b2c81..d1fbdb6a868 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -86,7 +86,7 @@ nanoui is used to open and update nano browser uis add_template("main", ntemplate_filename) if (ntitle) - title = sanitize(ntitle) + title = ntitle if (nwidth) width = nwidth if (nheight) @@ -176,7 +176,6 @@ nanoui is used to open and update nano browser uis */ /datum/nanoui/proc/get_config_data() var/name = "[src_object]" - name = sanitize(name) //jQuery's parseJSON fails with byond formatting characters in the JSON var/list/config_data = list( "title" = title, "srcObject" = list("name" = name), @@ -187,7 +186,7 @@ nanoui is used to open and update nano browser uis "showMap" = show_map, "mapZLevel" = map_z_level, "user" = list( - "name" = sanitize(user.name), + "name" = user.name, "fancy" = user.client.prefs.nanoui_fancy ), "window" = list( @@ -354,12 +353,12 @@ nanoui is used to open and update nano browser uis var/template_data_json = "{}" // An empty JSON object if (templates.len > 0) - template_data_json = list2json(templates) + template_data_json = json_encode(templates) var/list/send_data = get_send_data(initial_data) - var/initial_data_json = replacetext(replacetext(list2json_usecache(send_data), """, "&#34;"), "'", "'") + var/initial_data_json = replacetext(replacetext(json_encode(send_data), """, "&#34;"), "'", "'") - var/url_parameters_json = list2json(list("src" = "\ref[src]")) + var/url_parameters_json = json_encode(list("src" = "\ref[src]")) return {" @@ -458,7 +457,7 @@ nanoui is used to open and update nano browser uis // to_chat(user, list2json_usecache(send_data))// used for debugging //NANO DEBUG HOOK - user << output(list2params(list(list2json_usecache(send_data))),"[window_id].browser:receiveUpdateData") + user << output(list2params(list(json_encode(send_data))),"[window_id].browser:receiveUpdateData") /** * This Topic() proc is called whenever a user clicks on a link within a Nano UI diff --git a/nano/images/uiIcons16Green.png b/nano/images/uiIcons16Green.png new file mode 100644 index 00000000000..de0e33db1c7 Binary files /dev/null and b/nano/images/uiIcons16Green.png differ diff --git a/nano/images/uiIcons16Orange.png b/nano/images/uiIcons16Orange.png new file mode 100644 index 00000000000..9dc8e1a0f45 Binary files /dev/null and b/nano/images/uiIcons16Orange.png differ diff --git a/nano/images/uiIcons16Red.png b/nano/images/uiIcons16Red.png new file mode 100644 index 00000000000..1c72dfe1430 Binary files /dev/null and b/nano/images/uiIcons16Red.png differ diff --git a/paradise.dme b/paradise.dme index 9077d8b86f4..83695fb21da 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1637,9 +1637,6 @@ #include "code\modules\mob\spirit\viewpoint.dm" #include "code\modules\mob\spirit\mask\mask.dm" #include "code\modules\mob\spirit\mask\respawn.dm" -#include "code\modules\nano\_JSON.dm" -#include "code\modules\nano\JSON Reader.dm" -#include "code\modules\nano\JSON Writer.dm" #include "code\modules\nano\nanoexternal.dm" #include "code\modules\nano\nanomanager.dm" #include "code\modules\nano\nanomapgen.dm"