From 87d7c9e91ebdb53e5cdee40a262301400431c3f0 Mon Sep 17 00:00:00 2001 From: phil235 Date: Sun, 14 Sep 2014 01:15:15 +0200 Subject: [PATCH] Create the audible_message() proc to replace most instance of " for(var/mob/M in hearers(...) show_message(..., 2)" fixing typos and missing emotes in emote lists. --- .../components/unary/vent_pump.dm | 6 ++-- code/controllers/supply_shuttle.dm | 8 ++--- code/game/machinery/bots/bots.dm | 4 +-- code/game/machinery/computer/message.dm | 6 ++-- code/game/objects/effects/spiders.dm | 5 +-- code/game/objects/items/devices/PDA/PDA.dm | 4 +-- .../objects/items/weapons/teleportation.dm | 3 +- .../structures/crates_lockers/closets.dm | 2 +- .../closets/secure/secure_closets.dm | 2 +- code/modules/admin/admin_verbs.dm | 3 +- code/modules/assembly/signaler.dm | 3 +- code/modules/events/immovable_rod.dm | 3 +- code/modules/events/ninja.dm | 3 +- code/modules/library/lib_machines.dm | 11 +++--- .../mob/living/carbon/alien/humanoid/emote.dm | 8 ++--- .../mob/living/carbon/alien/larva/emote.dm | 9 ++--- code/modules/mob/living/carbon/brain/emote.dm | 6 ++-- code/modules/mob/living/carbon/carbon.dm | 6 ++-- code/modules/mob/living/carbon/emote.dm | 6 ++-- code/modules/mob/living/carbon/human/emote.dm | 8 ++--- .../modules/mob/living/carbon/monkey/emote.dm | 10 ++---- code/modules/mob/living/carbon/slime/emote.dm | 9 ++--- code/modules/mob/living/emote.dm | 8 ++--- .../mob/living/silicon/pai/software.dm | 3 +- .../modules/mob/living/silicon/robot/emote.dm | 6 ++-- code/modules/mob/mob.dm | 36 +++++++++++++++++++ code/modules/recycling/disposal.dm | 2 +- 27 files changed, 89 insertions(+), 91 deletions(-) diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 5be3be0e53d..76eac1ed8a3 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -373,11 +373,9 @@ if(!target_vent) return - for(var/mob/O in viewers(L, null)) - O.show_message(text("[L] scrambles into the ventillation ducts!"), 1) + visible_message("[L] scrambles into the ventillation ducts!") - for(var/mob/O in hearers(target_vent,null)) - O.show_message("You hear something squeezing through the ventilation ducts.",2) + audible_message("You hear something squeezing through the ventilation ducts.") if(target_vent.welded) //the vent can be welded while they scrolled through the list. target_vent = src diff --git a/code/controllers/supply_shuttle.dm b/code/controllers/supply_shuttle.dm index 3f8238177f0..9cf4ebf311b 100644 --- a/code/controllers/supply_shuttle.dm +++ b/code/controllers/supply_shuttle.dm @@ -467,8 +467,8 @@ var/global/datum/controller/supply_shuttle/supply_shuttle else if (href_list["doorder"]) if(world.time < reqtime) - for(var/mob/V in hearers(src)) - V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") + audible_message("[src]'s monitor beeps, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"",\ + "[src]'s monitor flashes.") return //Find the correct supply_pack datum @@ -657,8 +657,8 @@ var/global/datum/controller/supply_shuttle/supply_shuttle else if (href_list["doorder"]) if(world.time < reqtime) - for(var/mob/V in hearers(src)) - V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") + audible_message("[src]'s monitor beeps, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"", \ + "[src]'s monitor flashes.") return //Find the correct supply_pack datum diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 947bbe77df4..4b27d67b822 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -166,7 +166,7 @@ /obj/machinery/bot/proc/speak(var/message) if((!src.on) || (!message)) return - for(var/mob/O in hearers(src, null)) - O.show_message("[src] beeps, \"[message]\"",2) + audible_message("[src] beeps, \"[message]\"") return + diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm index b9d29711de0..f4e1171aadf 100644 --- a/code/game/machinery/computer/message.dm +++ b/code/game/machinery/computer/message.dm @@ -434,8 +434,7 @@ customrecepient.tnote += "← From [customsender] ([customjob]):
[custommessage]
" if (!customrecepient.silent) playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, customrecepient.loc)) - O.show_message(text("\icon[customrecepient] *[customrecepient.ttone]*")) + customrecepient.loc.audible_message("\icon[customrecepient] *[customrecepient.ttone]*", null, null, 3) if( customrecepient.loc && ishuman(customrecepient.loc) ) var/mob/living/carbon/human/H = customrecepient.loc H << "\icon[customrecepient] Message from [customsender] ([customjob]), \"[custommessage]\" (Reply)" @@ -448,8 +447,7 @@ customrecepient.tnote += "← From [PDARec.owner] ([customjob]):
[custommessage]
" if (!customrecepient.silent) playsound(customrecepient.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, customrecepient.loc)) - O.show_message(text("\icon[customrecepient] *[customrecepient.ttone]*")) + customrecepient.loc.audible_message("\icon[customrecepient] *[customrecepient.ttone]*", null, 3) if( customrecepient.loc && ishuman(customrecepient.loc) ) var/mob/living/carbon/human/H = customrecepient.loc H << "\icon[customrecepient] Message from [PDARec.owner] ([customjob]), \"[custommessage]\" (Reply)" diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 68c04cf5d54..26c12f5f8da 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -137,7 +137,8 @@ return var/obj/machinery/atmospherics/unary/vent_pump/exit_vent = pick(vents) if(prob(50)) - src.visible_message("[src] scrambles into the ventillation ducts!") + visible_message("[src] scrambles into the ventillation ducts!", \ + "You hear something squeezing through the ventilation ducts.") spawn(rand(20,60)) loc = exit_vent @@ -150,7 +151,7 @@ return if(prob(50)) - src.visible_message("You hear something squeezing through the ventilation ducts.",2) + audible_message("You hear something squeezing through the ventilation ducts.") sleep(travel_time) if(!exit_vent || exit_vent.welded) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 3f239f3d591..e83598b3166 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -755,9 +755,7 @@ var/global/list/obj/item/device/pda/PDAs = list() P.tnote += "← From [owner] ([ownjob]):
[t]
" if (!P.silent) - playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, P.loc)) - if(!P.silent) O.show_message(text("\icon[P] *[P.ttone]*")) + P.loc.audible_message("\icon[P] *[P.ttone]*", null, 3) //Search for holder of the PDA. var/mob/living/L = null if(P.loc && isliving(P.loc)) diff --git a/code/game/objects/items/weapons/teleportation.dm b/code/game/objects/items/weapons/teleportation.dm index 62f7a68cbb8..126708c3e49 100644 --- a/code/game/objects/items/weapons/teleportation.dm +++ b/code/game/objects/items/weapons/teleportation.dm @@ -162,8 +162,7 @@ Frequency: user.show_message("\The [src] is recharging!") return var/T = L[t1] - for(var/mob/O in hearers(user, null)) - O.show_message("Locked In.", 2) + user.audible_message("Locked In.") var/obj/effect/portal/P = new /obj/effect/portal(get_turf(src), T, src) try_move_adjacent(P) active_portals++ diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 9c772d349b2..5f0d1abfc68 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -250,7 +250,7 @@ if(!lastbang) lastbang = 1 for (var/mob/M in hearers(src, null)) - M << text("BANG, bang!", max(0, 5 - get_dist(src, M))) + M.show_message("BANG, bang!", 2) spawn(30) lastbang = 0 diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index 30c0268575f..6a3efae3afd 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -96,7 +96,7 @@ if(world.time > lastbang+5) lastbang = world.time for(var/mob/M in hearers(src, null)) - M << "BANG, bang!" + M.show_message("BANG, bang!", 2) return /obj/structure/closet/secure_closet/attack_hand(mob/user as mob) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5db0a6bc7a0..f5e8574ccb6 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -481,8 +481,7 @@ var/list/admin_verbs_hideable = list( if(mob.control_object) if(!msg) return - for (var/mob/V in hearers(mob.control_object)) - V.show_message("[mob.control_object.name] says: \"" + msg + "\"", 2) + mob.control_object.audible_message("[mob.control_object.name] says: \"" + msg + "\"") feedback_add_details("admin_verb","OT") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! /client/proc/kill_air() diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 325b1688a5b..d46487da15b 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -134,8 +134,7 @@ Code: if(signal.encryption != code) return 0 if(!(src.wires & WIRE_RADIO_RECEIVE)) return 0 pulse(1) - for(var/mob/O in hearers(1, src.loc)) - O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2) + src.loc.audible_message("\icon[src] *beep* *beep*", null, 1) return diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index ebf598eda53..b0e1173397a 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -76,8 +76,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 /obj/effect/immovablerod/Bump(atom/clong) playsound(src, 'sound/effects/bang.ogg', 50, 1) - for (var/mob/O in hearers(src, null)) - O.show_message("CLANG", 2) + audible_message("CLANG") if(istype(clong, /turf/unsimulated) || istype(clong, /turf/simulated/shuttle)) //Unstoppable force meets immovable object explosion(src.loc, 4, 5, 6, 7, 0) diff --git a/code/modules/events/ninja.dm b/code/modules/events/ninja.dm index 746d1010d0f..f2156a756cb 100644 --- a/code/modules/events/ninja.dm +++ b/code/modules/events/ninja.dm @@ -1875,8 +1875,7 @@ ________________________________________________________________________________ P.tnote += "← From [!s_control?(A):"an unknown source"]:
[t]
" if (!P.silent) playsound(P.loc, 'sound/machines/twobeep.ogg', 50, 1) - for (var/mob/O in hearers(3, P.loc)) - O.show_message(text("\icon[P] *[P.ttone]*")) + P.loc.audible_message("\icon[P] *[P.ttone]*", null, 3) P.overlays.Cut() P.overlays += image('icons/obj/pda.dmi', "pda-r") diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 19559ac0523..0f7ba3858b4 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -252,8 +252,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f var/obj/item/weapon/barcodescanner/scanner = W scanner.computer = src user << "[scanner]'s associated machine has been set to [src]." - for (var/mob/V in hearers(src)) - V.show_message("[src] lets out a low, short blip.", 2) + audible_message("[src] lets out a low, short blip.") else ..() @@ -292,8 +291,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f bibledelay = 0 else - for (var/mob/V in hearers(src)) - V.show_message("[src]'s monitor flashes, \"Bible printer currently unavailable, please wait a moment.\"") + audible_message("[src]'s monitor beeps, \"Bible printer currently unavailable, please wait a moment.\"", \ + "[src]'s monitor flashes.") if("7") screenstate = 7 @@ -364,8 +363,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f if(!dbcon.IsConnected()) alert("Connection to Archive has been severed. Aborting.") if(bibledelay) - for (var/mob/V in hearers(src)) - V.show_message("[src]'s monitor flashes, \"Printer unavailable. Please allow a short time before attempting to print.\"") + audible_message("[src]'s monitor beeps, \"Printer unavailable. Please allow a short time before attempting to print.\"", \ + "[src]'s monitor flashes.") else bibledelay = 1 spawn(60) diff --git a/code/modules/mob/living/carbon/alien/humanoid/emote.dm b/code/modules/mob/living/carbon/alien/humanoid/emote.dm index ed3061be2e8..73157d41c63 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/emote.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/emote.dm @@ -79,11 +79,7 @@ playsound(src.loc, 'sound/voice/hiss6.ogg', 80, 1, 1) if (m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) - //Foreach goto(703) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) - //Foreach goto(746) + audible_message(message) return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/alien/larva/emote.dm b/code/modules/mob/living/carbon/alien/larva/emote.dm index 3504b211893..1533fa673a8 100644 --- a/code/modules/mob/living/carbon/alien/larva/emote.dm +++ b/code/modules/mob/living/carbon/alien/larva/emote.dm @@ -101,14 +101,11 @@ else src << " Unusable emote '[act]'. Say *help for a list." + if ((message && src.stat == 0)) log_emote("[name]/[key] : [message]") if (m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) - //Foreach goto(703) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) - //Foreach goto(746) + audible_message(message) return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/brain/emote.dm b/code/modules/mob/living/carbon/brain/emote.dm index eae87baf57f..4c1f2e55271 100644 --- a/code/modules/mob/living/carbon/brain/emote.dm +++ b/code/modules/mob/living/carbon/brain/emote.dm @@ -67,8 +67,6 @@ if (m_type & 1) - for (var/mob/O in viewers(src, null)) - O.show_message(message, m_type) + visible_message(message) else if (m_type & 2) - for (var/mob/O in hearers(src.loc, null)) - O.show_message(message, m_type) \ No newline at end of file + audible_message(message) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6a561028ed2..40dd1e75730 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -23,9 +23,7 @@ /mob/living/carbon/relaymove(var/mob/user, direction) if(user in src.stomach_contents) if(prob(40)) - for(var/mob/M in hearers(4, src)) - if(M.client) - M.show_message(text("You hear something rumbling inside [src]'s stomach..."), 2) + audible_message("You hear something rumbling inside [src]'s stomach...", "Something is rumbling inside your stomach!", null, 4) var/obj/item/I = user.get_active_hand() if(I && I.force) var/d = rand(round(I.force / 4), I.force) @@ -41,7 +39,7 @@ src.take_organ_damage(d) for(var/mob/M in viewers(user, null)) if(M.client) - M.show_message(text("[user] attacks [src]'s stomach wall with the [I.name]!"), 2) + M.show_message("[user] attacks [src]'s stomach wall with the [I.name]!", 2) playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1) if(prob(src.getBruteLoss() - 50)) diff --git a/code/modules/mob/living/carbon/emote.dm b/code/modules/mob/living/carbon/emote.dm index 90c9809c580..a67f683174c 100644 --- a/code/modules/mob/living/carbon/emote.dm +++ b/code/modules/mob/living/carbon/emote.dm @@ -193,8 +193,6 @@ if (m_type & 1) - for (var/mob/O in viewers(src, null)) - O.show_message(message, m_type) + visible_message(message) else if (m_type & 2) - for (var/mob/O in hearers(src.loc, null)) - O.show_message(message, m_type) + audible_message(message) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index ba715c188be..b90e2886ea3 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -316,7 +316,7 @@ m_type = 2 if ("help") //This can stay at the bottom. - src << "Help for human emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, cry, custom, dance, dap, deathgasp, drool, eyebrow, faint, frown, flap, gasp, giggle, glare-(none)/mob, grin, groan, grumble, handshake, hug-(none)/mob, johnny, jump, laugh, look-(none)/mob, me, moan, mumble, nod, pale, point-(atom), raise, salute, scream, shake, shiver, shrug, sigh, signal-#1-10, smile, sneeze, sniff, snore, stare-(none)/mob, tremble, twitch, twitch_s, wave, whimper, wink, yawn" + src << "Help for human emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, cry, custom, dance, dap, deathgasp, drool, eyebrow, faint, flap, frown, gasp, giggle, glare-(none)/mob, grin, groan, grumble, handshake, hug-(none)/mob, johnny, jump, laugh, look-(none)/mob, me, moan, mumble, nod, pale, point-(atom), raise, salute, scream, shake, shiver, shrug, sigh, signal-#1-10, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tremble, twitch, twitch_s, wave, whimper, wink, yawn" else ..(act) @@ -340,9 +340,7 @@ if (m_type & 1) - for (var/mob/O in viewers(src, null)) - O.show_message(message, m_type) + visible_message(message) else if (m_type & 2) - for (var/mob/O in hearers(src.loc, null)) - O.show_message(message, m_type) + audible_message(message) diff --git a/code/modules/mob/living/carbon/monkey/emote.dm b/code/modules/mob/living/carbon/monkey/emote.dm index 2b51ed70355..eef8f22fcd1 100644 --- a/code/modules/mob/living/carbon/monkey/emote.dm +++ b/code/modules/mob/living/carbon/monkey/emote.dm @@ -66,7 +66,7 @@ m_type = 1 if ("help") //Ooh ah ooh ooh this is an exception to alphabetical ooh ooh. - src << "Help for monkey emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow, choke, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, gnarl, giggle, glare-(none)/mob, grin, jump, laugh, paw, me, moan, nod, roar, roll, point-atom, scream, scratch, scretch, shake, shiver, sign-#, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tail, tremble, twitch, twitch_s, whimper, yawn" + src << "Help for monkey emotes. You can use these emotes with say \"*emote\":\n\naflap, airguitar, blink, blink_r, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, gnarl, giggle, glare-(none)/mob, grin, jump, laugh, look, me, moan, nod, paw, point-(atom), roar, roll, scream, scratch, scretch, shake, shiver, sigh, sign-#, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tail, tremble, twitch, twitch_s, wave whimper, wink, yawn" else ..(act) @@ -75,11 +75,7 @@ if(src.client) log_emote("[name]/[key] : [message]") if (m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) - //Foreach goto(703) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) - //Foreach goto(746) + audible_message(message) return diff --git a/code/modules/mob/living/carbon/slime/emote.dm b/code/modules/mob/living/carbon/slime/emote.dm index 149bec620fd..1cd72fc1596 100644 --- a/code/modules/mob/living/carbon/slime/emote.dm +++ b/code/modules/mob/living/carbon/slime/emote.dm @@ -52,11 +52,8 @@ src << "Unusable emote '[act]'. Say *help for a list." if ((message && src.stat == 0)) if (m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) - //Foreach goto(703) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) - //Foreach goto(746) + audible_message(message) + return \ No newline at end of file diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index f111b5cb5f5..0584c243799 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -252,7 +252,7 @@ m_type = 2 if ("help") - src << "Help for emotes. You can use these emotes with say \"*emote\":\n\naflap, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, giggle, glare-(none)/mob, grin, jump, laugh, look, me, nod, point-atom, scream, shake, sit, sigh, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tremble, twitch, twitch_s, wave, whimper, yawn" + src << "Help for emotes. You can use these emotes with say \"*emote\":\n\naflap, blush, bow-(none)/mob, burp, choke, chuckle, clap, collapse, cough, dance, deathgasp, drool, flap, frown, gasp, giggle, glare-(none)/mob, grin, jump, laugh, look, me, nod, point-atom, scream, shake, sigh, sit, smile, sneeze, sniff, snore, stare-(none)/mob, sulk, sway, tremble, twitch, twitch_s, wave, whimper, yawn" else src << "Unusable emote '[act]'. Say *help for a list." @@ -275,8 +275,6 @@ if (m_type & 1) - for (var/mob/O in viewers(src, null)) - O.show_message(message, m_type) + visible_message(message) else if (m_type & 2) - for (var/mob/O in hearers(src.loc, null)) - O.show_message(message, m_type) + audible_message(message) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index a344f31aaeb..c11523d239a 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -171,8 +171,7 @@ if(href_list["send"]) sradio.send_signal("ACTIVATE") - for(var/mob/O in hearers(1, src.loc)) - O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2) + audible_message("\icon[src] *beep* *beep*") if(href_list["freq"]) diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm index e5634f9708c..814a18d8be2 100644 --- a/code/modules/mob/living/silicon/robot/emote.dm +++ b/code/modules/mob/living/silicon/robot/emote.dm @@ -202,9 +202,7 @@ if ((message && src.stat == 0)) if (m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) + audible_message(message) return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 468b4178562..4a4b5250488 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -93,6 +93,42 @@ var/next_mob_id = 0 M.show_message( message, 1, blind_message, 2) + + + +// Show a message to all mobs in earshot of this one +// This would be for audible actions by the src mob +// message is the message output to anyone who can hear. +// self_message (optional) is what the src mob hears. +// blind_message (optional) is what deaf people will see. +// hearing_distance (optional) is the range, how many tiles away the message can be heard. + +/mob/audible_message(var/message, var/self_message, var/deaf_message, var/hearing_distance) + var/range = 7 + if(hearing_distance) + range = hearing_distance + for(var/mob/M in hearers(range, src)) + var/msg = message + if(self_message && M==src) + msg = self_message + M.show_message( msg, 2, deaf_message, 1) + +// Show a message to all mobs in earshot of this atom +// Use for objects performing audible actions +// message is the message output to anyone who can hear. +// blind_message (optional) is what deaf people will see. +// hearing_distance (optional) is the range, how many tiles away the message can be heard. + +/atom/proc/audible_message(var/message, var/deaf_message, var/hearing_distance) + var/range = 7 + if(hearing_distance) + range = hearing_distance + for(var/mob/M in hearers(range, src)) + M.show_message( message, 2, deaf_message, 1) + + + + /mob/proc/movement_delay() return 0 diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index e63754012bd..48ee0ec6299 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -582,7 +582,7 @@ return if (src.loc) for (var/mob/M in hearers(src.loc.loc)) - M << "CLONG, clong!" + M.show_message("CLONG, clong!", 2) playsound(src.loc, 'sound/effects/clang.ogg', 50, 0, 0)