From 7b4dd7eb19ae540cc96a4991061ae610eaa5c976 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 30 Jul 2018 23:24:35 -0700 Subject: [PATCH] Cleans out various macro redefinitions or useless use of syntax --- code/__HELPERS/text.dm | 9 ++++++--- code/_onclick/hud/fullscreen.dm | 10 ++-------- code/datums/components/_component.dm | 2 +- code/defines/procs/announce.dm | 4 ++-- code/game/machinery/computer/communications.dm | 6 +++--- code/modules/library/lib_items.dm | 2 +- .../file_system/programs/command/comms.dm | 6 +++--- code/modules/paperwork/paper.dm | 3 ++- code/modules/power/supermatter/supermatter.dm | 4 +--- code/modules/research/rdmachines.dm | 14 +++++++------- 10 files changed, 28 insertions(+), 32 deletions(-) diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index 5fb559651d5..8e9b5f93691 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -96,9 +96,12 @@ if(non_whitespace) return text //only accepts the text if it has some non-spaces // Used to get a sanitized input. -/proc/stripped_input(var/mob/user, var/message = "", var/title = "", var/default = "", var/max_length=MAX_MESSAGE_LEN) - var/name = input(user, message, title, default) - return strip_html_properly(name, max_length) +/proc/stripped_input(mob/user, message = "", title = "", default = "", max_length=MAX_MESSAGE_LEN, no_trim=FALSE) + var/name = input(user, message, title, default) as text|null + if(no_trim) + return copytext(html_encode(name), 1, max_length) + else + return trim(html_encode(name), max_length) //trim is "outside" because html_encode can expand single symbols into multiple symbols (such as turning < into <) //Filters out undesirable characters from names /proc/reject_bad_name(var/t_in, var/allow_numbers=0, var/max_length=MAX_NAME_LEN) diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index fd0c91ded3a..a44f5d2e5a8 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -1,8 +1,3 @@ -#define FULLSCREEN_LAYER 18 -#define DAMAGE_LAYER FULLSCREEN_LAYER + 0.1 -#define BLIND_LAYER DAMAGE_LAYER + 0.1 -#define CRIT_LAYER BLIND_LAYER + 0.1 - /mob var/list/screens = list() @@ -68,11 +63,11 @@ /obj/screen/fullscreen/brute icon_state = "brutedamageoverlay" - layer = DAMAGE_LAYER + layer = UI_DAMAGE_LAYER /obj/screen/fullscreen/oxy icon_state = "oxydamageoverlay" - layer = DAMAGE_LAYER + layer = UI_DAMAGE_LAYER /obj/screen/fullscreen/crit icon_state = "passage" @@ -107,5 +102,4 @@ #undef FULLSCREEN_LAYER #undef BLIND_LAYER -#undef DAMAGE_LAYER #undef CRIT_LAYER diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index 0da932d1575..775a8667b3f 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -106,7 +106,7 @@ /datum/component/proc/_GetInverseTypeList(our_type = type) #if DM_VERSION >= 513 - #warning 512 is definitely stable now, remove the old code + #warn 512 is definitely stable now, remove the old code #endif #if DM_VERSION < 512 diff --git a/code/defines/procs/announce.dm b/code/defines/procs/announce.dm index b6e3ecde8bd..1664a7051da 100644 --- a/code/defines/procs/announce.dm +++ b/code/defines/procs/announce.dm @@ -48,8 +48,8 @@ if(!message) return - var/tmp/message_title = new_title ? new_title : title - var/tmp/message_sound = new_sound ? sound(new_sound) : sound + var/message_title = new_title ? new_title : title + var/message_sound = new_sound ? sound(new_sound) : sound if(!msg_sanitized) message = trim_strip_html_properly(message, allow_lines = 1) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 054d4d441a3..865f683946e 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -231,7 +231,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return - var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") as text|null + var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return @@ -250,7 +250,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return - var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null + var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return @@ -270,7 +270,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return - var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null + var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index 8df5d593b9b..a856e3f822f 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -228,7 +228,7 @@ src.name = newtitle src.title = newtitle if("Contents") - var/content = strip_html(input(usr, "Write your book's contents (HTML NOT allowed):"), MAX_BOOK_MESSAGE_LEN) as message|null + var/content = strip_html(input(usr, "Write your book's contents (HTML NOT allowed):") as message|null, MAX_BOOK_MESSAGE_LEN) if(!content) to_chat(usr, "The content is invalid.") return 1 diff --git a/code/modules/modular_computers/file_system/programs/command/comms.dm b/code/modules/modular_computers/file_system/programs/command/comms.dm index ef6cf016cd5..2ca6d9928a3 100644 --- a/code/modules/modular_computers/file_system/programs/command/comms.dm +++ b/code/modules/modular_computers/file_system/programs/command/comms.dm @@ -325,7 +325,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return 1 - var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") as text|null + var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return 1 @@ -344,7 +344,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return 1 - var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null + var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return 1 @@ -363,7 +363,7 @@ to_chat(usr, "Arrays recycling. Please stand by.") SSnanoui.update_uis(src) return 1 - var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null + var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)) SSnanoui.update_uis(src) return 1 diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index e8858a4dd31..2fe57c5698f 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -405,7 +405,8 @@ stamps += (!stamps || stamps == "" ? "
" : "") + "" var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') - var/{x; y;} + var/x + var/y if(istype(S, /obj/item/stamp/captain) || istype(S, /obj/item/stamp/centcom)) x = rand(-2, 0) y = rand(-1, 2) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index fd031f987c6..125706bff28 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -15,7 +15,7 @@ //Controls how much power is produced by each collector in range - this is the main parameter for tweaking SM balance, as it basically controls how the power variable relates to the rest of the game. #define POWER_FACTOR 1.0 #define DECAY_FACTOR 700 //Affects how fast the supermatter power decays -#define CRITICAL_TEMPERATURE 5000 //K +#define CRITICAL_TEMPERATURE 10000 //K #define CHARGING_FACTOR 0.05 #define DAMAGE_RATE_LIMIT 4.5 //damage rate cap at power = 300, scales linearly with power @@ -425,8 +425,6 @@ else L.show_message("You hear an uneartly ringing and notice your skin is covered in fresh radiation burns.", 2) -#define CRITICAL_TEMPERATURE 10000 - /obj/machinery/power/supermatter_shard/proc/get_status() var/turf/T = get_turf(src) if(!T) diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index 6fb2a891214..51b4f8512e1 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -43,15 +43,15 @@ if(shocked) shock(user,50) if(panel_open) - var/dat as text + var/list/dat = list() dat += "[src.name] Wires:
" - for(var/wire in src.wires) - dat += text("[wire] Wire: [src.wires[wire] ? "Mend" : "Cut"] Pulse
") + for(var/wire in wires) + dat += "[wire] Wire: [src.wires[wire] ? "Mend" : "Cut"] Pulse
" - dat += text("The red light is [src.disabled ? "off" : "on"].
") - dat += text("The green light is [src.shocked ? "off" : "on"].
") - dat += text("The blue light is [src.hacked ? "off" : "on"].
") - user << browse("[src.name] Hacking[dat]","window=hack_win") + dat += "The red light is [src.disabled ? "off" : "on"].
" + dat += "The green light is [src.shocked ? "off" : "on"].
" + dat += "The blue light is [src.hacked ? "off" : "on"].
" + user << browse("[src.name] Hacking[dat.Join("")]","window=hack_win") return