From c67ed25b85b48ca1c2b77c7427091d98668fcc05 Mon Sep 17 00:00:00 2001 From: RavingManiac Date: Sat, 16 May 2015 16:01:41 +1000 Subject: [PATCH] visible_message() now affects objects. Holopads, pAIs, AI cards people in mecha should hence be able to see them Tape recorders record hearable emotes and action messages Human and robot emotes now use custom_emote() --- code/game/machinery/hologram.dm | 6 + code/game/mecha/mecha.dm | 6 + code/game/objects/items/devices/aicard.dm | 7 + code/game/objects/items/devices/paicard.dm | 6 + .../objects/items/devices/taperecorder.dm | 29 ++- .../objects/items/weapons/storage/storage.dm | 16 +- code/game/objects/objs.dm | 3 + .../structures/crates_lockers/closets.dm | 20 +- code/modules/clothing/suits/storage.dm | 8 + .../clothing/under/accessories/storage.dm | 8 + code/modules/mob/holder.dm | 4 +- code/modules/mob/living/carbon/human/emote.dm | 210 ++++++++---------- .../modules/mob/living/silicon/robot/emote.dm | 56 +++-- code/modules/mob/mob.dm | 61 ++++- 14 files changed, 285 insertions(+), 155 deletions(-) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 28bb2be7bc..424971cc71 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -113,6 +113,12 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ master.show_message(rendered, 2) return +/obj/machinery/hologram/holopad/show_message(msg, type, alt, alt_type) + for(var/mob/living/silicon/ai/master in masters) + var/rendered = "Holopad received, [msg]" + master.show_message(rendered, type) + return + /obj/machinery/hologram/holopad/proc/create_holo(mob/living/silicon/ai/A, turf/T = loc) var/obj/effect/overlay/hologram = new(T)//Spawn a blank effect at the location. hologram.icon = A.holo_icon diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index b52f98827a..0f8d666de9 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -258,6 +258,12 @@ occupant.show_message(rendered, 2) ..() +/obj/mecha/show_message(msg, type, alt, alt_type) + if(occupant && occupant.client) + var/rendered = "[msg]" + occupant.show_message(rendered, type) + ..() + //////////////////////////// ///// Action processing //// //////////////////////////// diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index 5e2ab73155..e5a8129ebf 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -160,6 +160,13 @@ var/rendered = "[text]" carded_ai.show_message(rendered, 2) ..() + +/obj/item/device/aicard/show_message(msg, type, alt, alt_type) + if(carded_ai && carded_ai.client) + var/rendered = "[msg]" + carded_ai.show_message(rendered, type) + ..() + /* /obj/item/device/aicard/relaymove(var/mob/user, var/direction) if(src.loc && istype(src.loc.loc, /obj/item/rig_module)) diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index eed6cdb12e..d2d06d6891 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -323,4 +323,10 @@ if(pai && pai.client) var/rendered = "[text]" pai.show_message(rendered, 2) + ..() + +/obj/item/device/paicard/show_message(msg, type, alt, alt_type) + if(pai && pai.client) + var/rendered = "[msg]" + pai.show_message(rendered, type) ..() \ No newline at end of file diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index 35d04e4d08..d6fda94bcd 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -29,6 +29,25 @@ else storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] [M.name] [verb], \"[msg]\"" +/obj/item/device/taperecorder/see_emote(mob/M as mob, text, var/emote_type) + if(emote_type != 2) //only hearable emotes + return + if(recording) + timestamp += timerecorded + storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] [strip_html_properly(text)]" + +/obj/item/device/taperecorder/show_message(msg, type, alt, alt_type) + var/recordedtext + if (msg && type == 2) //must be hearable + recordedtext = msg + else if (alt && alt_type == 2) + recordedtext = alt + else + return + if(recording) + timestamp += timerecorded + storedinfo += "*\[[time2text(timerecorded*10,"mm:ss")]\] *[strip_html_properly(recordedtext)]*" //"*" at front as a marker + /obj/item/device/taperecorder/attackby(obj/item/weapon/W as obj, mob/user as mob) ..() if(istype(W, /obj/item/weapon/card/emag)) @@ -146,7 +165,10 @@ if(storedinfo.len < i) break var/turf/T = get_turf(src) - T.visible_message("Tape Recorder: [storedinfo[i]]") + var/playedmessage = storedinfo[i] + if (findtextEx(playedmessage,"*",1,2)) //remove marker for action sounds + playedmessage = copytext(playedmessage,2) + T.visible_message("Tape Recorder: [playedmessage]") if(storedinfo.len < i+1) playsleepseconds = 1 sleep(10) @@ -200,7 +222,10 @@ var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(get_turf(src)) var/t1 = "Transcript:

" for(var/i=1,storedinfo.len >= i,i++) - t1 += "[storedinfo[i]]
" + var/printedmessage = storedinfo[i] + if (findtextEx(printedmessage,"*",1,2)) //replace action sounds + printedmessage = "\[[time2text(timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)" + t1 += "[printedmessage]
" P.info = t1 P.name = "Transcript" canprint = 0 diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 61786e10db..ee2138d0a2 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -51,10 +51,10 @@ //there's got to be a better way of doing this. if (!(src.loc == usr) || (src.loc && src.loc.loc == usr)) return - + if (( usr.restrained() ) || ( usr.stat )) return - + if ((src.loc == usr) && !usr.unEquip(src)) return @@ -450,6 +450,18 @@ var/obj/O = A O.hear_talk(M, text, verb, speaking) +/obj/item/weapon/storage/see_emote(mob/M as mob, text, var/emote_type) + for (var/atom/A in src) + if(istype(A,/obj/)) + var/obj/O = A + O.see_emote(M, text, emote_type) + +/obj/item/weapon/storage/show_message(msg, type, alt, alt_type) + for (var/atom/A in src) + if(istype(A,/obj/)) + var/obj/O = A + O.show_message(msg, type, alt, alt_type) + //Returns the storage depth of an atom. This is the number of storage items the atom is contained in before reaching toplevel (the area). //Returns -1 if the atom was not found on container. /atom/proc/storage_depth(atom/container) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index fc6ef5b99d..960eab6712 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -141,3 +141,6 @@ /obj/proc/see_emote(mob/M as mob, text, var/emote_type) return + +/obj/proc/show_message(msg, type, alt, alt_type) + return \ No newline at end of file diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5e1a551cec..e941495747 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -302,6 +302,18 @@ var/obj/O = A O.hear_talk(M, text, verb, speaking) +/obj/structure/closet/see_emote(mob/M as mob, text, var/emote_type) + for (var/atom/A in src) + if(istype(A,/obj/)) + var/obj/O = A + O.see_emote(M, text, emote_type) + +/obj/structure/closet/show_message(msg, type, alt, alt_type) + for (var/atom/A in src) + if(istype(A,/obj/)) + var/obj/O = A + O.show_message(msg, type, alt, alt_type) + /obj/structure/closet/attack_generic(var/mob/user, var/damage, var/attack_message = "destroys", var/wallbreaker) if(!damage || !wallbreaker) return @@ -329,25 +341,25 @@ escapee.next_move = world.time + 100 escapee.last_special = world.time + 100 escapee << "You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)" - + visible_message("The [src] begins to shake violently!") breakout = 1 //can't think of a better way to do this right now. for(var/i in 1 to (6*breakout_time * 2)) //minutes * 6 * 5seconds * 2 playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1) animate_shake() - + if(!do_after(escapee, 50)) //5 seconds breakout = 0 return - if(!escapee || escapee.stat || escapee.loc != src) + if(!escapee || escapee.stat || escapee.loc != src) breakout = 0 return //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened //Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'... if(!req_breakout()) breakout = 0 return - + //Well then break it! breakout = 0 escapee << "You successfully break out!" diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm index 221a8dbd29..8348e76ec9 100644 --- a/code/modules/clothing/suits/storage.dm +++ b/code/modules/clothing/suits/storage.dm @@ -33,6 +33,14 @@ pockets.hear_talk(M, msg, verb, speaking) ..() +/obj/item/clothing/suit/storage/see_emote(mob/M as mob, text, var/emote_type) + pockets.see_emote(M, text, emote_type) + ..() + +/obj/item/clothing/suit/storage/show_message(msg, type, alt, alt_type) + pockets.show_message(msg, type, alt, alt_type) + ..() + //Jackets with buttons, used for labcoats, IA jackets, First Responder jackets, and brown jackets. /obj/item/clothing/suit/storage/toggle var/icon_open diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm index 7f13449d16..4b9f4410b1 100644 --- a/code/modules/clothing/under/accessories/storage.dm +++ b/code/modules/clothing/under/accessories/storage.dm @@ -38,6 +38,14 @@ hold.hear_talk(M, msg, verb, speaking) ..() +/obj/item/clothing/accessory/storage/see_emote(mob/M as mob, text, var/emote_type) + hold.see_emote(M, text, emote_type) + ..() + +/obj/item/clothing/accessory/storage/show_message(msg, type, alt, alt_type) + hold.show_message(msg, type, alt, alt_type) + ..() + /obj/item/clothing/accessory/storage/attack_self(mob/user as mob) user << "You empty [src]." var/turf/T = get_turf(src) diff --git a/code/modules/mob/holder.dm b/code/modules/mob/holder.dm index 6347a091f4..61e5b3c637 100644 --- a/code/modules/mob/holder.dm +++ b/code/modules/mob/holder.dm @@ -32,9 +32,9 @@ for(var/mob/M in src.contents) M.attackby(W,user) -/obj/item/weapon/holder/proc/show_message(var/message, var/m_type) +/obj/item/weapon/holder/show_message(msg, type, alt, alt_type) for(var/mob/living/M in contents) - M.show_message(message,m_type) + M.show_message(msg,type) //Mob procs and vars for scooping up /mob/living/var/holder_type diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 8d7c655730..364d6228a7 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -21,15 +21,15 @@ switch(act) if ("airguitar") if (!src.restrained()) - message = "[src] is strumming the air and headbanging like a safari chimp." + message = "is strumming the air and headbanging like a safari chimp." m_type = 1 if ("blink") - message = "[src] blinks." + message = "blinks." m_type = 1 if ("blink_r") - message = "[src] blinks rapidly." + message = "blinks rapidly." m_type = 1 if ("bow") @@ -44,9 +44,9 @@ param = null if (param) - message = "[src] bows to [param]." + message = "bows to [param]." else - message = "[src] bows." + message = "bows." m_type = 1 if ("custom") @@ -94,73 +94,73 @@ param = null if (param) - message = "[src] salutes to [param]." + message = "salutes to [param]." else - message = "[src] salutes." + message = "salutes." m_type = 1 if ("choke") if(miming) - message = "[src] clutches his throat desperately!" + message = "clutches his throat desperately!" m_type = 1 else if (!muzzled) - message = "[src] chokes!" + message = "chokes!" m_type = 2 else - message = "[src] makes a strong noise." + message = "makes a strong noise." m_type = 2 if ("clap") if (!src.restrained()) - message = "[src] claps." + message = "claps." m_type = 2 if(miming) m_type = 1 if ("flap") if (!src.restrained()) - message = "[src] flaps \his wings." + message = "flaps [get_visible_gender() == MALE ? "his" : get_visible_gender() == FEMALE ? "her" : "their"] wings." m_type = 2 if(miming) m_type = 1 if ("aflap") if (!src.restrained()) - message = "[src] flaps \his wings ANGRILY!" + message = "flaps [get_visible_gender() == MALE ? "his" : get_visible_gender() == FEMALE ? "her" : "their"] wings ANGRILY!" m_type = 2 if(miming) m_type = 1 if ("drool") - message = "[src] drools." + message = "drools." m_type = 1 if ("eyebrow") - message = "[src] raises an eyebrow." + message = "raises an eyebrow." m_type = 1 if ("chuckle") if(miming) - message = "[src] appears to chuckle." + message = "appears to chuckle." m_type = 1 else if (!muzzled) - message = "[src] chuckles." + message = "chuckles." m_type = 2 else - message = "[src] makes a noise." + message = "makes a noise." m_type = 2 if ("twitch") - message = "[src] twitches violently." + message = "twitches violently." m_type = 1 if ("twitch_s") - message = "[src] twitches." + message = "twitches." m_type = 1 if ("faint") - message = "[src] faints." + message = "faints." if(src.sleeping) return //Can't faint while asleep src.sleeping += 10 //Short-short nap @@ -168,58 +168,58 @@ if ("cough") if(miming) - message = "[src] appears to cough!" + message = "appears to cough!" m_type = 1 else if (!muzzled) - message = "[src] coughs!" + message = "coughs!" m_type = 2 else - message = "[src] makes a strong noise." + message = "makes a strong noise." m_type = 2 if ("frown") - message = "[src] frowns." + message = "frowns." m_type = 1 if ("nod") - message = "[src] nods." + message = "nods." m_type = 1 if ("blush") - message = "[src] blushes." + message = "blushes." m_type = 1 if ("wave") - message = "[src] waves." + message = "waves." m_type = 1 if ("gasp") if(miming) - message = "[src] appears to be gasping!" + message = "appears to be gasping!" m_type = 1 else if (!muzzled) - message = "[src] gasps!" + message = "gasps!" m_type = 2 else - message = "[src] makes a weak noise." + message = "makes a weak noise." m_type = 2 if ("deathgasp") - message = "[src] [species.death_message]" + message = "[species.death_message]" m_type = 1 if ("giggle") if(miming) - message = "[src] giggles silently!" + message = "giggles silently!" m_type = 1 else if (!muzzled) - message = "[src] giggles." + message = "giggles." m_type = 2 else - message = "[src] makes a noise." + message = "makes a noise." m_type = 2 if ("glare") @@ -233,9 +233,9 @@ param = null if (param) - message = "[src] glares at [param]." + message = "glares at [param]." else - message = "[src] glares." + message = "glares." if ("stare") var/M = null @@ -248,9 +248,9 @@ param = null if (param) - message = "[src] stares at [param]." + message = "stares at [param]." else - message = "[src] stares." + message = "stares." if ("look") var/M = null @@ -264,86 +264,86 @@ param = null if (param) - message = "[src] looks at [param]." + message = "looks at [param]." else - message = "[src] looks." + message = "looks." m_type = 1 if ("grin") - message = "[src] grins." + message = "grins." m_type = 1 if ("cry") if(miming) - message = "[src] cries." + message = "cries." m_type = 1 else if (!muzzled) - message = "[src] cries." + message = "cries." m_type = 2 else - message = "[src] makes a weak noise. \He frowns." + message = "makes a weak noise. [get_visible_gender() == MALE ? "He" : get_visible_gender() == FEMALE ? "She" : "They"] [get_visible_gender() == NEUTER ? "frown" : "frowns"]." m_type = 2 if ("sigh") if(miming) - message = "[src] sighs." + message = "sighs." m_type = 1 else if (!muzzled) - message = "[src] sighs." + message = "sighs." m_type = 2 else - message = "[src] makes a weak noise." + message = "makes a weak noise." m_type = 2 if ("laugh") if(miming) - message = "[src] acts out a laugh." + message = "acts out a laugh." m_type = 1 else if (!muzzled) - message = "[src] laughs." + message = "laughs." m_type = 2 else - message = "[src] makes a noise." + message = "makes a noise." m_type = 2 if ("mumble") - message = "[src] mumbles!" + message = "mumbles!" m_type = 2 if(miming) m_type = 1 if ("grumble") if(miming) - message = "[src] grumbles!" + message = "grumbles!" m_type = 1 if (!muzzled) - message = "[src] grumbles!" + message = "grumbles!" m_type = 2 else - message = "[src] makes a noise." + message = "makes a noise." m_type = 2 if ("groan") if(miming) - message = "[src] appears to groan!" + message = "appears to groan!" m_type = 1 else if (!muzzled) - message = "[src] groans!" + message = "groans!" m_type = 2 else - message = "[src] makes a loud noise." + message = "makes a loud noise." m_type = 2 if ("moan") if(miming) - message = "[src] appears to moan!" + message = "appears to moan!" m_type = 1 else - message = "[src] moans!" + message = "moans!" m_type = 2 if ("johnny") @@ -354,10 +354,10 @@ param = null else if(miming) - message = "[src] takes a drag from a cigarette and blows \"[M]\" out in smoke." + message = "takes a drag from a cigarette and blows \"[M]\" out in smoke." m_type = 1 else - message = "[src] says, \"[M], please. He had a family.\" [src.name] takes a drag from a cigarette and blows his name out in smoke." + message = "says, \"[M], please. He had a family.\" [src.name] takes a drag from a cigarette and blows his name out in smoke." m_type = 2 if ("point") @@ -370,26 +370,26 @@ break if (!M) - message = "[src] points." + message = "points." else pointed(M) if (M) - message = "[src] points to [M]." + message = "points to [M]." else m_type = 1 if ("raise") if (!src.restrained()) - message = "[src] raises a hand." + message = "raises a hand." m_type = 1 if("shake") - message = "[src] shakes \his head." + message = "shakes [get_visible_gender() == MALE ? "his" : get_visible_gender() == FEMALE ? "her" : "their"] head." m_type = 1 if ("shrug") - message = "[src] shrugs." + message = "shrugs." m_type = 1 if ("signal") @@ -397,85 +397,85 @@ var/t1 = round(text2num(param)) if (isnum(t1)) if (t1 <= 5 && (!src.r_hand || !src.l_hand)) - message = "[src] raises [t1] finger\s." + message = "raises [t1] finger\s." else if (t1 <= 10 && (!src.r_hand && !src.l_hand)) - message = "[src] raises [t1] finger\s." + message = "raises [t1] finger\s." m_type = 1 if ("smile") - message = "[src] smiles." + message = "smiles." m_type = 1 if ("shiver") - message = "[src] shivers." + message = "shivers." m_type = 2 if(miming) m_type = 1 if ("pale") - message = "[src] goes pale for a second." + message = "goes pale for a second." m_type = 1 if ("tremble") - message = "[src] trembles in fear!" + message = "trembles in fear!" m_type = 1 if ("sneeze") if (miming) - message = "[src] sneezes." + message = "sneezes." m_type = 1 else if (!muzzled) - message = "[src] sneezes." + message = "sneezes." m_type = 2 else - message = "[src] makes a strange noise." + message = "makes a strange noise." m_type = 2 if ("sniff") - message = "[src] sniffs." + message = "sniffs." m_type = 2 if(miming) m_type = 1 if ("snore") if (miming) - message = "[src] sleeps soundly." + message = "sleeps soundly." m_type = 1 else if (!muzzled) - message = "[src] snores." + message = "snores." m_type = 2 else - message = "[src] makes a noise." + message = "makes a noise." m_type = 2 if ("whimper") if (miming) - message = "[src] appears hurt." + message = "appears hurt." m_type = 1 else if (!muzzled) - message = "[src] whimpers." + message = "whimpers." m_type = 2 else - message = "[src] makes a weak noise." + message = "makes a weak noise." m_type = 2 if ("wink") - message = "[src] winks." + message = "winks." m_type = 1 if ("yawn") if (!muzzled) - message = "[src] yawns." + message = "yawns." m_type = 2 if(miming) m_type = 1 if ("collapse") Paralyse(2) - message = "[src] collapses!" + message = "collapses!" m_type = 2 if(miming) m_type = 1 @@ -493,9 +493,9 @@ M = null if (M) - message = "[src] hugs [M]." + message = "hugs [M]." else - message = "[src] hugs \himself." + message = "hugs [get_visible_gender() == MALE ? "himself" : get_visible_gender() == FEMALE ? "herself" : "themselves"]." if ("handshake") m_type = 1 @@ -511,9 +511,9 @@ if (M) if (M.canmove && !M.r_hand && !M.restrained()) - message = "[src] shakes hands with [M]." + message = "shakes hands with [M]." else - message = "[src] holds out \his hand to [M]." + message = "holds out [get_visible_gender() == MALE ? "his" : get_visible_gender() == FEMALE ? "her" : "their"] hand to [M]." if("dap") m_type = 1 @@ -525,20 +525,20 @@ M = A break if (M) - message = "[src] gives daps to [M]." + message = "gives daps to [M]." else - message = "[src] sadly can't find anybody to give daps to, and daps \himself. Shameful." + message = "sadly can't find anybody to give daps to, and daps [get_visible_gender() == MALE ? "himself" : get_visible_gender() == FEMALE ? "herself" : "themselves"]. Shameful." if ("scream") if (miming) - message = "[src] acts out a scream!" + message = "acts out a scream!" m_type = 1 else if (!muzzled) - message = "[src] screams!" + message = "screams!" m_type = 2 else - message = "[src] makes a very loud noise." + message = "makes a very loud noise." m_type = 2 if ("help") @@ -553,23 +553,7 @@ if (message) log_emote("[name]/[key] : [message]") - - //Hearing gasp and such every five seconds is not good emotes were not global for a reason. - // Maybe some people are okay with that. - - for(var/mob/M in dead_mob_list) - if(!M.client || istype(M, /mob/new_player)) - continue //skip monkeys, leavers and new players - if(M.stat == DEAD && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null))) - M.show_message(message) - - - if (m_type & 1) - for (var/mob/O in get_mobs_in_view(world.view,src)) - O.show_message(message, m_type) - else if (m_type & 2) - for (var/mob/O in (hearers(src.loc, null) | get_mobs_in_view(world.view,src))) - O.show_message(message, m_type) + custom_emote(m_type,message) /mob/living/carbon/human/verb/pose() @@ -577,7 +561,7 @@ set desc = "Sets a description which will be shown when someone examines you." set category = "IC" - pose = sanitize(input(usr, "This is [src]. \He is...", "Pose", null) as text) + pose = sanitize(input(usr, "This is [src]. [get_visible_gender() == MALE ? "He" : get_visible_gender() == FEMALE ? "She" : "They"] [get_visible_gender() == NEUTER ? "are" : "is"]...", "Pose", null) as text) /mob/living/carbon/human/verb/set_flavor() set name = "Set Flavour Text" diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm index 6bf18971ba..34df63d397 100644 --- a/code/modules/mob/living/silicon/robot/emote.dm +++ b/code/modules/mob/living/silicon/robot/emote.dm @@ -38,9 +38,9 @@ param = null if (param) - message = "[src] salutes to [param]." + message = "salutes to [param]." else - message = "[src] salutes." + message = "salutes." m_type = 1 if ("bow") if (!src.buckled) @@ -54,39 +54,39 @@ param = null if (param) - message = "[src] bows to [param]." + message = "bows to [param]." else - message = "[src] bows." + message = "bows." m_type = 1 if ("clap") if (!src.restrained()) - message = "[src] claps." + message = "claps." m_type = 2 if ("flap") if (!src.restrained()) - message = "[src] flaps his wings." + message = "flaps his wings." m_type = 2 if ("aflap") if (!src.restrained()) - message = "[src] flaps his wings ANGRILY!" + message = "flaps his wings ANGRILY!" m_type = 2 if ("twitch") - message = "[src] twitches violently." + message = "twitches violently." m_type = 1 if ("twitch_s") - message = "[src] twitches." + message = "twitches." m_type = 1 if ("nod") - message = "[src] nods." + message = "nods." m_type = 1 if ("deathgasp") - message = "[src] shudders violently for a moment, then becomes motionless, its eyes slowly darkening." + message = "shudders violently for a moment, then becomes motionless, its eyes slowly darkening." m_type = 1 if ("glare") @@ -100,9 +100,9 @@ param = null if (param) - message = "[src] glares at [param]." + message = "glares at [param]." else - message = "[src] glares." + message = "glares." if ("stare") var/M = null @@ -115,9 +115,9 @@ param = null if (param) - message = "[src] stares at [param]." + message = "stares at [param]." else - message = "[src] stares." + message = "stares." if ("look") var/M = null @@ -131,9 +131,9 @@ param = null if (param) - message = "[src] looks at [param]." + message = "looks at [param]." else - message = "[src] looks." + message = "looks." m_type = 1 if("beep") @@ -147,9 +147,9 @@ param = null if (param) - message = "[src] beeps at [param]." + message = "beeps at [param]." else - message = "[src] beeps." + message = "beeps." playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0) m_type = 1 @@ -164,9 +164,9 @@ param = null if (param) - message = "[src] pings at [param]." + message = "pings at [param]." else - message = "[src] pings." + message = "pings." playsound(src.loc, 'sound/machines/ping.ogg', 50, 0) m_type = 1 @@ -181,15 +181,15 @@ param = null if (param) - message = "[src] buzzes at [param]." + message = "buzzes at [param]." else - message = "[src] buzzes." + message = "buzzes." playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0) m_type = 1 if("law") if (istype(module,/obj/item/weapon/robot_module/security)) - message = "[src] shows its legal authorization barcode." + message = "shows its legal authorization barcode." playsound(src.loc, 'sound/voice/biamthelaw.ogg', 50, 0) m_type = 2 @@ -211,10 +211,6 @@ src << "\blue 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) - else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) + custom_emote(m_type,message) + return \ No newline at end of file diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e9cae30755..a983d649d8 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -51,6 +51,37 @@ // blind_message (optional) is what blind people will hear e.g. "You hear something!" /mob/visible_message(var/message, var/self_message, var/blind_message) + + var/list/seeing_obj = list() + + for(var/I in view(world.view, get_turf(usr))) //get_turf is needed to stop weirdness with x-ray. + if(istype(I, /mob/)) + var/mob/M = I + for(var/obj/O in M.contents) + seeing_obj |= O + else if(istype(I, /obj/)) + var/obj/O = I + seeing_obj |= O + + for (var/mob/O in viewers(get_turf(src), null)) + if(O.see_invisible < invisibility) + continue // Cannot view the invisible + var/msg = message + if(O.status_flags & PASSEMOTES) + for(var/obj/item/weapon/holder/H in O.contents) + H.show_message( msg, 1, blind_message, 2) + for(var/mob/living/M in O.contents) + M.show_message( msg, 1, blind_message, 2) + if(self_message && O==src) + msg = self_message + O.show_message( msg, 1, blind_message, 2) + + for(var/obj/O in seeing_obj) + spawn(0) + if(O) //It's possible that it could be deleted in the meantime. + O.show_message( message, 1, blind_message, 2) + + /* for(var/mob/M in viewers(src)) if(M.see_invisible < invisibility) continue // Cannot view the invisible @@ -58,14 +89,40 @@ if(self_message && M==src) msg = self_message M.show_message( msg, 1, blind_message, 2) + */ // Show a message to all mobs in sight of this atom // Use for objects performing visible actions // message is output to anyone who can see, e.g. "The [src] does something!" // blind_message (optional) is what blind people will hear e.g. "You hear something!" /atom/proc/visible_message(var/message, var/blind_message) - for(var/mob/M in viewers(src)) - M.show_message( message, 1, blind_message, 2) + + var/list/seeing_obj = list() + + for(var/I in view(world.view, get_turf(src))) //get_turf is needed to stop weirdness with x-ray. + if(istype(I, /mob/)) + var/mob/M = I + for(var/obj/O in M.contents) + seeing_obj |= O + else if(istype(I, /obj/)) + var/obj/O = I + seeing_obj |= O + + for (var/mob/O in viewers(get_turf(src), null)) + if(O.see_invisible < invisibility) + continue // Cannot view the invisible + var/msg = message + if(O.status_flags & PASSEMOTES) + for(var/obj/item/weapon/holder/H in O.contents) + H.show_message( msg, 1, blind_message, 2) + for(var/mob/living/M in O.contents) + M.show_message( msg, 1, blind_message, 2) + O.show_message( msg, 1, blind_message, 2) + + for(var/obj/O in seeing_obj) + spawn(0) + if(O) //It's possible that it could be deleted in the meantime. + O.show_message( message, 1, blind_message, 2) // Returns an amount of power drawn from the object (-1 if it's not viable). // If drain_check is set it will not actually drain power, just return a value.