diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index b6b8d5fe7d65..6c09482bb556 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -166,6 +166,10 @@ var/turf/T = get_turf(source) var/list/hear = list() + + if(!T) + return hear + var/list/range = hear(R, T) for(var/atom/A in range) diff --git a/code/defines/procs/helper_text.dm b/code/defines/procs/helper_text.dm index 2ea37cf85422..7f8629430a82 100644 --- a/code/defines/procs/helper_text.dm +++ b/code/defines/procs/helper_text.dm @@ -71,6 +71,10 @@ else non_whitespace = 1 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_simple(name, max_length) //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/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm index 29a83b13de3f..ef9f5d8736c9 100644 --- a/code/game/machinery/bots/cleanbot.dm +++ b/code/game/machinery/bots/cleanbot.dm @@ -353,11 +353,9 @@ text("[src.oddbutton ? "Yes" : "No" del(src) else if (istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) if (!t) return if (!in_range(src, usr) && src.loc != usr) return - src.created_name = t \ No newline at end of file diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm index 776afcb102ba..574bf6ca7b94 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -891,8 +891,7 @@ Auto Patrol: []"}, ..() if(istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) if(!t) return if(!in_range(src, usr) && src.loc != usr) return created_name = t diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 4dda38d3d07b..e40f855b49f1 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -425,8 +425,7 @@ del(src) else if (istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) if (!t) return if (!in_range(src, usr) && src.loc != usr) @@ -445,8 +444,8 @@ user.drop_from_inventory(src) del(src) else if (istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) + if (!t) return if (!in_range(src, usr) && src.loc != usr) diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 19ae8b7d9aa0..82c1e38836b1 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -559,13 +559,11 @@ /obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob) ..() if(istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) if (!t) return if (!in_range(src, usr) && src.loc != usr) return - src.created_name = t else switch(build_step) diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm index 04399852f89c..a6afcf6d88c1 100644 --- a/code/game/machinery/bots/secbot.dm +++ b/code/game/machinery/bots/secbot.dm @@ -754,11 +754,9 @@ Auto Patrol: []"}, del(src) else if(istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name) if(!t) return if(!in_range(src, usr) && src.loc != usr) return - src.created_name = t diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm index ac3ad6b68d35..6334592ff3f6 100644 --- a/code/game/machinery/camera/tracking.dm +++ b/code/game/machinery/camera/tracking.dm @@ -112,7 +112,7 @@ if(U.eyeobj) U.eyeobj.setLoc(get_turf(target)) else - core() + view_core() return sleep(10) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index b853344b9be8..419f269b852b 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -98,7 +98,7 @@ if("announce") if(src.authenticated==2) if(message_cooldown) return - var/input = copytext(strip_html_simple(input(usr, "Please choose a message to announce to the station crew.", "What?", "")),1,MAX_MESSAGE_LEN) + var/input = stripped_input(usr, "Please choose a message to announce to the station crew.", "What?") if(!input || !(usr in view(1,src))) return captain_announce(input)//This should really tell who is, IE HoP, CE, HoS, RD, Captain @@ -177,15 +177,15 @@ if(centcomm_message_cooldown) usr << "Arrays recycling. Please stand by." return - var/input = copytext(sanitize(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.", "")),1,MAX_MESSAGE_LEN) + 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 || !(usr in view(1,src))) return Centcomm_announce(input, usr) usr << "Message transmitted." log_say("[key_name(usr)] has made a Centcomm announcement: [input]") centcomm_message_cooldown = 1 - spawn(600)//One minute cooldown - message_cooldown = 0 + spawn(6000)//10 minute cooldown + centcomm_message_cooldown = 0 // OMG SYNDICATE ...LETTERHEAD @@ -194,15 +194,15 @@ if(centcomm_message_cooldown) usr << "Arrays recycling. Please stand by." return - var/input = copytext(sanitize(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.", "")),1,MAX_MESSAGE_LEN) + 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 || !(usr in view(1,src))) return Syndicate_announce(input, usr) usr << "Message transmitted." log_say("[key_name(usr)] has made a Syndicate announcement: [input]") centcomm_message_cooldown = 1 - spawn(600)//One minute cooldown - message_cooldown = 0 + spawn(6000)//10 minute cooldown + centcomm_message_cooldown = 0 if("RestoreBackup") usr << "Backup routing data restored!" diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 2cd21053b108..97493ff3b42c 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -216,8 +216,7 @@ user << "\blue The MMI must go in after everything else!" if (istype(W, /obj/item/weapon/pen)) - var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_NAME_LEN) + var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name, MAX_NAME_LEN) if (!t) return if (!in_range(src, usr) && src.loc != usr) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 3a6b992db14c..5ae894662fbb 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -793,10 +793,11 @@ var/global/BSACooldown = 0 if ((src.rank in list( "Trial Admin", "Badmin", "Game Admin", "Game Master" ))) var/mob/M = locate(href_list["forcespeech"]) if (ismob(M)) - var/speech = copytext(sanitize(input("What will [key_name(M)] say?.", "Force speech", "")),1,MAX_MESSAGE_LEN) + var/speech = input("What will [key_name(M)] say?.", "Force speech", "")// Don't need to sanitize, since it does that in say(), we also trust our admins. if(!speech) return M.say(speech) + speech = sanitize(speech) // Nah, we don't trust them log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]") message_admins("\blue [key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]") else diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 89bec80eb556..904911a85e36 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -261,7 +261,7 @@ if (prob(30)) switch(pick(1,2)) if(1) - core() + view_core() if(2) ai_call_shuttle() ..() @@ -445,7 +445,7 @@ return 0 if(!src.eyeobj) - core() + view_core() return // ok, we're alive, camera is good and in our network... eyeobj.setLoc(get_turf(C)) @@ -512,7 +512,7 @@ set name = "Cancel Camera View" //src.cameraFollow = null - src.core() + src.view_core() //Replaces /mob/living/silicon/ai/verb/change_network() in ai.dm & camera.dm @@ -547,7 +547,7 @@ network = input(U, "Which network would you like to view?") as null|anything in cameralist if(!U.eyeobj) - U.core() + U.view_core() return if(isnull(network)) diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index 75daf5667437..e8e691b05fa5 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -103,11 +103,17 @@ /mob/living/silicon/ai/verb/core() set category = "AI Commands" set name = "AI Core" + + view_core() + + +/mob/living/silicon/ai/proc/view_core() + current = null cameraFollow = null machine = null - if(src.eyeobj) + if(src.eyeobj && src.loc) src.eyeobj.loc = src.loc else src << "ERROR: Eyeobj not found. Please report this to Giacom. Creating new eye..." diff --git a/code/modules/mob/living/silicon/ai/login.dm b/code/modules/mob/living/silicon/ai/login.dm index 6eb8cfa31ea3..200e2020bb63 100644 --- a/code/modules/mob/living/silicon/ai/login.dm +++ b/code/modules/mob/living/silicon/ai/login.dm @@ -22,5 +22,5 @@ if(O) O.mode = 1 O.emotion = "Neutral" - src.core() + src.view_core() return \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/logout.dm b/code/modules/mob/living/silicon/ai/logout.dm index 451f60a74cc3..09bc93bf3498 100644 --- a/code/modules/mob/living/silicon/ai/logout.dm +++ b/code/modules/mob/living/silicon/ai/logout.dm @@ -6,5 +6,5 @@ if (client) client.eye = loc client.perspective = EYE_PERSPECTIVE - src.core() + src.view_core() return \ No newline at end of file