From be67e4cac5ae6fcb9c53cfd25c932023ad49797b Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Tue, 13 Jul 2021 01:02:50 -0400 Subject: [PATCH 01/16] Make tvcamera and entertainment monitor FANCY --- code/game/machinery/computer/camera.dm | 68 +++++++++++++++++--- code/game/objects/items/devices/tvcamera.dm | 55 ++++++++++++++++ code/modules/tgui/modules/camera.dm | 4 ++ code/modules/tgui/states.dm | 24 +++++-- code/modules/tgui/states/physical.dm | 26 ++++++++ icons/obj/entertainment_monitor.dmi | Bin 0 -> 409 bytes 6 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 icons/obj/entertainment_monitor.dmi diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index f04aba5a25..68cc4ee052 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -13,12 +13,13 @@ var/list/network = list() var/datum/tgui_module/camera/camera + var/camera_datum_type = /datum/tgui_module/camera /obj/machinery/computer/security/Initialize() . = ..() if(!LAZYLEN(network)) network = get_default_networks() - camera = new(src, network) + camera = new camera_datum_type(src, network) /obj/machinery/computer/security/proc/get_default_networks() . = using_map.station_networks.Copy() @@ -67,19 +68,39 @@ density = 0 circuit = null +GLOBAL_LIST_EMPTY(entertainment_screens) /obj/machinery/computer/security/telescreen/entertainment name = "entertainment monitor" desc = "Damn, why do they never have anything interesting on these things?" - icon = 'icons/obj/status_display.dmi' - icon_screen = "entertainment" + icon = 'icons/obj/entertainment_monitor.dmi' + icon_state = "screen" + icon_screen = null light_color = "#FFEEDB" light_range_on = 2 network = list(NETWORK_THUNDER) circuit = /obj/item/weapon/circuitboard/security/telescreen/entertainment + camera_datum_type = /datum/tgui_module/camera/bigscreen + var/obj/item/device/radio/radio = null + var/obj/effect/overlay/vis/pinboard + var/weakref/showing /obj/machinery/computer/security/telescreen/entertainment/Initialize() + GLOB.entertainment_screens += src + + var/static/icon/mask = icon('icons/obj/entertainment_monitor.dmi', "mask") + + pinboard = new() + pinboard.icon = icon + pinboard.icon_state = "pinboard" + pinboard.layer = 0.1 + pinboard.vis_flags = VIS_UNDERLAY|VIS_INHERIT_ID|VIS_INHERIT_PLANE + pinboard.appearance_flags = KEEP_TOGETHER + pinboard.add_filter("screen cutter", 1, alpha_mask_filter(icon = mask)) + vis_contents += pinboard + . = ..() + radio = new(src) radio.listening = TRUE radio.broadcasting = FALSE @@ -87,13 +108,44 @@ radio.canhear_range = 7 // Same as default sight range. power_change() +/obj/machinery/computer/security/telescreen/entertainment/Destroy() + if(showing) + stop_showing() + vis_contents.Cut() + qdel_null(pinboard) + qdel_null(radio) + return ..() + +/obj/machinery/computer/security/telescreen/entertainment/Click(location, control, params) + attack_hand(usr) + +/obj/machinery/computer/security/telescreen/entertainment/update_icon() + return ..() // NUH + +/obj/machinery/computer/security/telescreen/entertainment/proc/show_thing(atom/thing) + if(showing) + stop_showing() + if(stat & NOPOWER) + return + showing = weakref(thing) + pinboard.vis_contents = list(thing) + +/obj/machinery/computer/security/telescreen/entertainment/proc/stop_showing() + // Reverse of the above + pinboard.vis_contents = null + showing = null + +/obj/machinery/computer/security/telescreen/entertainment/proc/maybe_stop_showing(weakref/thingref) + if(showing == thingref) + stop_showing() + /obj/machinery/computer/security/telescreen/entertainment/power_change() ..() - if(radio) - if(stat & NOPOWER) - radio.on = FALSE - else - radio.on = TRUE + if(stat & NOPOWER) + radio?.on = FALSE + stop_showing() + else + radio?.on = TRUE /obj/machinery/computer/security/wooden_tv name = "security camera monitor" diff --git a/code/game/objects/items/devices/tvcamera.dm b/code/game/objects/items/devices/tvcamera.dm index acf4b7cc3a..edb97ea960 100644 --- a/code/game/objects/items/devices/tvcamera.dm +++ b/code/game/objects/items/devices/tvcamera.dm @@ -8,6 +8,8 @@ var/channel = "NCS Northern Star News Feed" var/obj/machinery/camera/network/thunder/camera var/obj/item/device/radio/radio + var/weakref/showing + var/showing_name /obj/item/device/tvcamera/New() ..() @@ -45,9 +47,14 @@ /obj/item/device/tvcamera/attack_self(mob/user) add_fingerprint(user) user.set_machine(src) + show_ui(user) + +/obj/item/device/tvcamera/proc/show_ui(mob/user) var/dat = list() dat += "Channel name is: [channel ? channel : "unidentified broadcast"]
" dat += "Video streaming is [camera.status ? "on" : "off"]
" + if(camera.status && showing_name) + dat += "- You're showing [showing_name] to your viewers.
" dat += "Mic is [radio.broadcasting ? "on" : "off"]
" dat += "Sound is being broadcasted on frequency [format_frequency(radio.frequency)] ([get_frequency_name(radio.frequency)])
" var/datum/browser/popup = new(user, "Hovercamera", "Eye Buddy", 300, 390, src) @@ -67,8 +74,12 @@ camera.set_status(!camera.status) if(camera.status) to_chat(usr,"Video streaming activated. Broadcasting on channel '[channel]'") + show_tvs(loc) else to_chat(usr,"Video streaming deactivated.") + hide_tvs() + for(var/obj/machinery/computer/security/telescreen/entertainment/ES as anything in GLOB.entertainment_screens) + ES.stop_showing() update_icon() if(href_list["sound"]) radio.ToggleBroadcast() @@ -79,6 +90,50 @@ if(!href_list["close"]) attack_self(usr) +/obj/item/device/tvcamera/proc/show_tvs(atom/thing) + if(showing) + hide_tvs(showing) + + showing = weakref(thing) + showing_name = "[thing]" + for(var/obj/machinery/computer/security/telescreen/entertainment/ES as anything in GLOB.entertainment_screens) + ES.show_thing(thing) + + START_PROCESSING(SSobj, src) + +/obj/item/device/tvcamera/proc/hide_tvs() + if(!showing) + return + for(var/obj/machinery/computer/security/telescreen/entertainment/ES as anything in GLOB.entertainment_screens) + ES.maybe_stop_showing(showing) + STOP_PROCESSING(SSobj, src) + showing = null + showing_name = null + +/obj/item/device/tvcamera/Moved(atom/old_loc, direction, forced = FALSE, movetime) + . = ..() + if(camera.status && loc != old_loc) + show_tvs(loc) + +/obj/item/device/tvcamera/afterattack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + if(camera.status) + show_tvs(target) + user.visible_message("[user] aims [src] at [target].", "You aim [src] at [target].") + if(user.machine == src) + show_ui(user) // refresh the UI + +/obj/item/device/tvcamera/process() + if(!showing) + return PROCESS_KILL + + var/atom/A = showing.resolve() + if(!A || QDELETED(A)) + show_tvs(loc) + + if(get_dist(get_turf(src), get_turf(A)) > 5) + show_tvs(loc) + /obj/item/device/tvcamera/update_icon() ..() if(camera.status) diff --git a/code/modules/tgui/modules/camera.dm b/code/modules/tgui/modules/camera.dm index 86eb923c1c..abfef14be1 100644 --- a/code/modules/tgui/modules/camera.dm +++ b/code/modules/tgui/modules/camera.dm @@ -296,3 +296,7 @@ /datum/tgui_module/camera/ntos/hacked/New(host) . = ..(host, using_map.station_networks.Copy()) + +/datum/tgui_module/camera/bigscreen/tgui_state(mob/user) + return GLOB.tgui_physical_state_bigscreen + \ No newline at end of file diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm index 01b8ae1a84..5a66efc090 100644 --- a/code/modules/tgui/states.dm +++ b/code/modules/tgui/states.dm @@ -85,7 +85,7 @@ * * Check the distance for a living mob. * Really only used for checks outside the context of a mob. - * Otherwise, use shared_living_ui_distance(). + * Otherwise, use shared_living_tgui_distance(). * * required src_object The object which owns the UI. * required user mob The mob who opened/is using the UI. @@ -119,10 +119,26 @@ return STATUS_DISABLED return STATUS_CLOSE // Otherwise, we got nothing. -/mob/living/carbon/human/shared_living_tgui_distance(atom/movable/src_object, viewcheck = TRUE) - if((TK in mutations) && (get_dist(src, src_object) <= 2)) +/** + * public + * + * Distance versus interaction check, with max'd update range. + * + * required src_object atom/movable The object which owns the UI. + * + * return UI_state The state of the UI. + */ +/mob/living/proc/shared_living_tgui_distance_bigscreen(atom/movable/src_object, viewcheck = TRUE) + // If the object is obscured, close it. + if(viewcheck && !(src_object in view(src))) + return STATUS_CLOSE + + var/dist = get_dist(src_object, src) + if(dist <= 1) // Open and interact if 1-0 tiles away. return STATUS_INTERACTIVE - return ..() + else if(dist <= world.view) + return STATUS_UPDATE + return STATUS_CLOSE // Otherwise, we got nothing. // Topic Extensions for old UIs /datum/proc/CanUseTopic(var/mob/user, var/datum/tgui_state/state) diff --git a/code/modules/tgui/states/physical.dm b/code/modules/tgui/states/physical.dm index 30c67906ae..9712090b5d 100644 --- a/code/modules/tgui/states/physical.dm +++ b/code/modules/tgui/states/physical.dm @@ -47,3 +47,29 @@ GLOBAL_DATUM_INIT(tgui_physical_obscured_state, /datum/tgui_state/physical_obscu /mob/living/silicon/ai/physical_obscured_can_use_topic(src_object) return STATUS_UPDATE // AIs are not physical. + + /** + * tgui state: physical_state_bigscreen + * + * Short-circuits the default state to only check physical distance, + * but allows updates out to the full size of the screen. + **/ + +GLOBAL_DATUM_INIT(tgui_physical_state_bigscreen, /datum/tgui_state/physical_bigscreen, new) + +/datum/tgui_state/physical_bigscreen/can_use_topic(src_object, mob/user) + . = user.shared_tgui_interaction(src_object) + if(. > STATUS_CLOSE) + return min(., user.physical_can_use_tgui_topic_bigscreen(src_object)) + +/mob/proc/physical_can_use_tgui_topic_bigscreen(src_object) + return STATUS_CLOSE + +/mob/living/physical_can_use_tgui_topic_bigscreen(src_object) + return shared_living_tgui_distance_bigscreen(src_object) + +/mob/living/silicon/physical_can_use_tgui_topic_bigscreen(src_object) + return max(STATUS_UPDATE, shared_living_tgui_distance_bigscreen(src_object)) // Silicons can always see. + +/mob/living/silicon/ai/physical_can_use_tgui_topic(src_object) + return STATUS_UPDATE // AIs are not physical. \ No newline at end of file diff --git a/icons/obj/entertainment_monitor.dmi b/icons/obj/entertainment_monitor.dmi new file mode 100644 index 0000000000000000000000000000000000000000..c0832451c3494f92aa4245872d6c3dac1718b1a4 GIT binary patch literal 409 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0J3?w7mbKU|etpJ}8*8>L*1Vu&fKX+mNij_63 zZI(b_@6g@lx@e(8W-8~~r-C6NAwV_%|Nnm+C3Fg?i?JlgFPOpM*^M+Hr=}_-qQoV& zIJqdZpd>RtkAb0LPHn^v*L&iorq%PgZ%k!ynQL%J{Z5TO&>d4fT^vI^I+GIwTo`#I8Ui_4ITADk zj0zo@&UHy}wa8AW)M?{cv(Q63~DsgU>Des9RQ`npCDjoRphQlP$JS=m9X=Xyh z(I0^hOb_;Uv*;xR7KpR Date: Tue, 13 Jul 2021 10:08:38 -0400 Subject: [PATCH 02/16] Don't show turfs on camera --- code/game/objects/items/devices/tvcamera.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/devices/tvcamera.dm b/code/game/objects/items/devices/tvcamera.dm index edb97ea960..b7d7933a88 100644 --- a/code/game/objects/items/devices/tvcamera.dm +++ b/code/game/objects/items/devices/tvcamera.dm @@ -117,7 +117,7 @@ /obj/item/device/tvcamera/afterattack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() - if(camera.status) + if(camera.status && !isturf(target)) show_tvs(target) user.visible_message("[user] aims [src] at [target].", "You aim [src] at [target].") if(user.machine == src) From a88187d9d7dda400de6ca235915043c60986d70e Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Tue, 13 Jul 2021 10:58:54 -0400 Subject: [PATCH 03/16] Add glass overlay --- code/game/machinery/computer/camera.dm | 4 +++- icons/obj/entertainment_monitor.dmi | Bin 409 -> 784 bytes 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 68cc4ee052..5b39bc618f 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -89,6 +89,8 @@ GLOBAL_LIST_EMPTY(entertainment_screens) GLOB.entertainment_screens += src var/static/icon/mask = icon('icons/obj/entertainment_monitor.dmi', "mask") + + add_overlay("glass") pinboard = new() pinboard.icon = icon @@ -120,7 +122,7 @@ GLOBAL_LIST_EMPTY(entertainment_screens) attack_hand(usr) /obj/machinery/computer/security/telescreen/entertainment/update_icon() - return ..() // NUH + return // NUH /obj/machinery/computer/security/telescreen/entertainment/proc/show_thing(atom/thing) if(showing) diff --git a/icons/obj/entertainment_monitor.dmi b/icons/obj/entertainment_monitor.dmi index c0832451c3494f92aa4245872d6c3dac1718b1a4..40250b33e0ee32ef5334642278fb2e85bb722992 100644 GIT binary patch literal 784 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=?NuQWB`&GO$wiq3C7Jno3=9=> zT2JleI%FWy_R#XVmffw`Khc{#yiQ)Ycle^r>;=B6>M!0}i`-dq`}d*Ck1lgofFE=CKU(C>IXK@wNw${Iy`ljJE+ewayfGcYi@c)B=-RLprh(>D8dfJj@s^io|G zuVq!H961@&a+bb*u<)q;f@EuRfdVU4Mn?rL5tgmXPXzy#w_1|Isq5i9`D!<}A;+c} z6M81K*Emd3^x#;mz3aukMRwiZo>dHw5p7c=fWdX%JjcV5pt#hK=5oJ|b-`}-c$Z2ReaF-0fu z?afoG_wU;nSTSinJ9~!C{{!N`Im_OzF0r1qC!lT_*I8ys#?L(Mhb0)^$=M$JeD&&~ z$$w<~r)n>#E9PZ*@wIAdMuptc1|8Sci#t}uJXQMVdEkG~9d-;)96Pb^MTu3^Jhs~V z=l437#C{iGSY*J$;IesUyj$(@!hLGLUvgczx@Xn2*Sp#SC6u_FK{8>V84@C|`EAM< zkzFx)N#Wg6?a$H&GUQfFU=UMkkZtJYNMKJ;X1c+6ql2N0!3-`mnJa)-^OVB+uriN8 mvzt+$u1jDI+}W+-1^k-1XZ|JMQ*#9-aRyIUKbLh*2~7Z5KV1U= delta 395 zcmV;60d)S52AKnp7=Hu<00013M{Ml?001gbOjJd{z`#;kTfffGpQx#Pg@!pfIXOQ- zi;6{}p+IS63GL+(R8&;Jz`+0i|KnN`$^ZZW0d!JMQvg8b*k%9#0DO8>Sad{Xb7OL8 zaCB*JZU6vyoKseCa&`CgQ*iP1GI2oy&Wacc zgdLE1EQSoMp?^pq0H^>}y&*#=3K&%|(iA8l%QImnm=q)AB&qDifDYK4jg5_rjg1v6 zDhid2O%gB^Fr=lWB?A>0&YCq1$i$Qfg54s(^y~;UVK-K3kTq#wfW`PxKmy>siv%uU pQE(Rpj4BxE3J4~cQ9vgE0I>&2VXz>{&j0`b07*qoL Date: Tue, 13 Jul 2021 13:08:00 -0500 Subject: [PATCH 04/16] Synthetic resleeving notifications go to Science instead of Medical --- code/controllers/subsystems/transcore_vr.dm | 15 ++++++++++----- code/modules/mob/dead/observer/observer_vr.dm | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/code/controllers/subsystems/transcore_vr.dm b/code/controllers/subsystems/transcore_vr.dm index ebf47439d6..86ffac6b06 100644 --- a/code/controllers/subsystems/transcore_vr.dm +++ b/code/controllers/subsystems/transcore_vr.dm @@ -114,7 +114,7 @@ SUBSYSTEM_DEF(transcore) else if(curr_MR.dead_state != MR_DEAD) //First time switching to dead if(curr_MR.do_notify) - db.notify(curr_MR.mindname) + db.notify(curr_MR) curr_MR.last_notification = world.time curr_MR.dead_state = MR_DEAD @@ -250,10 +250,15 @@ SUBSYSTEM_DEF(transcore) return 1 -// Send a past-due notification to the medical radio channel. -/datum/transcore_db/proc/notify(var/name) - ASSERT(name) - global_announcer.autosay("[name] is past-due for a mind backup.", "TransCore Oversight", "Medical") +// Send a past-due notification to the proper radio channel. +/datum/transcore_db/proc/notify(var/datum/transhuman/mind_record/MR) + ASSERT(MR) + var/datum/transcore_db/db = SStranscore.db_by_mind_name(MR.mindname) + var/datum/transhuman/body_record/BR = db.body_scans[MR.mindname] + if(!BR) + global_announcer.autosay("[MR.mindname] is past-due for a mind backup, but lacks a corresponding body record." "TransCore Oversight", "Medical") + return + global_announcer.autosay("[MR.mindname] is past-due for a mind backup.", "TransCore Oversight", BR.synthetic ? "Science" : "Medical") // Called from mind_record to add itself to the transcore. /datum/transcore_db/proc/add_backup(var/datum/transhuman/mind_record/MR) diff --git a/code/modules/mob/dead/observer/observer_vr.dm b/code/modules/mob/dead/observer/observer_vr.dm index df68f41851..1fb9d913c9 100644 --- a/code/modules/mob/dead/observer/observer_vr.dm +++ b/code/modules/mob/dead/observer/observer_vr.dm @@ -73,7 +73,7 @@ else if((world.time - record.last_notification) < 5 MINUTES) to_chat(src, "Too little time has passed since your last notification.") else - db.notify(record.mindname) + db.notify(record) record.last_notification = world.time to_chat(src, "New notification has been sent.") else From 4e21145c891164e2692753a961f94e947cc6a723 Mon Sep 17 00:00:00 2001 From: Verkister Date: Tue, 13 Jul 2021 21:30:40 +0300 Subject: [PATCH 05/16] Fixes corpses spamming empty ghosts Fixes movement based ghosting from a dead body spamming ghostize proc without any cooldown, resulting in a crapton of empty ghosts lingering around. --- code/modules/mob/mob_movement.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 5392d53b62..c2f1d635af 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -169,6 +169,7 @@ // If dead and we try to move in our mob, it leaves our body if(my_mob.stat == DEAD && isliving(my_mob) && !my_mob.forbid_seeing_deadchat) + my_mob.setMoveCooldown(my_mob.movement_delay(n, direct)) my_mob.ghostize() return From b58b04041df968e69ad8a046ed0d530f907fb0a7 Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Tue, 13 Jul 2021 15:46:15 -0500 Subject: [PATCH 06/16] remove a lot of unused helpers --- code/_compatibility/509/JSON Reader.dm | 209 ------------------ code/_compatibility/509/JSON Writer.dm | 62 ------ code/_compatibility/509/_JSON.dm | 14 -- code/_compatibility/509/text.dm | 6 - code/_compatibility/509/type2type.dm | 102 --------- code/_helpers/type2type.dm | 103 --------- code/_helpers/unsorted.dm | 130 +---------- code/global.dm | 4 +- .../kitchen/cooking_machines/_appliance.dm | 2 +- .../silicon/robot/dogborg/dog_sleeper_vr.dm | 10 +- code/modules/power/antimatter/engine.dm | 4 +- code/modules/vore/eating/belly_obj_vr.dm | 4 +- vorestation.dme | 5 - 13 files changed, 16 insertions(+), 639 deletions(-) delete mode 100644 code/_compatibility/509/JSON Reader.dm delete mode 100644 code/_compatibility/509/JSON Writer.dm delete mode 100644 code/_compatibility/509/_JSON.dm delete mode 100644 code/_compatibility/509/text.dm delete mode 100644 code/_compatibility/509/type2type.dm diff --git a/code/_compatibility/509/JSON Reader.dm b/code/_compatibility/509/JSON Reader.dm deleted file mode 100644 index 18f739c5ef..0000000000 --- a/code/_compatibility/509/JSON Reader.dm +++ /dev/null @@ -1,209 +0,0 @@ -#if DM_VERSION < 510 - -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) - switch(char) - if("\\", "'", "\"", "/", "u") - val += char - else - // TODO: support octal, hex, unicode sequences - 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 - 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].") - -#endif \ No newline at end of file diff --git a/code/_compatibility/509/JSON Writer.dm b/code/_compatibility/509/JSON Writer.dm deleted file mode 100644 index 80e4976687..0000000000 --- a/code/_compatibility/509/JSON Writer.dm +++ /dev/null @@ -1,62 +0,0 @@ -#if DM_VERSION < 510 - -json_writer - var - use_cache = 0 - - proc - WriteObject(list/L) - 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 <= length(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 - -#endif \ No newline at end of file diff --git a/code/_compatibility/509/_JSON.dm b/code/_compatibility/509/_JSON.dm deleted file mode 100644 index 46f488ac56..0000000000 --- a/code/_compatibility/509/_JSON.dm +++ /dev/null @@ -1,14 +0,0 @@ -#if DM_VERSION < 510 -/* -n_Json v11.3.21 -*/ - -proc - json_decode(json) - var/static/json_reader/_jsonr = new() - return _jsonr.ReadObject(_jsonr.ScanJson(json)) - - json_encode(list/L) - var/static/json_writer/_jsonw = new() - return _jsonw.write(L) -#endif \ No newline at end of file diff --git a/code/_compatibility/509/text.dm b/code/_compatibility/509/text.dm deleted file mode 100644 index c22790ccb8..0000000000 --- a/code/_compatibility/509/text.dm +++ /dev/null @@ -1,6 +0,0 @@ -#if DM_VERSION < 510 - -/proc/replacetext(text, find, replacement) - return jointext(splittext(text, find), replacement) - -#endif \ No newline at end of file diff --git a/code/_compatibility/509/type2type.dm b/code/_compatibility/509/type2type.dm deleted file mode 100644 index 62d7a5e5c7..0000000000 --- a/code/_compatibility/509/type2type.dm +++ /dev/null @@ -1,102 +0,0 @@ -#if DM_VERSION < 510 -// Concatenates a list of strings into a single string. A seperator may optionally be provided. -/proc/jointext(list/ls, sep) - if (ls.len <= 1) // Early-out code for empty or singleton lists. - return ls.len ? ls[1] : "" - - var/l = ls.len // Made local for sanic speed. - var/i = 0 // Incremented every time a list index is accessed. - - if (sep <> null) - // Macros expand to long argument lists like so: sep, ls[++i], sep, ls[++i], sep, ls[++i], etc... - #define S1 sep, ls[++i] - #define S4 S1, S1, S1, S1 - #define S16 S4, S4, S4, S4 - #define S64 S16, S16, S16, S16 - - . = "[ls[++i]]" // Make sure the initial element is converted to text. - - // Having the small concatenations come before the large ones boosted speed by an average of at least 5%. - if (l-1 & 0x01) // 'i' will always be 1 here. - . = text("[][][]", ., S1) // Append 1 element if the remaining elements are not a multiple of 2. - if (l-i & 0x02) - . = text("[][][][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4. - if (l-i & 0x04) - . = text("[][][][][][][][][]", ., S4) // And so on.... - if (l-i & 0x08) - . = text("[][][][][][][][][][][][][][][][][]", ., S4, S4) - if (l-i & 0x10) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16) - if (l-i & 0x20) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16) - if (l-i & 0x40) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) - while (l > i) // Chomp through the rest of the list, 128 elements at a time. - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64) - - #undef S64 - #undef S16 - #undef S4 - #undef S1 - else - // Macros expand to long argument lists like so: ls[++i], ls[++i], ls[++i], etc... - #define S1 ls[++i] - #define S4 S1, S1, S1, S1 - #define S16 S4, S4, S4, S4 - #define S64 S16, S16, S16, S16 - - . = "[ls[++i]]" // Make sure the initial element is converted to text. - - if (l-1 & 0x01) // 'i' will always be 1 here. - . += S1 // Append 1 element if the remaining elements are not a multiple of 2. - if (l-i & 0x02) - . = text("[][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4. - if (l-i & 0x04) - . = text("[][][][][]", ., S4) // And so on... - if (l-i & 0x08) - . = text("[][][][][][][][][]", ., S4, S4) - if (l-i & 0x10) - . = text("[][][][][][][][][][][][][][][][][]", ., S16) - if (l-i & 0x20) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16) - if (l-i & 0x40) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) - while (l > i) // Chomp through the rest of the list, 128 elements at a time. - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64) - - #undef S64 - #undef S16 - #undef S4 - #undef S1 - -// Converts a string into a list by splitting the string at each delimiter found. (discarding the seperator) -/proc/splittext(text, delimiter="\n") - var/delim_len = length(delimiter) - if (delim_len < 1) - return list(text) - - . = list() - var/last_found = 1 - var/found - - do - found = findtext(text, delimiter, last_found, 0) - . += copytext(text, last_found, found) - last_found = found + delim_len - while (found) -#endif \ No newline at end of file diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index cb5834ffb1..efef413013 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -2,11 +2,9 @@ * Holds procs designed to change one type of value, into another. * Contains: * hex2num & num2hex - * text2list & list2text * file2list * angle2dir * angle2text - * worldtime2text */ // Returns an integer given a hexadecimal number string as input. @@ -294,107 +292,6 @@ return strtype return copytext(strtype, delim_pos) -// Concatenates a list of strings into a single string. A seperator may optionally be provided. -/proc/list2text(list/ls, sep) - if (ls.len <= 1) // Early-out code for empty or singleton lists. - return ls.len ? ls[1] : "" - - var/l = ls.len // Made local for sanic speed. - var/i = 0 // Incremented every time a list index is accessed. - - if (sep != null) - // Macros expand to long argument lists like so: sep, ls[++i], sep, ls[++i], sep, ls[++i], etc... - #define S1 sep, ls[++i] - #define S4 S1, S1, S1, S1 - #define S16 S4, S4, S4, S4 - #define S64 S16, S16, S16, S16 - - . = "[ls[++i]]" // Make sure the initial element is converted to text. - - // Having the small concatenations come before the large ones boosted speed by an average of at least 5%. - if (l-1 & 0x01) // 'i' will always be 1 here. - . = text("[][][]", ., S1) // Append 1 element if the remaining elements are not a multiple of 2. - if (l-i & 0x02) - . = text("[][][][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4. - if (l-i & 0x04) - . = text("[][][][][][][][][]", ., S4) // And so on.... - if (l-i & 0x08) - . = text("[][][][][][][][][][][][][][][][][]", ., S4, S4) - if (l-i & 0x10) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16) - if (l-i & 0x20) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16) - if (l-i & 0x40) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) - while (l > i) // Chomp through the rest of the list, 128 elements at a time. - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64) - - #undef S64 - #undef S16 - #undef S4 - #undef S1 - else - // Macros expand to long argument lists like so: ls[++i], ls[++i], ls[++i], etc... - #define S1 ls[++i] - #define S4 S1, S1, S1, S1 - #define S16 S4, S4, S4, S4 - #define S64 S16, S16, S16, S16 - - . = "[ls[++i]]" // Make sure the initial element is converted to text. - - if (l-1 & 0x01) // 'i' will always be 1 here. - . += S1 // Append 1 element if the remaining elements are not a multiple of 2. - if (l-i & 0x02) - . = text("[][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4. - if (l-i & 0x04) - . = text("[][][][][]", ., S4) // And so on... - if (l-i & 0x08) - . = text("[][][][][][][][][]", ., S4, S4) - if (l-i & 0x10) - . = text("[][][][][][][][][][][][][][][][][]", ., S16) - if (l-i & 0x20) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16) - if (l-i & 0x40) - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64) - while (l > i) // Chomp through the rest of the list, 128 elements at a time. - . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\ - [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64) - - #undef S64 - #undef S16 - #undef S4 - #undef S1 - -// Converts a string into a list by splitting the string at each delimiter found. (discarding the seperator) -/proc/text2list(text, delimiter="\n") - var/delim_len = length(delimiter) - if (delim_len < 1) - return list(text) - - . = list() - var/last_found = 1 - var/found - - do - found = findtext(text, delimiter, last_found, 0) - . += copytext(text, last_found, found) - last_found = found + delim_len - while (found) - /proc/type2parent(child) var/string_type = "[child]" var/last_slash = findlasttext(string_type, "/") diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index ec9633e20c..10ac37ca0e 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -196,9 +196,6 @@ Turf and target are seperate in case you want to teleport some distance from a t return 1 return 0 -/proc/sign(x) - return x!=0?x/abs(x):0 - /proc/getline(atom/M,atom/N)//Ultra-Fast Bresenham Line-Drawing Algorithm var/px=M.x //starting x var/py=M.y @@ -207,8 +204,8 @@ Turf and target are seperate in case you want to teleport some distance from a t var/dy=N.y-py var/dxabs=abs(dx)//Absolute value of x distance var/dyabs=abs(dy) - var/sdx=sign(dx) //Sign of x distance (+ or -) - var/sdy=sign(dy) + var/sdx=SIGN(dx) //Sign of x distance (+ or -) + var/sdy=SIGN(dy) var/x=dxabs>>1 //Counters for steps taken, setting to distance/2 var/y=dyabs>>1 //Bit-shifting makes me l33t. It also makes getline() unnessecarrily fast. var/j //Generic integer for counting @@ -426,34 +423,6 @@ Turf and target are seperate in case you want to teleport some distance from a t else . = pick(ais) return . -/proc/get_sorted_mobs() - var/list/old_list = getmobs() - var/list/AI_list = list() - var/list/Dead_list = list() - var/list/keyclient_list = list() - var/list/key_list = list() - var/list/logged_list = list() - for(var/named in old_list) - var/mob/M = old_list[named] - if(issilicon(M)) - AI_list |= M - else if(isobserver(M) || M.stat == 2) - Dead_list |= M - else if(M.key && M.client) - keyclient_list |= M - else if(M.key) - key_list |= M - else - logged_list |= M - old_list.Remove(named) - var/list/new_list = list() - new_list += AI_list - new_list += keyclient_list - new_list += key_list - new_list += logged_list - new_list += Dead_list - return new_list - //Returns a list of all mobs with their name /proc/getmobs() return observe_list_format(sortmobs()) @@ -528,14 +497,6 @@ Turf and target are seperate in case you want to teleport some distance from a t return "[round((powerused * 0.000001),0.001)] MW" return "[round((powerused * 0.000000001),0.0001)] GW" -/proc/get_mob_by_ckey(key) - if(!key) - return - var/list/mobs = sortmobs() - for(var/mob/M in mobs) - if(M.ckey == key) - return M - //Forces a variable to be posative /proc/modulus(var/M) if(M >= 0) @@ -648,34 +609,6 @@ Turf and target are seperate in case you want to teleport some distance from a t cant_pass = 1 return cant_pass -/proc/get_step_towards2(var/atom/ref , var/atom/trg) - var/base_dir = get_dir(ref, get_step_towards(ref,trg)) - var/turf/temp = get_step_towards(ref,trg) - - if(is_blocked_turf(temp)) - var/dir_alt1 = turn(base_dir, 90) - var/dir_alt2 = turn(base_dir, -90) - var/turf/turf_last1 = temp - var/turf/turf_last2 = temp - var/free_tile = null - var/breakpoint = 0 - - while(!free_tile && breakpoint < 10) - if(!is_blocked_turf(turf_last1)) - free_tile = turf_last1 - break - if(!is_blocked_turf(turf_last2)) - free_tile = turf_last2 - break - turf_last1 = get_step(turf_last1,dir_alt1) - turf_last2 = get_step(turf_last2,dir_alt2) - breakpoint++ - - if(!free_tile) return get_step(ref, base_dir) - else return get_step_towards(ref,free_tile) - - else return get_step(ref, base_dir) - //Takes: Anything that could possibly have variables and a varname to check. //Returns: 1 if found, 0 if not. /proc/hasvar(var/datum/A, var/varname) @@ -693,20 +626,6 @@ Turf and target are seperate in case you want to teleport some distance from a t /proc/return_sorted_areas() return sortTim(return_areas(), /proc/cmp_text_asc) -//Takes: Area type as text string or as typepath OR an instance of the area. -//Returns: A list of all areas of that type in the world. -/proc/get_areas(var/areatype) - if(!areatype) return null - if(istext(areatype)) areatype = text2path(areatype) - if(isarea(areatype)) - var/area/areatemp = areatype - areatype = areatemp.type - - var/list/areas = new/list() - for(var/area/N in world) - if(istype(N, areatype)) areas += N - return areas - //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all turfs in areas of that type of that type in the world. /proc/get_area_turfs(var/areatype) @@ -1021,10 +940,6 @@ Turf and target are seperate in case you want to teleport some distance from a t var/dy = abs(B.y - A.y) return get_dir(A, B) & (rand() * (dx+dy) < dy ? 3 : 12) -//chances are 1:value. anyprob(1) will always return true -/proc/anyprob(value) - return (rand(1,value)==value) - /proc/view_or_range(distance = world.view , center = usr , type) switch(type) if("view") @@ -1033,14 +948,6 @@ Turf and target are seperate in case you want to teleport some distance from a t . = range(distance,center) return -/proc/oview_or_orange(distance = world.view , center = usr , type) - switch(type) - if("view") - . = oview(distance,center) - if("range") - . = orange(distance,center) - return - /proc/get_mob_with_client_list() var/list/mobs = list() for(var/mob/M in mob_list) @@ -1162,16 +1069,6 @@ var/global/list/common_tools = list( istype(W, /obj/item/weapon/shovel) \ ) -/proc/is_surgery_tool(obj/item/W as obj) - return ( \ - istype(W, /obj/item/weapon/surgical/scalpel) || \ - istype(W, /obj/item/weapon/surgical/hemostat) || \ - istype(W, /obj/item/weapon/surgical/retractor) || \ - istype(W, /obj/item/weapon/surgical/cautery) || \ - istype(W, /obj/item/weapon/surgical/bonegel) || \ - istype(W, /obj/item/weapon/surgical/bonesetter) - ) - // check if mob is lying down on something we can operate him on. // The RNG with table/rollerbeds comes into play in do_surgery() so that fail_step() can be used instead. /proc/can_operate(mob/living/carbon/M, mob/living/user) @@ -1191,29 +1088,13 @@ var/global/list/common_tools = list( var/obj/surface = null for(var/obj/O in loc) // Looks for the best surface. if(O.surgery_odds) - if(!surface || surface.surgery_odds < O) + if(!surface || surface.surgery_odds < O.surgery_odds) surface = O if(surface) return surface /proc/reverse_direction(var/dir) - switch(dir) - if(NORTH) - return SOUTH - if(NORTHEAST) - return SOUTHWEST - if(EAST) - return WEST - if(SOUTHEAST) - return NORTHWEST - if(SOUTH) - return NORTH - if(SOUTHWEST) - return NORTHEAST - if(WEST) - return EAST - if(NORTHWEST) - return SOUTHEAST + return global.reverse_dir[dir] /* Checks if that loc and dir has a item on the wall @@ -1485,9 +1366,6 @@ var/mob/dview/dview_mob = new if(337.5) return "North-Northwest" -/proc/pass() - return - /proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types()) if (value == FALSE) //nothing should be calling us with a number, so this is safe value = input(usr, "Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text diff --git a/code/global.dm b/code/global.dm index 1fde7aca07..674c81f8ee 100644 --- a/code/global.dm +++ b/code/global.dm @@ -1,6 +1,6 @@ //#define TESTING -#if DM_VERSION < 506 -#warn This compiler is out of date. You may experience issues with projectile animations. +#if DM_VERSION < 512 +#error This compiler is out of date Please update to at least BYOND 512. #endif // Items that ask to be called every cycle. diff --git a/code/modules/food/kitchen/cooking_machines/_appliance.dm b/code/modules/food/kitchen/cooking_machines/_appliance.dm index 1b090068f6..9a838efeb8 100644 --- a/code/modules/food/kitchen/cooking_machines/_appliance.dm +++ b/code/modules/food/kitchen/cooking_machines/_appliance.dm @@ -506,7 +506,7 @@ if (!S) continue - words |= text2list(S.name," ") + words |= splittext(S.name," ") cooktypes |= S.cooked if (S.reagents && S.reagents.total_volume > 0) diff --git a/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm b/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm index be6421600a..59089b3982 100644 --- a/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm +++ b/code/modules/mob/living/silicon/robot/dogborg/dog_sleeper_vr.dm @@ -228,21 +228,21 @@ if(!delivery && compactor && length(contents))//garbage counter for trashpup dat += "Current load: [length(contents)] / [max_item_count] objects.
" - dat += "([list2text(contents,", ")])

" + dat += "([contents.Join(", ")])

" if(delivery && length(contents)) dat += "Current load: [length(contents)] / [max_item_count] objects.
" dat += "Cargo compartment slot: Cargo 1.
" if(length(deliveryslot_1)) - dat += "([list2text(deliveryslot_1,", ")])
" + dat += "([deliveryslot_1.Join(", ")])
" dat += "Cargo compartment slot: Cargo 2.
" if(length(deliveryslot_2)) - dat += "([list2text(deliveryslot_2,", ")])
" + dat += "([deliveryslot_2.Join(", ")])
" dat += "Cargo compartment slot: Cargo 3.
" if(length(deliveryslot_3)) - dat += "([list2text(deliveryslot_3,", ")])
" + dat += "([deliveryslot_3.Join(", ")])
" dat += "Cargo compartment slot: Fuel.
" - dat += "([list2text(contents - (deliveryslot_1 + deliveryslot_2 + deliveryslot_3),", ")])

" + dat += "([jointext(contents - (deliveryslot_1 + deliveryslot_2 + deliveryslot_3),", ")])

" if(analyzer && !synced) dat += "Sync Files
" diff --git a/code/modules/power/antimatter/engine.dm b/code/modules/power/antimatter/engine.dm index aa1c2245d6..13f230bbb6 100644 --- a/code/modules/power/antimatter/engine.dm +++ b/code/modules/power/antimatter/engine.dm @@ -98,7 +98,7 @@ H_fuel = 0 antiH_fuel = 0 else - var/residual_matter = modulus(H_fuel - antiH_fuel) + var/residual_matter = abs(H_fuel - antiH_fuel) var/mass = antiH_fuel + H_fuel - residual_matter energy = convert2energy(mass) if( H_fuel > antiH_fuel ) @@ -149,7 +149,7 @@ else //else if they're not equal determine which isn't equal //and set it equal to either H or antiH so we don't lose anything - var/residual_matter = modulus(H_fuel - antiH_fuel) + var/residual_matter = abs(H_fuel - antiH_fuel) mass = antiH_fuel + H_fuel - residual_matter energy = convert2energy(mass) diff --git a/code/modules/vore/eating/belly_obj_vr.dm b/code/modules/vore/eating/belly_obj_vr.dm index bacd5c296c..940f5731d9 100644 --- a/code/modules/vore/eating/belly_obj_vr.dm +++ b/code/modules/vore/eating/belly_obj_vr.dm @@ -447,7 +447,7 @@ var/messages = null if(raw_messages) - messages = list2text(raw_messages, delim) + messages = raw_messages.Join(delim) return messages // The next function sets the messages on the belly, from human-readable var @@ -456,7 +456,7 @@ /obj/belly/proc/set_messages(raw_text, type, delim = "\n\n") ASSERT(type == "smo" || type == "smi" || type == "dmo" || type == "dmp" || type == "em" || type == "ema" || type == "im_digest" || type == "im_hold" || type == "im_absorb" || type == "im_heal" || type == "im_drain") - var/list/raw_list = text2list(html_encode(raw_text),delim) + var/list/raw_list = splittext(html_encode(raw_text),delim) if(raw_list.len > 10) raw_list.Cut(11) log_debug("[owner] tried to set [lowertext(name)] with 11+ messages") diff --git a/vorestation.dme b/vorestation.dme index eaedfce719..825e308b84 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -106,11 +106,6 @@ #include "code\__defines\dcs\flags.dm" #include "code\__defines\dcs\helpers.dm" #include "code\__defines\dcs\signals.dm" -#include "code\_compatibility\509\_JSON.dm" -#include "code\_compatibility\509\JSON Reader.dm" -#include "code\_compatibility\509\JSON Writer.dm" -#include "code\_compatibility\509\text.dm" -#include "code\_compatibility\509\type2type.dm" #include "code\_global_vars\bitfields.dm" #include "code\_global_vars\misc.dm" #include "code\_global_vars\mobs.dm" From d0d8e42edc5854ee89c2c2190a2d756e32a84912 Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Tue, 13 Jul 2021 15:46:52 -0500 Subject: [PATCH 07/16] unify crash_with and stack_trace --- code/_helpers/unsorted.dm | 6 +----- code/controllers/globals.dm | 2 +- code/controllers/subsystems/processing/processing.dm | 4 ++-- code/controllers/subsystems/timer.dm | 10 +++++----- code/datums/managed_browsers/_managed_browser.dm | 4 ++-- code/datums/mixed.dm | 2 +- code/datums/repositories/decls.dm | 2 +- code/game/atoms.dm | 4 ++-- .../machinery/embedded_controller/docking_program.dm | 2 +- code/game/objects/effects/map_effects/portal.dm | 2 +- code/game/turfs/turf.dm | 2 +- code/modules/holomap/generate_holomap.dm | 8 ++++---- code/modules/mob/living/carbon/human/update_icons.dm | 4 ++-- code/modules/mob/mob_planes.dm | 8 ++++---- code/modules/projectiles/projectile.dm | 4 ++-- code/modules/reagents/holder/holder.dm | 2 +- .../reagents/machinery/dispenser/dispenser2_energy.dm | 2 +- code/modules/shieldgen/energy_shield.dm | 2 +- code/modules/vore/persist/persist_vr.dm | 6 +++--- code/unit_tests/unit_test.dm | 2 +- maps/~map_system/maps.dm | 2 +- 21 files changed, 38 insertions(+), 42 deletions(-) diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 10ac37ca0e..c7521bcecd 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1211,16 +1211,12 @@ var/mob/dview/dview_mob = new living_mob_list -= src /mob/dview/Destroy(var/force) - crash_with("Attempt to delete the dview_mob: [log_info_line(src)]") + stack_trace("Attempt to delete the dview_mob: [log_info_line(src)]") if (!force) return QDEL_HINT_LETMELIVE global.dview_mob = new return ..() -// call to generate a stack trace and print to runtime logs -/proc/crash_with(msg) - CRASH(msg) - /proc/screen_loc2turf(scr_loc, turf/origin) var/tX = splittext(scr_loc, ",") var/tY = splittext(tX[2], ":") diff --git a/code/controllers/globals.dm b/code/controllers/globals.dm index c92d42d82a..6b7c0b4137 100644 --- a/code/controllers/globals.dm +++ b/code/controllers/globals.dm @@ -20,7 +20,7 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) Initialize(exclude_these) /datum/controller/global_vars/Destroy(force) - crash_with("There was an attempt to qdel the global vars holder!") + stack_trace("There was an attempt to qdel the global vars holder!") if(!force) return QDEL_HINT_LETMELIVE diff --git a/code/controllers/subsystems/processing/processing.dm b/code/controllers/subsystems/processing/processing.dm index a16902c0c5..16b4da021b 100644 --- a/code/controllers/subsystems/processing/processing.dm +++ b/code/controllers/subsystems/processing/processing.dm @@ -112,9 +112,9 @@ SUBSYSTEM_DEF(processing) var/tick_time = world.time - start_tick var/tick_use_limit = world.tick_usage - start_tick_usage - 100 // Current tick use - starting tick use - 100% (a full tick excess) if(tick_time > 0) - crash_with("[log_info_line(subsystem.debug_last_thing)] slept during processing. Spent [tick_time] tick\s.") + stack_trace("[log_info_line(subsystem.debug_last_thing)] slept during processing. Spent [tick_time] tick\s.") if(tick_use_limit > 0) - crash_with("[log_info_line(subsystem.debug_last_thing)] took longer than a tick to process. Exceeded with [tick_use_limit]%") + stack_trace("[log_info_line(subsystem.debug_last_thing)] took longer than a tick to process. Exceeded with [tick_use_limit]%") /datum/proc/process() set waitfor = 0 diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index 9c41a0a4ba..dadcd9ab95 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -159,7 +159,7 @@ SUBSYSTEM_DEF(timer) if (timer.timeToRun < head_offset) bucket_resolution = null //force bucket recreation - crash_with("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") + stack_trace("[i] Invalid timer state: Timer in long run queue with a time to run less then head_offset. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") if (timer.callBack && !timer.spent) timer.callBack.InvokeAsync() spent += timer @@ -170,7 +170,7 @@ SUBSYSTEM_DEF(timer) if (timer.timeToRun < head_offset + TICKS2DS(practical_offset-1)) bucket_resolution = null //force bucket recreation - crash_with("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") + stack_trace("[i] Invalid timer state: Timer in long run queue that would require a backtrack to transfer to short run queue. [get_timer_debug_string(timer)] world.time: [world.time], head_offset: [head_offset], practical_offset: [practical_offset]") if (timer.callBack && !timer.spent) timer.callBack.InvokeAsync() spent += timer @@ -458,10 +458,10 @@ SUBSYSTEM_DEF(timer) CRASH("addtimer called without a callback") if (wait < 0) - crash_with("addtimer called with a negative wait. Converting to [world.tick_lag]") + stack_trace("addtimer called with a negative wait. Converting to [world.tick_lag]") if (callback.object != GLOBAL_PROC && QDELETED(callback.object) && !QDESTROYING(callback.object)) - crash_with("addtimer called with a callback assigned to a qdeleted object. In the future such timers will not be supported and may refuse to run or run with a 0 wait") + stack_trace("addtimer called with a callback assigned to a qdeleted object. In the future such timers will not be supported and may refuse to run or run with a 0 wait") wait = max(CEILING(wait, world.tick_lag), world.tick_lag) @@ -492,7 +492,7 @@ SUBSYSTEM_DEF(timer) . = hash_timer.id return else if(flags & TIMER_OVERRIDE) - crash_with("TIMER_OVERRIDE used without TIMER_UNIQUE") + stack_trace("TIMER_OVERRIDE used without TIMER_UNIQUE") var/datum/timedevent/timer = new(callback, wait, flags, hash) return timer.id diff --git a/code/datums/managed_browsers/_managed_browser.dm b/code/datums/managed_browsers/_managed_browser.dm index c915c7e86a..6c702ddbdd 100644 --- a/code/datums/managed_browsers/_managed_browser.dm +++ b/code/datums/managed_browsers/_managed_browser.dm @@ -16,10 +16,10 @@ GLOBAL_VAR(managed_browser_id_ticker) /datum/managed_browser/New(client/new_client) if(!new_client) - crash_with("Managed browser object was not given a client.") + stack_trace("Managed browser object was not given a client.") return if(!base_browser_id) - crash_with("Managed browser object does not have a base browser id defined in its type.") + stack_trace("Managed browser object does not have a base browser id defined in its type.") return my_client = new_client diff --git a/code/datums/mixed.dm b/code/datums/mixed.dm index 191868e489..0b429156da 100644 --- a/code/datums/mixed.dm +++ b/code/datums/mixed.dm @@ -28,7 +28,7 @@ /datum/data/record/Destroy(var/force) if(data_core.locked.Find(src)) if(!force) - crash_with("Someone tried to qdel a record that was in data_core.locked [log_info_line(src)]") + stack_trace("Someone tried to qdel a record that was in data_core.locked [log_info_line(src)]") return QDEL_HINT_LETMELIVE data_core.locked -= src data_core.medical -= src diff --git a/code/datums/repositories/decls.dm b/code/datums/repositories/decls.dm index e6040a90dd..fead498c63 100644 --- a/code/datums/repositories/decls.dm +++ b/code/datums/repositories/decls.dm @@ -67,5 +67,5 @@ var/repository/decls/decls_repository // Initialiozed in /datum/global_init/New( /decl/Destroy() SHOULD_CALL_PARENT(FALSE) - crash_with("Prevented attempt to delete a decl instance: [log_info_line(src)]") + stack_trace("Prevented attempt to delete a decl instance: [log_info_line(src)]") return QDEL_HINT_LETMELIVE // Prevents decl destruction diff --git a/code/game/atoms.dm b/code/game/atoms.dm index f0851201d9..acf31b5079 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -83,9 +83,9 @@ // Must return an Initialize hint. Defined in code/__defines/subsystems.dm /atom/proc/Initialize(mapload, ...) if(QDELETED(src)) - crash_with("GC: -- [type] had initialize() called after qdel() --") + stack_trace("GC: -- [type] had initialize() called after qdel() --") if(initialized) - crash_with("Warning: [src]([type]) initialized multiple times!") + stack_trace("Warning: [src]([type]) initialized multiple times!") initialized = TRUE return INITIALIZE_HINT_NORMAL diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm index 7adc3ba9d3..1dca766535 100644 --- a/code/game/machinery/embedded_controller/docking_program.dm +++ b/code/game/machinery/embedded_controller/docking_program.dm @@ -77,7 +77,7 @@ ..() if(id_tag) if(SSshuttles.docking_registry[id_tag]) - crash_with("Docking controller tag [id_tag] had multiple associated programs.") + stack_trace("Docking controller tag [id_tag] had multiple associated programs.") SSshuttles.docking_registry[id_tag] = src /datum/embedded_program/docking/Destroy() diff --git a/code/game/objects/effects/map_effects/portal.dm b/code/game/objects/effects/map_effects/portal.dm index 9f40c87f1b..375bbcd336 100644 --- a/code/game/objects/effects/map_effects/portal.dm +++ b/code/game/objects/effects/map_effects/portal.dm @@ -201,7 +201,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec break if(!counterpart) - crash_with("Portal master [type] ([x],[y],[z]) could not find another portal master with a matching portal_id ([portal_id]).") + stack_trace("Portal master [type] ([x],[y],[z]) could not find another portal master with a matching portal_id ([portal_id]).") /obj/effect/map_effect/portal/master/proc/make_visuals() var/list/observed_turfs = list() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index bd7df8d280..3a3325daa1 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -171,7 +171,7 @@ if(istype(mover)) // turf/Enter(...) will perform more advanced checks return !density - crash_with("Non movable passed to turf CanPass : [mover]") + stack_trace("Non movable passed to turf CanPass : [mover]") return FALSE //There's a lot of QDELETED() calls here if someone can figure out how to optimize this but not runtime when something gets deleted by a Bump/CanPass/Cross call, lemme know or go ahead and fix this mess - kevinz000 diff --git a/code/modules/holomap/generate_holomap.dm b/code/modules/holomap/generate_holomap.dm index d24f1f47f3..99396bd542 100644 --- a/code/modules/holomap/generate_holomap.dm +++ b/code/modules/holomap/generate_holomap.dm @@ -56,9 +56,9 @@ // Sanity checks - Better to generate a helpful error message now than have DrawBox() runtime var/icon/canvas = icon(HOLOMAP_ICON, "blank") if(world.maxx > canvas.Width()) - crash_with("Minimap for z=[zLevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]") + stack_trace("Minimap for z=[zLevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]") if(world.maxy > canvas.Height()) - crash_with("Minimap for z=[zLevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]") + stack_trace("Minimap for z=[zLevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]") for(var/x = 1 to world.maxx) for(var/y = 1 to world.maxy) @@ -82,9 +82,9 @@ // Sanity checks - Better to generate a helpful error message now than have DrawBox() runtime var/icon/canvas = icon(HOLOMAP_ICON, "blank") if(world.maxx > canvas.Width()) - crash_with("Minimap for z=[zLevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]") + stack_trace("Minimap for z=[zLevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]") if(world.maxy > canvas.Height()) - crash_with("Minimap for z=[zLevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]") + stack_trace("Minimap for z=[zLevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]") for(var/x = 1 to world.maxx) for(var/y = 1 to world.maxy) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 8ee2eaef44..087a9821cb 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -107,7 +107,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() if(QDESTROYING(src)) return - crash_with("CANARY: Old human update_icons was called.") + stack_trace("CANARY: Old human update_icons was called.") update_hud() //TODO: remove the need for this @@ -839,7 +839,7 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() apply_layer(SUIT_LAYER) /mob/living/carbon/human/update_inv_pockets() - crash_with("Someone called update_inv_pockets even though it's dumb") + stack_trace("Someone called update_inv_pockets even though it's dumb") /mob/living/carbon/human/update_inv_wear_mask() if(QDESTROYING(src)) diff --git a/code/modules/mob/mob_planes.dm b/code/modules/mob/mob_planes.dm index 7b1fbd6f7e..6d97835cc2 100644 --- a/code/modules/mob/mob_planes.dm +++ b/code/modules/mob/mob_planes.dm @@ -63,7 +63,7 @@ ASSERT(which) var/obj/screen/plane_master/PM = plane_masters[which] if(!PM) - crash_with("Tried to alter [which] in plane_holder on [my_mob]!") + stack_trace("Tried to alter [which] in plane_holder on [my_mob]!") if(my_mob.alpha <= EFFECTIVE_INVIS) state = FALSE @@ -83,7 +83,7 @@ ASSERT(which) var/obj/screen/plane_master/PM = plane_masters[which] if(!PM) - crash_with("Tried to alter [which] in plane_holder on [my_mob]!") + stack_trace("Tried to alter [which] in plane_holder on [my_mob]!") PM.set_desired_alpha(new_alpha) if(PM.sub_planes) var/list/subplanes = PM.sub_planes @@ -94,7 +94,7 @@ ASSERT(which) var/obj/screen/plane_master/PM = plane_masters[which] if(!PM) - crash_with("Tried to set_ao [which] in plane_holder on [my_mob]!") + stack_trace("Tried to set_ao [which] in plane_holder on [my_mob]!") PM.set_ambient_occlusion(enabled) if(PM.sub_planes) var/list/subplanes = PM.sub_planes @@ -105,7 +105,7 @@ ASSERT(which) var/obj/screen/plane_master/PM = plane_masters[which] if(!PM) - crash_with("Tried to alter [which] in plane_holder on [my_mob]!") + stack_trace("Tried to alter [which] in plane_holder on [my_mob]!") PM.alter_plane_values(arglist(values)) if(PM.sub_planes) var/list/subplanes = PM.sub_planes diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index c7fcc6d30e..82753f3f0a 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -323,7 +323,7 @@ var/turf/starting = get_turf(src) if(isnull(Angle)) //Try to resolve through offsets if there's no angle set. if(isnull(xo) || isnull(yo)) - crash_with("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!") + stack_trace("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!") qdel(src) return var/turf/target = locate(CLAMP(starting + xo, 1, world.maxx), CLAMP(starting + yo, 1, world.maxy), starting.z) @@ -400,7 +400,7 @@ xo = targloc.x - curloc.x setAngle(Get_Angle(src, targloc) + spread) else - crash_with("WARNING: Projectile [type] fired without either mouse parameters, or a target atom to aim at!") + stack_trace("WARNING: Projectile [type] fired without either mouse parameters, or a target atom to aim at!") qdel(src) /proc/calculate_projectile_angle_and_pixel_offsets(mob/user, params) diff --git a/code/modules/reagents/holder/holder.dm b/code/modules/reagents/holder/holder.dm index 40766754b6..cfad19554e 100644 --- a/code/modules/reagents/holder/holder.dm +++ b/code/modules/reagents/holder/holder.dm @@ -141,7 +141,7 @@ my_atom.on_reagent_change() return 1 else - crash_with("[my_atom] attempted to add a reagent called '[id]' which doesn't exist. ([usr])") + stack_trace("[my_atom] attempted to add a reagent called '[id]' which doesn't exist. ([usr])") return 0 /datum/reagents/proc/isolate_reagent(reagent) diff --git a/code/modules/reagents/machinery/dispenser/dispenser2_energy.dm b/code/modules/reagents/machinery/dispenser/dispenser2_energy.dm index b0dec9f65b..9c776d3266 100644 --- a/code/modules/reagents/machinery/dispenser/dispenser2_energy.dm +++ b/code/modules/reagents/machinery/dispenser/dispenser2_energy.dm @@ -15,7 +15,7 @@ for(var/id in dispense_reagents) var/datum/reagent/R = SSchemistry.chemical_reagents[id] if(!R) - crash_with("[src] at [x],[y],[z] failed to find reagent '[id]'!") + stack_trace("[src] at [x],[y],[z] failed to find reagent '[id]'!") dispense_reagents -= id continue var/obj/item/weapon/reagent_containers/chem_disp_cartridge/C = cartridges[R.name] diff --git a/code/modules/shieldgen/energy_shield.dm b/code/modules/shieldgen/energy_shield.dm index 6c11eb62e2..c13c43496a 100644 --- a/code/modules/shieldgen/energy_shield.dm +++ b/code/modules/shieldgen/energy_shield.dm @@ -165,7 +165,7 @@ return if(!damtype) - crash_with("CANARY: shield.take_damage() callled without damtype.") + stack_trace("CANARY: shield.take_damage() callled without damtype.") if(!damage) return diff --git a/code/modules/vore/persist/persist_vr.dm b/code/modules/vore/persist/persist_vr.dm index 3bae4a8524..d5833e4b3b 100644 --- a/code/modules/vore/persist/persist_vr.dm +++ b/code/modules/vore/persist/persist_vr.dm @@ -40,7 +40,7 @@ */ /proc/prep_for_persist(var/mob/persister) if(!istype(persister)) - crash_with("Persist (P4P): Given non-mob [persister].") + stack_trace("Persist (P4P): Given non-mob [persister].") return // Find out of this mob is a proper mob! @@ -74,7 +74,7 @@ /proc/persist_interround_data(var/mob/occupant, var/datum/spawnpoint/new_spawn_point_type) if(!istype(occupant)) - crash_with("Persist (PID): Given non-mob [occupant].") + stack_trace("Persist (PID): Given non-mob [occupant].") return var/datum/preferences/prefs = prep_for_persist(occupant) @@ -225,7 +225,7 @@ */ /proc/persist_nif_data(var/mob/living/carbon/human/H,var/datum/preferences/prefs) if(!istype(H)) - crash_with("Persist (NIF): Given a nonhuman: [H]") + stack_trace("Persist (NIF): Given a nonhuman: [H]") return if(!prefs) diff --git a/code/unit_tests/unit_test.dm b/code/unit_tests/unit_test.dm index e775f6f763..7d7dee1617 100644 --- a/code/unit_tests/unit_test.dm +++ b/code/unit_tests/unit_test.dm @@ -30,7 +30,7 @@ var/total_unit_tests = 0 log_unit_test("Initializing Unit Testing") if(!ticker) - crash_with("No Ticker") + stack_trace("No Ticker") world.Del() var/said_msg = 0 diff --git a/maps/~map_system/maps.dm b/maps/~map_system/maps.dm index ace7243c1f..0fbbca083b 100644 --- a/maps/~map_system/maps.dm +++ b/maps/~map_system/maps.dm @@ -335,7 +335,7 @@ var/list/all_maps = list() custom_skybox = new custom_skybox() /datum/map_z_level/Destroy(var/force) - crash_with("Attempt to delete a map_z_level instance [log_info_line(src)]") + stack_trace("Attempt to delete a map_z_level instance [log_info_line(src)]") if(!force) return QDEL_HINT_LETMELIVE // No. if (using_map.zlevels["[z]"] == src) From bbd4a6cbd9c286f5c660a0b67091221d471cf1f7 Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Tue, 13 Jul 2021 20:46:39 -0500 Subject: [PATCH 08/16] Removes angle2text --- code/_helpers/type2type.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/_helpers/type2type.dm b/code/_helpers/type2type.dm index efef413013..700bbbfc57 100644 --- a/code/_helpers/type2type.dm +++ b/code/_helpers/type2type.dm @@ -4,7 +4,6 @@ * hex2num & num2hex * file2list * angle2dir - * angle2text */ // Returns an integer given a hexadecimal number string as input. @@ -131,10 +130,6 @@ if (NORTHWEST) return 315 if (SOUTHWEST) return 225 -// Returns the angle in english -/proc/angle2text(var/degree) - return dir2text(angle2dir(degree)) - // Converts a blend_mode constant to one acceptable to icon.Blend() /proc/blendMode2iconMode(blend_mode) switch (blend_mode) From 8851eb9732a79a4aacfd004cc07e109ed125fd8b Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Tue, 13 Jul 2021 21:13:37 -0500 Subject: [PATCH 09/16] Fixes #11027 --- code/game/machinery/cryopod.dm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 51d97df592..8d5dd425e3 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -491,6 +491,19 @@ for(var/datum/data/record/G in data_core.general) if((G.fields["name"] == to_despawn.real_name)) qdel(G) + + // Also check the hidden version of each datacore, if they're an offmap role. + var/datum/job/J = SSjob.get_job(job) + if(J?.offmap_spawn) + for(var/datum/data/record/R in data_core.hidden_general) + if((R.fields["name"] == to_despawn.real_name)) + qdel(R) + for(var/datum/data/record/T in data_core.hidden_security) + if((T.fields["name"] == to_despawn.real_name)) + qdel(T) + for(var/datum/data/record/G in data_core.hidden_medical) + if((G.fields["name"] == to_despawn.real_name)) + qdel(G) icon_state = base_icon_state From fc38b2a5dfebad8ef7c448b7b9922c7d99a532ad Mon Sep 17 00:00:00 2001 From: MarinaGryphon Date: Tue, 13 Jul 2021 21:41:10 -0500 Subject: [PATCH 10/16] Prevent Dionaea from being passively overfed. Fixes #9643 --- .../mob/living/carbon/human/species/station/station.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/species/station/station.dm b/code/modules/mob/living/carbon/human/species/station/station.dm index b0dea18d58..3b2f9f0b3b 100644 --- a/code/modules/mob/living/carbon/human/species/station/station.dm +++ b/code/modules/mob/living/carbon/human/species/station/station.dm @@ -618,7 +618,9 @@ if(isturf(H.loc)) //else, there's considered to be no light var/turf/T = H.loc light_amount = T.get_lumcount() * 10 - H.adjust_nutrition(light_amount) + // Don't overfeed, just make them full without going over. + if((H.nutrition + light_amount) < initial(H.nutrition)) + H.adjust_nutrition(light_amount) H.shock_stage -= light_amount if(light_amount >= 3) //if there's enough light, heal From 643ca84dacdb886c008f3bedf9dbfb36f39382f5 Mon Sep 17 00:00:00 2001 From: Mewchild Date: Wed, 14 Jul 2021 09:56:54 -0500 Subject: [PATCH 11/16] Adds the tie hair inherent verb to all species Fixed the fact that Zorren had inherent verbs defined twice for them --- .../carbon/human/species/station/alraune.dm | 4 +-- .../carbon/human/species/station/blank_vr.dm | 1 + .../species/station/station_special_vr.dm | 6 ++-- .../human/species/station/station_vr.dm | 28 ++++++++++++------- 4 files changed, 25 insertions(+), 14 deletions(-) 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 2cb0b357fb..189eeb425d 100644 --- a/code/modules/mob/living/carbon/human/species/station/alraune.dm +++ b/code/modules/mob/living/carbon/human/species/station/alraune.dm @@ -45,8 +45,8 @@ flags = NO_SCAN | IS_PLANT | NO_MINOR_CUT appearance_flags = HAS_HAIR_COLOR | HAS_LIPS | HAS_UNDERWEAR | HAS_SKIN_COLOR | HAS_EYE_COLOR - inherent_verbs = list( - /mob/living/carbon/human/proc/alraune_fruit_select) //Give them the voremodes related to wrapping people in vines and sapping their fluids + inherent_verbs = list(/mob/living/carbon/human/proc/alraune_fruit_select, //Give them the voremodes related to wrapping people in vines and sapping their fluids + /mob/living/carbon/human/proc/tie_hair) color_mult = 1 icobase = 'icons/mob/human_races/r_human_vr.dmi' diff --git a/code/modules/mob/living/carbon/human/species/station/blank_vr.dm b/code/modules/mob/living/carbon/human/species/station/blank_vr.dm index fe8d8ecb68..7f5cb24989 100644 --- a/code/modules/mob/living/carbon/human/species/station/blank_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/blank_vr.dm @@ -22,6 +22,7 @@ health_hud_intensity = 2 num_alternate_languages = 3 assisted_langs = list(LANGUAGE_EAL, LANGUAGE_ROOTLOCAL, LANGUAGE_ROOTGLOBAL, LANGUAGE_VOX) + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) genders = list(MALE, FEMALE, PLURAL, NEUTER) diff --git a/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm b/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm index a549049e2a..4d766fb837 100644 --- a/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/station_special_vr.dm @@ -27,7 +27,8 @@ /mob/living/carbon/human/proc/sonar_ping, /mob/living/carbon/human/proc/tie_hair, /mob/living/proc/flying_toggle, - /mob/living/proc/start_wings_hovering) //Xenochimera get all the special verbs since they can't select traits. + /mob/living/proc/start_wings_hovering, + /mob/living/carbon/human/proc/tie_hair) //Xenochimera get all the special verbs since they can't select traits. virus_immune = 1 // They practically ARE one. min_age = 18 @@ -334,7 +335,8 @@ /mob/living/carbon/human/proc/toggle_silk_production, /mob/living/carbon/human/proc/weave_structure, /mob/living/carbon/human/proc/weave_item, - /mob/living/carbon/human/proc/set_silk_color) + /mob/living/carbon/human/proc/set_silk_color, + /mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 diff --git a/code/modules/mob/living/carbon/human/species/station/station_vr.dm b/code/modules/mob/living/carbon/human/species/station/station_vr.dm index a7f55d937a..b6b5463405 100644 --- a/code/modules/mob/living/carbon/human/species/station/station_vr.dm +++ b/code/modules/mob/living/carbon/human/species/station/station_vr.dm @@ -15,6 +15,7 @@ secondary_langs = list(LANGUAGE_SAGARU) name_language = LANGUAGE_SAGARU color_mult = 1 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -80,7 +81,7 @@ name_language = LANGUAGE_SKRELLIAN color_mult = 1 assisted_langs = list(LANGUAGE_EAL, LANGUAGE_ROOTLOCAL, LANGUAGE_ROOTGLOBAL, LANGUAGE_VOX) - + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -127,8 +128,9 @@ secondary_langs = list(LANGUAGE_BIRDSONG) name_language = LANGUAGE_BIRDSONG color_mult = 1 - inherent_verbs = list(/mob/living/proc/flying_toggle,/mob/living/proc/start_wings_hovering) - + inherent_verbs = list(/mob/living/proc/flying_toggle, + /mob/living/proc/start_wings_hovering, + /mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -169,7 +171,9 @@ num_alternate_languages = 3 secondary_langs = list(LANGUAGE_TERMINUS) name_language = LANGUAGE_TERMINUS - inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds) + inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds, + /mob/living/proc/shred_limb, + /mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -201,7 +205,6 @@ "You feel uncomfortably warm.", "Your overheated skin itches." ) - inherent_verbs = list(/mob/living/proc/shred_limb) /datum/species/vulpkanin name = SPECIES_VULPKANIN @@ -220,7 +223,8 @@ // gluttonous = 1 num_alternate_languages = 3 color_mult = 1 - inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds) + inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds, + /mob/living/carbon/human/proc/tie_hair) blurb = "Vulpkanin are a species of sharp-witted canine-pideds residing on the planet Altam just barely within the \ dual-star Vazzend system. Their politically de-centralized society and independent natures have led them to become a species and \ @@ -253,6 +257,7 @@ tail_animation = 'icons/mob/species/unathi/tail_vr.dmi' color_mult = 1 min_age = 18 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) gluttonous = 0 genders = list(MALE, FEMALE, PLURAL, NEUTER) descriptors = list() @@ -265,6 +270,7 @@ tail_animation = 'icons/mob/species/tajaran/tail_vr.dmi' color_mult = 1 min_age = 18 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) allergens = null gluttonous = 0 //Moving this here so I don't have to fix this conflict every time polaris glances at station.dm inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds) @@ -279,6 +285,7 @@ deform = 'icons/mob/human_races/r_def_skrell_vr.dmi' color_mult = 1 min_age = 18 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) reagent_tag = null allergens = null assisted_langs = list(LANGUAGE_EAL, LANGUAGE_ROOTLOCAL, LANGUAGE_ROOTGLOBAL, LANGUAGE_VOX) @@ -288,6 +295,7 @@ /datum/species/zaddat spawn_flags = SPECIES_CAN_JOIN min_age = 18 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) //I don't even know if Zaddat can HAVE hair, but here we are, I suppose gluttonous = 0 genders = list(MALE, FEMALE, PLURAL, NEUTER) descriptors = list() @@ -328,7 +336,8 @@ /datum/species/vox gluttonous = 0 spawn_flags = SPECIES_CAN_JOIN | SPECIES_IS_WHITELISTED | SPECIES_WHITELIST_SELECTABLE - min_age = 18 + min_age = 18 + inherent_verbs = list(/mob/living/carbon/human/proc/tie_hair) //Get ya quills done did icobase = 'icons/mob/human_races/r_vox_old.dmi' deform = 'icons/mob/human_races/r_def_vox_old.dmi' descriptors = list( @@ -349,7 +358,7 @@ name_language = null color_mult = 1 genders = list(MALE, FEMALE, PLURAL, NEUTER) - inherent_verbs = list(/mob/living/proc/flying_toggle,/mob/living/proc/start_wings_hovering) + inherent_verbs = list(/mob/living/proc/flying_toggle,/mob/living/proc/start_wings_hovering,/mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -496,7 +505,7 @@ num_alternate_languages = 3 secondary_langs = list(LANGUAGE_TERMINUS) name_language = LANGUAGE_TERMINUS - inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds) + inherent_verbs = list(/mob/living/carbon/human/proc/lick_wounds,/mob/living/proc/shred_limb,/mob/living/carbon/human/proc/tie_hair) min_age = 18 max_age = 80 @@ -510,7 +519,6 @@ base_color = "#333333" blood_color = "#240bc4" color_mult = 1 - inherent_verbs = list(/mob/living/proc/shred_limb) heat_discomfort_strings = list( "Your fur prickles in the heat.", From bacdbb82944a173cf09229a658497c5006d7fa25 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 13:42:23 -0400 Subject: [PATCH 12/16] Fix naughty one-line bug --- code/modules/telesci/quantum_pad.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/telesci/quantum_pad.dm b/code/modules/telesci/quantum_pad.dm index 6232152d22..6f1381a191 100644 --- a/code/modules/telesci/quantum_pad.dm +++ b/code/modules/telesci/quantum_pad.dm @@ -245,6 +245,8 @@ var/list/gateway_zs = GetConnectedZlevels(GLOB.gateway_away.z) if(z in gateway_zs) return FALSE // It's not calibrated and we're in a connected z + + return TRUE /obj/machinery/power/quantumpad/proc/gateway_scatter(mob/user) var/obj/effect/landmark/dest = pick(awaydestinations) From 79b272d28b04a966c1f47afca3dfbdc0476ad6bc Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 14:14:10 -0400 Subject: [PATCH 13/16] Update code/controllers/subsystems/transcore_vr.dm --- code/controllers/subsystems/transcore_vr.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystems/transcore_vr.dm b/code/controllers/subsystems/transcore_vr.dm index 86ffac6b06..6b0815999b 100644 --- a/code/controllers/subsystems/transcore_vr.dm +++ b/code/controllers/subsystems/transcore_vr.dm @@ -256,7 +256,7 @@ SUBSYSTEM_DEF(transcore) var/datum/transcore_db/db = SStranscore.db_by_mind_name(MR.mindname) var/datum/transhuman/body_record/BR = db.body_scans[MR.mindname] if(!BR) - global_announcer.autosay("[MR.mindname] is past-due for a mind backup, but lacks a corresponding body record." "TransCore Oversight", "Medical") + global_announcer.autosay("[MR.mindname] is past-due for a mind backup, but lacks a corresponding body record.", "TransCore Oversight", "Medical") return global_announcer.autosay("[MR.mindname] is past-due for a mind backup.", "TransCore Oversight", BR.synthetic ? "Science" : "Medical") @@ -300,4 +300,4 @@ SUBSYSTEM_DEF(transcore) return disk.stored.len #undef SSTRANSCORE_BACKUPS -#undef SSTRANSCORE_IMPLANTS \ No newline at end of file +#undef SSTRANSCORE_IMPLANTS From f597f280a27b1221586f2513fc38a5983be9f569 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 14:17:04 -0400 Subject: [PATCH 14/16] Make connections lists lazy --- code/game/objects/structures.dm | 4 ++-- code/game/objects/structures/barricades.dm | 2 +- code/game/objects/structures/catwalk.dm | 2 +- code/modules/tables/tables.dm | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index f023f3e395..38e173e3ff 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -10,8 +10,8 @@ var/list/climbers var/block_turf_edges = FALSE // If true, turf edge icons will not be made on the turf this occupies. - var/list/connections = list("0", "0", "0", "0") - var/list/other_connections = list("0", "0", "0", "0") + var/list/connections + var/list/other_connections var/list/blend_objects = newlist() // Objects which to blend with var/list/noblend_objects = newlist() //Objects to avoid blending with (such as children of listed blend objects. diff --git a/code/game/objects/structures/barricades.dm b/code/game/objects/structures/barricades.dm index 34ab6025c7..1b1dee9171 100644 --- a/code/game/objects/structures/barricades.dm +++ b/code/game/objects/structures/barricades.dm @@ -144,7 +144,7 @@ var/image/I for(var/i = 1 to 4) - I = image('icons/obj/sandbags.dmi', "sandbags[connections[i]]", dir = 1<<(i-1)) + I = image('icons/obj/sandbags.dmi', "sandbags[connections?[i] || 0]", dir = 1<<(i-1)) I.color = material.icon_colour add_overlay(I) diff --git a/code/game/objects/structures/catwalk.dm b/code/game/objects/structures/catwalk.dm index 58674def1a..dc73bde9b6 100644 --- a/code/game/objects/structures/catwalk.dm +++ b/code/game/objects/structures/catwalk.dm @@ -51,7 +51,7 @@ var/image/I if(!hatch_open) for(var/i = 1 to 4) - I = image(icon, "catwalk[connections[i]]", dir = 1<<(i-1)) + I = image(icon, "catwalk[connections?[i] || 0]", dir = 1<<(i-1)) add_overlay(I) if(plating_color) I = image(icon, "plated") diff --git a/code/modules/tables/tables.dm b/code/modules/tables/tables.dm index 7111cd52d7..ba73d22502 100644 --- a/code/modules/tables/tables.dm +++ b/code/modules/tables/tables.dm @@ -359,24 +359,24 @@ var/list/table_icon_cache = list() // Base frame shape. Mostly done for glass/diamond tables, where this is visible. for(var/i = 1 to 4) - var/image/I = get_table_image(icon, connections[i], 1<<(i-1)) + var/image/I = get_table_image(icon, connections?[i] || 0, 1<<(i-1)) add_overlay(I) // Standard table image if(material) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "[material.icon_base]_[connections[i]]", 1<<(i-1), material.icon_colour, 255 * material.opacity) + var/image/I = get_table_image(icon, "[material.icon_base]_[connections?[i] || 0]", 1<<(i-1), material.icon_colour, 255 * material.opacity) add_overlay(I) // Reinforcements if(reinforced) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connections[i]]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity) + var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connections?[i] || 0]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity) add_overlay(I) if(carpeted) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "carpet_[connections[i]]", 1<<(i-1)) + var/image/I = get_table_image(icon, "carpet_[connections?[i] || 0]", 1<<(i-1)) add_overlay(I) else cut_overlays() From 06377e73de1b416dbb20183bd5c9a93b5587263f Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 14:24:46 -0400 Subject: [PATCH 15/16] Work around spacemandmm suite bug --- code/game/objects/structures/barricades.dm | 3 ++- code/game/objects/structures/catwalk.dm | 3 ++- code/modules/tables/tables.dm | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/code/game/objects/structures/barricades.dm b/code/game/objects/structures/barricades.dm index 1b1dee9171..c60c48375e 100644 --- a/code/game/objects/structures/barricades.dm +++ b/code/game/objects/structures/barricades.dm @@ -144,7 +144,8 @@ var/image/I for(var/i = 1 to 4) - I = image('icons/obj/sandbags.dmi', "sandbags[connections?[i] || 0]", dir = 1<<(i-1)) + var/connect = connections?[i] || 0 + I = image('icons/obj/sandbags.dmi', "sandbags[connect]", dir = 1<<(i-1)) I.color = material.icon_colour add_overlay(I) diff --git a/code/game/objects/structures/catwalk.dm b/code/game/objects/structures/catwalk.dm index dc73bde9b6..e77abbaa6f 100644 --- a/code/game/objects/structures/catwalk.dm +++ b/code/game/objects/structures/catwalk.dm @@ -51,7 +51,8 @@ var/image/I if(!hatch_open) for(var/i = 1 to 4) - I = image(icon, "catwalk[connections?[i] || 0]", dir = 1<<(i-1)) + var/connect = connections?[i] || 0 + I = image(icon, "catwalk[connect]", dir = 1<<(i-1)) add_overlay(I) if(plating_color) I = image(icon, "plated") diff --git a/code/modules/tables/tables.dm b/code/modules/tables/tables.dm index ba73d22502..914c478e17 100644 --- a/code/modules/tables/tables.dm +++ b/code/modules/tables/tables.dm @@ -365,18 +365,21 @@ var/list/table_icon_cache = list() // Standard table image if(material) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "[material.icon_base]_[connections?[i] || 0]", 1<<(i-1), material.icon_colour, 255 * material.opacity) + var/connect = connections?[i] || 0 + var/image/I = get_table_image(icon, "[material.icon_base]_[connect]", 1<<(i-1), material.icon_colour, 255 * material.opacity) add_overlay(I) // Reinforcements if(reinforced) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connections?[i] || 0]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity) + var/connect = connections?[i] || 0 + var/image/I = get_table_image(icon, "[reinforced.icon_reinf]_[connect]", 1<<(i-1), reinforced.icon_colour, 255 * reinforced.opacity) add_overlay(I) if(carpeted) for(var/i = 1 to 4) - var/image/I = get_table_image(icon, "carpet_[connections?[i] || 0]", 1<<(i-1)) + var/connect = connections?[i] || 0 + var/image/I = get_table_image(icon, "carpet_[connect]", 1<<(i-1)) add_overlay(I) else cut_overlays() From 333168729e19bf830e046fb3de480d2f6ed93711 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 14 Jul 2021 14:24:53 -0400 Subject: [PATCH 16/16] Update builds version --- _build_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_build_dependencies.sh b/_build_dependencies.sh index 76c52d2e5c..3e1b40130b 100644 --- a/_build_dependencies.sh +++ b/_build_dependencies.sh @@ -4,8 +4,8 @@ export SPACEMAN_DMM_VERSION=suite-1.7 # For NanoUI + TGUI export NODE_VERSION=12 # Byond Major -export BYOND_MAJOR=513 +export BYOND_MAJOR=514 # Byond Minor -export BYOND_MINOR=1542 +export BYOND_MINOR=1557 # Macro Count export MACRO_COUNT=4 \ No newline at end of file