Merge pull request #9293 from RavingManiac/dev

Emote, say() and visible_message() refactor, tape recorder upgrade
This commit is contained in:
Chinsky
2015-05-25 20:53:04 +03:00
21 changed files with 338 additions and 310 deletions

View File

@@ -156,37 +156,35 @@
// It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects,
// being unable to hear people due to being in a box within a bag.
/proc/recursive_mob_check(var/atom/O, var/list/L = list(), var/recursion_limit = 3, var/client_check = 1, var/sight_check = 1, var/include_radio = 1)
/proc/recursive_content_check(var/atom/O, var/list/L = list(), var/recursion_limit = 3, var/client_check = 1, var/sight_check = 1, var/include_mobs = 1, var/include_objects = 1)
//debug_mob += O.contents.len
if(!recursion_limit)
return L
for(var/atom/A in O.contents)
if(ismob(A))
var/mob/M = A
if(client_check && !M.client)
L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio)
continue
if(sight_check && !isInSight(A, O))
continue
L |= M
//world.log << "[recursion_limit] = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])"
for(var/I in O.contents)
else if(include_radio && istype(A, /obj/item/device/radio))
if(sight_check && !isInSight(A, O))
continue
L |= A
if(ismob(I))
if(!sight_check || isInSight(I, O))
L |= recursive_content_check(I, L, recursion_limit - 1, client_check, sight_check, include_mobs, include_objects)
if(include_mobs)
if(client_check)
var/mob/M = I
if(M.client)
L |= M
else
L |= I
else if(istype(I,/obj/))
if(!sight_check || isInSight(I, O))
L |= recursive_content_check(I, L, recursion_limit - 1, client_check, sight_check, include_mobs, include_objects)
if(include_objects)
L |= I
if(isobj(A) || ismob(A))
L |= recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio)
return L
// The old system would loop through lists for a total of 5000 per function call, in an empty server.
// This new system will loop at around 1000 in an empty server.
// Returns a list of mobs and/or objects in range of R from source. Used in radio and say code.
/proc/get_mobs_in_view(var/R, var/atom/source)
// Returns a list of mobs in range of R from source. Used in radio and say code.
/proc/get_mobs_or_objects_in_view(var/R, var/atom/source, var/include_mobs = 1, var/include_objects = 1)
var/turf/T = get_turf(source)
var/list/hear = list()
@@ -196,17 +194,17 @@
var/list/range = hear(R, T)
for(var/atom/A in range)
if(ismob(A))
var/mob/M = A
if(M.client)
hear += M
//world.log << "Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])"
else if(istype(A, /obj/item/device/radio))
hear += A
if(isobj(A) || ismob(A))
hear |= recursive_mob_check(A, hear, 3, 1, 0, 1)
for(var/I in range)
if(ismob(I))
hear |= recursive_content_check(I, hear, 3, 1, 0, include_mobs, include_objects)
if(include_mobs)
var/mob/M = I
if(M.client)
hear += M
else if(istype(I,/obj/))
hear |= recursive_content_check(I, hear, 3, 1, 0, include_mobs, include_objects)
if(include_objects)
hear += I
return hear

View File

@@ -459,3 +459,46 @@ its easier to just keep the beam vertical.
return 1
else
return 0
// Show a message to all mobs and objects 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)
var/list/see = get_mobs_or_objects_in_view(world.view,src) | viewers(get_turf(src), null)
for(var/I in see)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.show_message( message, 1, blind_message, 2)
else if(ismob(I))
var/mob/M = I
if(M.see_invisible >= invisibility) // Cannot view the invisible
M.show_message( message, 1, blind_message, 2)
else if (blind_message)
M.show_message(blind_message, 2)
// Show a message to all mobs and objects in earshot of this atom
// Use for objects performing audible actions
// message is the message output to anyone who can hear.
// deaf_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 = world.view
if(hearing_distance)
range = hearing_distance
var/list/hear = get_mobs_or_objects_in_view(range,src)
for(var/I in hear)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.show_message( message, 2, deaf_message, 1)
else if(ismob(I))
var/mob/M = I
M.show_message( message, 2, deaf_message, 1)

View File

@@ -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 = "<i><span class='game say'>Holopad received, <span class='message'>[msg]</span></span></i>"
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

View File

@@ -252,12 +252,6 @@
radio.talk_into(M, text)
return
/obj/mecha/see_emote(mob/living/M, text)
if(occupant && occupant.client)
var/rendered = "<span class='message'>[text]</span>"
occupant.show_message(rendered, 2)
..()
////////////////////////////
///// Action processing ////
////////////////////////////

View File

@@ -160,6 +160,13 @@
var/rendered = "<span class='message'>[text]</span>"
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 = "<span class='message'>[msg]</span>"
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))

View File

@@ -323,4 +323,10 @@
if(pai && pai.client)
var/rendered = "<span class='message'>[text]</span>"
pai.show_message(rendered, 2)
..()
/obj/item/device/paicard/show_message(msg, type, alt, alt_type)
if(pai && pai.client)
var/rendered = "<span class='message'>[msg]</span>"
pai.show_message(rendered, type)
..()

View File

@@ -456,7 +456,7 @@
var/range = receive_range(freq, level)
if(range > -1)
return get_mobs_in_view(canhear_range, src)
return get_mobs_or_objects_in_view(canhear_range, src)
/obj/item/device/radio/examine(mob/user)

View File

@@ -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))
@@ -97,7 +116,7 @@
else if(playing == 1)
playing = 0
var/turf/T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
icon_state = "taperecorderidle"
return
@@ -146,37 +165,40 @@
if(storedinfo.len < i)
break
var/turf/T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: [storedinfo[i]]</font>")
var/playedmessage = storedinfo[i]
if (findtextEx(playedmessage,"*",1,2)) //remove marker for action sounds
playedmessage = copytext(playedmessage,2)
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: [playedmessage]</font>")
if(storedinfo.len < i+1)
playsleepseconds = 1
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: End of recording.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: End of recording.</font>")
else
playsleepseconds = timestamp[i+1] - timestamp[i]
if(playsleepseconds > 14)
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Skipping [playsleepseconds] seconds of silence</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Skipping [playsleepseconds] seconds of silence</font>")
playsleepseconds = 1
i++
icon_state = "taperecorderidle"
playing = 0
if(emagged == 1.0)
var/turf/T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: This tape recorder will self-destruct in... Five.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: This tape recorder will self-destruct in... Five.</font>")
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Four.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Four.</font>")
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Three.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Three.</font>")
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Two.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Two.</font>")
sleep(10)
T = get_turf(src)
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: One.</font>")
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: One.</font>")
sleep(10)
explode()
@@ -200,7 +222,10 @@
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(get_turf(src))
var/t1 = "<B>Transcript:</B><BR><BR>"
for(var/i=1,storedinfo.len >= i,i++)
t1 += "[storedinfo[i]]<BR>"
var/printedmessage = storedinfo[i]
if (findtextEx(printedmessage,"*",1,2)) //replace action sounds
printedmessage = "\[[time2text(timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)"
t1 += "[printedmessage]<BR>"
P.info = t1
P.name = "Transcript"
canprint = 0

View File

@@ -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
@@ -444,12 +444,6 @@
src.quick_empty()
return 1
/obj/item/weapon/storage/hear_talk(mob/M as mob, text, verb, datum/language/speaking)
for (var/atom/A in src)
if(istype(A,/obj/))
var/obj/O = A
O.hear_talk(M, text, verb, speaking)
//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)

View File

@@ -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)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
return

View File

@@ -326,12 +326,6 @@
else
icon_state = icon_opened
/obj/structure/closet/hear_talk(mob/M as mob, text, verb, datum/language/speaking)
for (var/atom/A in src)
if(istype(A,/obj/))
var/obj/O = A
O.hear_talk(M, text, verb, speaking)
/obj/structure/closet/attack_generic(var/mob/user, var/damage, var/attack_message = "destroys", var/wallbreaker)
if(!damage || !wallbreaker)
return

View File

@@ -105,7 +105,7 @@
log_ooc("(LOCAL) [mob.name]/[key] : [msg]")
var/mob/source = src.mob
var/list/heard = get_mobs_in_view(7, source)
var/list/heard = get_mobs_or_objects_in_view(7, source, 1, 0)
var/display_name = source.key
if(holder && holder.fakekey)

View File

@@ -29,10 +29,6 @@
pockets.emp_act(severity)
..()
/obj/item/clothing/suit/storage/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
pockets.hear_talk(M, msg, verb, speaking)
..()
//Jackets with buttons, used for labcoats, IA jackets, First Responder jackets, and brown jackets.
/obj/item/clothing/suit/storage/toggle
var/icon_open

View File

@@ -34,10 +34,6 @@
hold.emp_act(severity)
..()
/obj/item/clothing/accessory/storage/hear_talk(mob/M, var/msg, verb, datum/language/speaking)
hold.hear_talk(M, msg, verb, speaking)
..()
/obj/item/clothing/accessory/storage/attack_self(mob/user as mob)
user << "<span class='notice'>You empty [src].</span>"
var/turf/T = get_turf(src)

View File

@@ -24,8 +24,6 @@
if (message)
log_emote("[name]/[key] : [message]")
var/list/seeing_obj = list() //For objs that need to see emotes. You can use see_emote(), which is based off of hear_talk()
//Hearing gasp and such every five seconds is not good emotes were not global for a reason.
// Maybe some people are okay with that.
@@ -37,58 +35,31 @@
if(findtext(message," snores.")) //Because we have so many sleeping people.
break
if(M.stat == 2 && (M.client.prefs.toggles & CHAT_GHOSTSIGHT) && !(M in viewers(src,null)))
M.show_message(message)
M.show_message(message, m_type)
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
// Type 1 (Visual) emotes are sent to anyone in view of the item
if (m_type & 1)
//for (var/mob/O in viewers(src, null))
for (var/mob/O in viewers(get_turf(src), null)) //This may break people with x-ray being able to see emotes across walls,
//but this saves many headaches down the road, involving mechs and pAIs.
//x-ray is so rare these days anyways.
var/list/see = get_mobs_or_objects_in_view(world.view,src) | viewers(get_turf(src), null)
for(var/I in see)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.see_emote(src, message, 1)
else if(ismob(I))
var/mob/M = I
M.show_message(message, 1)
if(O.status_flags & PASSEMOTES)
for(var/obj/item/weapon/holder/H in O.contents)
H.show_message(message, m_type)
for(var/mob/living/M in O.contents)
M.show_message(message, m_type)
O.show_message(message, m_type)
for(var/obj/O in seeing_obj)
spawn(0)
if(O) //It's possible that it could be deleted in the meantime.
O.see_emote(src, message, 1)
// Type 2 (Audible) emotes are sent to anyone in hear range
// of the *LOCATION* -- this is important for AIs/pAIs to be heard
else if (m_type & 2)
for (var/mob/O in hearers(get_turf(src), null))
if(O.status_flags & PASSEMOTES)
for(var/obj/item/weapon/holder/H in O.contents)
H.show_message(message, m_type)
for(var/mob/living/M in O.contents)
M.show_message(message, m_type)
O.show_message(message, m_type)
for(var/obj/O in seeing_obj)
spawn(0)
if(O) //It's possible that it could be deleted in the meantime.
O.see_emote(src, message, 2)
var/list/hear = get_mobs_or_objects_in_view(world.view,src)
for(var/I in hear)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.see_emote(src, message, 2)
else if(ismob(I))
var/mob/M = I
M.show_message(message, 2)
/mob/proc/emote_dead(var/message)

View File

@@ -32,10 +32,6 @@
for(var/mob/M in src.contents)
M.attackby(W,user)
/obj/item/weapon/holder/proc/show_message(var/message, var/m_type)
for(var/mob/living/M in contents)
M.show_message(message,m_type)
//Mob procs and vars for scooping up
/mob/living/var/holder_type

View File

@@ -21,15 +21,15 @@
switch(act)
if ("airguitar")
if (!src.restrained())
message = "<B>[src]</B> 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 = "<B>[src]</B> blinks."
message = "blinks."
m_type = 1
if ("blink_r")
message = "<B>[src]</B> blinks rapidly."
message = "blinks rapidly."
m_type = 1
if ("bow")
@@ -44,9 +44,9 @@
param = null
if (param)
message = "<B>[src]</B> bows to [param]."
message = "bows to [param]."
else
message = "<B>[src]</B> bows."
message = "bows."
m_type = 1
if ("custom")
@@ -94,73 +94,73 @@
param = null
if (param)
message = "<B>[src]</B> salutes to [param]."
message = "salutes to [param]."
else
message = "<B>[src]</b> salutes."
message = "salutes."
m_type = 1
if ("choke")
if(miming)
message = "<B>[src]</B> clutches his throat desperately!"
message = "clutches his throat desperately!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> chokes!"
message = "chokes!"
m_type = 2
else
message = "<B>[src]</B> makes a strong noise."
message = "makes a strong noise."
m_type = 2
if ("clap")
if (!src.restrained())
message = "<B>[src]</B> claps."
message = "claps."
m_type = 2
if(miming)
m_type = 1
if ("flap")
if (!src.restrained())
message = "<B>[src]</B> 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 = "<B>[src]</B> 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 = "<B>[src]</B> drools."
message = "drools."
m_type = 1
if ("eyebrow")
message = "<B>[src]</B> raises an eyebrow."
message = "raises an eyebrow."
m_type = 1
if ("chuckle")
if(miming)
message = "<B>[src]</B> appears to chuckle."
message = "appears to chuckle."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> chuckles."
message = "chuckles."
m_type = 2
else
message = "<B>[src]</B> makes a noise."
message = "makes a noise."
m_type = 2
if ("twitch")
message = "<B>[src]</B> twitches violently."
message = "twitches violently."
m_type = 1
if ("twitch_s")
message = "<B>[src]</B> twitches."
message = "twitches."
m_type = 1
if ("faint")
message = "<B>[src]</B> 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 = "<B>[src]</B> appears to cough!"
message = "appears to cough!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> coughs!"
message = "coughs!"
m_type = 2
else
message = "<B>[src]</B> makes a strong noise."
message = "makes a strong noise."
m_type = 2
if ("frown")
message = "<B>[src]</B> frowns."
message = "frowns."
m_type = 1
if ("nod")
message = "<B>[src]</B> nods."
message = "nods."
m_type = 1
if ("blush")
message = "<B>[src]</B> blushes."
message = "blushes."
m_type = 1
if ("wave")
message = "<B>[src]</B> waves."
message = "waves."
m_type = 1
if ("gasp")
if(miming)
message = "<B>[src]</B> appears to be gasping!"
message = "appears to be gasping!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> gasps!"
message = "gasps!"
m_type = 2
else
message = "<B>[src]</B> makes a weak noise."
message = "makes a weak noise."
m_type = 2
if ("deathgasp")
message = "<B>[src]</B> [species.death_message]"
message = "[species.death_message]"
m_type = 1
if ("giggle")
if(miming)
message = "<B>[src]</B> giggles silently!"
message = "giggles silently!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> giggles."
message = "giggles."
m_type = 2
else
message = "<B>[src]</B> makes a noise."
message = "makes a noise."
m_type = 2
if ("glare")
@@ -233,9 +233,9 @@
param = null
if (param)
message = "<B>[src]</B> glares at [param]."
message = "glares at [param]."
else
message = "<B>[src]</B> glares."
message = "glares."
if ("stare")
var/M = null
@@ -248,9 +248,9 @@
param = null
if (param)
message = "<B>[src]</B> stares at [param]."
message = "stares at [param]."
else
message = "<B>[src]</B> stares."
message = "stares."
if ("look")
var/M = null
@@ -264,86 +264,86 @@
param = null
if (param)
message = "<B>[src]</B> looks at [param]."
message = "looks at [param]."
else
message = "<B>[src]</B> looks."
message = "looks."
m_type = 1
if ("grin")
message = "<B>[src]</B> grins."
message = "grins."
m_type = 1
if ("cry")
if(miming)
message = "<B>[src]</B> cries."
message = "cries."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> cries."
message = "cries."
m_type = 2
else
message = "<B>[src]</B> 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 = "<B>[src]</B> sighs."
message = "sighs."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> sighs."
message = "sighs."
m_type = 2
else
message = "<B>[src]</B> makes a weak noise."
message = "makes a weak noise."
m_type = 2
if ("laugh")
if(miming)
message = "<B>[src]</B> acts out a laugh."
message = "acts out a laugh."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> laughs."
message = "laughs."
m_type = 2
else
message = "<B>[src]</B> makes a noise."
message = "makes a noise."
m_type = 2
if ("mumble")
message = "<B>[src]</B> mumbles!"
message = "mumbles!"
m_type = 2
if(miming)
m_type = 1
if ("grumble")
if(miming)
message = "<B>[src]</B> grumbles!"
message = "grumbles!"
m_type = 1
if (!muzzled)
message = "<B>[src]</B> grumbles!"
message = "grumbles!"
m_type = 2
else
message = "<B>[src]</B> makes a noise."
message = "makes a noise."
m_type = 2
if ("groan")
if(miming)
message = "<B>[src]</B> appears to groan!"
message = "appears to groan!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> groans!"
message = "groans!"
m_type = 2
else
message = "<B>[src]</B> makes a loud noise."
message = "makes a loud noise."
m_type = 2
if ("moan")
if(miming)
message = "<B>[src]</B> appears to moan!"
message = "appears to moan!"
m_type = 1
else
message = "<B>[src]</B> moans!"
message = "moans!"
m_type = 2
if ("johnny")
@@ -354,10 +354,10 @@
param = null
else
if(miming)
message = "<B>[src]</B> 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 = "<B>[src]</B> 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 = "<B>[src]</B> points."
message = "points."
else
pointed(M)
if (M)
message = "<B>[src]</B> points to [M]."
message = "points to [M]."
else
m_type = 1
if ("raise")
if (!src.restrained())
message = "<B>[src]</B> raises a hand."
message = "raises a hand."
m_type = 1
if("shake")
message = "<B>[src]</B> shakes \his head."
message = "shakes [get_visible_gender() == MALE ? "his" : get_visible_gender() == FEMALE ? "her" : "their"] head."
m_type = 1
if ("shrug")
message = "<B>[src]</B> 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 = "<B>[src]</B> raises [t1] finger\s."
message = "raises [t1] finger\s."
else if (t1 <= 10 && (!src.r_hand && !src.l_hand))
message = "<B>[src]</B> raises [t1] finger\s."
message = "raises [t1] finger\s."
m_type = 1
if ("smile")
message = "<B>[src]</B> smiles."
message = "smiles."
m_type = 1
if ("shiver")
message = "<B>[src]</B> shivers."
message = "shivers."
m_type = 2
if(miming)
m_type = 1
if ("pale")
message = "<B>[src]</B> goes pale for a second."
message = "goes pale for a second."
m_type = 1
if ("tremble")
message = "<B>[src]</B> trembles in fear!"
message = "trembles in fear!"
m_type = 1
if ("sneeze")
if (miming)
message = "<B>[src]</B> sneezes."
message = "sneezes."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> sneezes."
message = "sneezes."
m_type = 2
else
message = "<B>[src]</B> makes a strange noise."
message = "makes a strange noise."
m_type = 2
if ("sniff")
message = "<B>[src]</B> sniffs."
message = "sniffs."
m_type = 2
if(miming)
m_type = 1
if ("snore")
if (miming)
message = "<B>[src]</B> sleeps soundly."
message = "sleeps soundly."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> snores."
message = "snores."
m_type = 2
else
message = "<B>[src]</B> makes a noise."
message = "makes a noise."
m_type = 2
if ("whimper")
if (miming)
message = "<B>[src]</B> appears hurt."
message = "appears hurt."
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> whimpers."
message = "whimpers."
m_type = 2
else
message = "<B>[src]</B> makes a weak noise."
message = "makes a weak noise."
m_type = 2
if ("wink")
message = "<B>[src]</B> winks."
message = "winks."
m_type = 1
if ("yawn")
if (!muzzled)
message = "<B>[src]</B> yawns."
message = "yawns."
m_type = 2
if(miming)
m_type = 1
if ("collapse")
Paralyse(2)
message = "<B>[src]</B> collapses!"
message = "collapses!"
m_type = 2
if(miming)
m_type = 1
@@ -493,9 +493,9 @@
M = null
if (M)
message = "<B>[src]</B> hugs [M]."
message = "hugs [M]."
else
message = "<B>[src]</B> 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 = "<B>[src]</B> shakes hands with [M]."
message = "shakes hands with [M]."
else
message = "<B>[src]</B> 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 = "<B>[src]</B> gives daps to [M]."
message = "gives daps to [M]."
else
message = "<B>[src]</B> 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 = "<B>[src]</B> acts out a scream!"
message = "acts out a scream!"
m_type = 1
else
if (!muzzled)
message = "<B>[src]</B> screams!"
message = "screams!"
m_type = 2
else
message = "<B>[src]</B> makes a very loud noise."
message = "makes a very loud noise."
m_type = 2
if("swish")
@@ -569,23 +569,7 @@ wink, yawn, swish, sway/wag, fastsway/qwag, stopsway/swag"}
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()
@@ -593,7 +577,7 @@ wink, yawn, swish, sway/wag, fastsway/qwag, stopsway/swag"}
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"

View File

@@ -238,17 +238,15 @@ proc/get_radio_key_from_channel(var/channel)
italics = 1
sound_vol *= 0.5 //muffle the sound a bit, so it's like we're actually talking through contact
var/list/hear = hear(message_range, T)
var/list/hear = get_mobs_or_objects_in_view(message_range,src)
var/list/hearturfs = list()
for(var/I in hear)
if(istype(I, /mob/))
if(ismob(I))
var/mob/M = I
listening += M
hearturfs += M.locs[1]
for(var/obj/O in M.contents)
listening_obj |= O
else if(istype(I, /obj/))
else if(isobj(I))
var/obj/O = I
hearturfs += O.locs[1]
listening_obj |= O

View File

@@ -38,9 +38,9 @@
param = null
if (param)
message = "<B>[src]</B> salutes to [param]."
message = "salutes to [param]."
else
message = "<B>[src]</b> salutes."
message = "salutes."
m_type = 1
if ("bow")
if (!src.buckled)
@@ -54,39 +54,39 @@
param = null
if (param)
message = "<B>[src]</B> bows to [param]."
message = "bows to [param]."
else
message = "<B>[src]</B> bows."
message = "bows."
m_type = 1
if ("clap")
if (!src.restrained())
message = "<B>[src]</B> claps."
message = "claps."
m_type = 2
if ("flap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings."
message = "flaps his wings."
m_type = 2
if ("aflap")
if (!src.restrained())
message = "<B>[src]</B> flaps his wings ANGRILY!"
message = "flaps his wings ANGRILY!"
m_type = 2
if ("twitch")
message = "<B>[src]</B> twitches violently."
message = "twitches violently."
m_type = 1
if ("twitch_s")
message = "<B>[src]</B> twitches."
message = "twitches."
m_type = 1
if ("nod")
message = "<B>[src]</B> nods."
message = "nods."
m_type = 1
if ("deathgasp")
message = "<B>[src]</B> 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 = "<B>[src]</B> glares at [param]."
message = "glares at [param]."
else
message = "<B>[src]</B> glares."
message = "glares."
if ("stare")
var/M = null
@@ -115,9 +115,9 @@
param = null
if (param)
message = "<B>[src]</B> stares at [param]."
message = "stares at [param]."
else
message = "<B>[src]</B> stares."
message = "stares."
if ("look")
var/M = null
@@ -131,9 +131,9 @@
param = null
if (param)
message = "<B>[src]</B> looks at [param]."
message = "looks at [param]."
else
message = "<B>[src]</B> looks."
message = "looks."
m_type = 1
if("beep")
@@ -147,9 +147,9 @@
param = null
if (param)
message = "<B>[src]</B> beeps at [param]."
message = "beeps at [param]."
else
message = "<B>[src]</B> beeps."
message = "beeps."
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0)
m_type = 1
@@ -164,9 +164,9 @@
param = null
if (param)
message = "<B>[src]</B> pings at [param]."
message = "pings at [param]."
else
message = "<B>[src]</B> pings."
message = "pings."
playsound(src.loc, 'sound/machines/ping.ogg', 50, 0)
m_type = 1
@@ -181,15 +181,15 @@
param = null
if (param)
message = "<B>[src]</B> buzzes at [param]."
message = "buzzes at [param]."
else
message = "<B>[src]</B> 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 = "<B>[src]</B> 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

View File

@@ -44,29 +44,30 @@
src << msg
return
// Show a message to all mobs in sight of this one
// Show a message to all mobs and objects in sight of this one
// This would be for visible actions by the src mob
// message is the message output to anyone who can see e.g. "[src] does something!"
// self_message (optional) is what the src mob sees e.g. "You do something!"
// 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)
for(var/mob/M in viewers(src))
if(self_message && M==src)
M.show_message(self_message, 1, blind_message, 2)
else if(M.see_invisible < invisibility) // Cannot view the invisible, but you can hear it.
if(blind_message)
M.show_message(blind_message, 2)
else
M.show_message(message, 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/see = get_mobs_or_objects_in_view(world.view,src) | viewers(get_turf(src), null)
for(var/I in see)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.show_message( message, 1, blind_message, 2)
else if(ismob(I))
var/mob/M = I
if(self_message && M==src)
M.show_message( self_message, 1, blind_message, 2)
if(M.see_invisible >= invisibility) // Cannot view the invisible
M.show_message( message, 1, blind_message, 2)
else if (blind_message)
M.show_message(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.
@@ -75,33 +76,31 @@
/atom/proc/drain_power(var/drain_check,var/surge, var/amount = 0)
return -1
// Show a message to all mobs in earshot of this one
// Show a message to all mobs and objects 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.
// deaf_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/deaf_message, var/hearing_distance, var/self_message)
var/range = 7
if(hearing_distance)
range = hearing_distance
var/msg = message
for(var/mob/M in get_mobs_in_view(range, src))
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.
// deaf_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
var/range = world.view
if(hearing_distance)
range = hearing_distance
for(var/mob/M in get_mobs_in_view(range, src))
M.show_message( message, 2, deaf_message, 1)
var/list/hear = get_mobs_or_objects_in_view(range,src)
for(var/I in hear)
if(isobj(I))
spawn(0)
if(I) //It's possible that it could be deleted in the meantime.
var/obj/O = I
O.show_message( message, 2, deaf_message, 1)
else if(ismob(I))
var/mob/M = I
var/msg = message
if(self_message && M==src)
msg = self_message
M.show_message( msg, 2, deaf_message, 1)
/mob/proc/findname(msg)
@@ -137,8 +136,23 @@
client.eye = loc
return
// This is not needed short of simple_animal and carbon/alien / carbon/human, who reimplement it.
/mob/proc/show_inv(mob/user as mob)
user.set_machine(src)
var/dat = {"
<B><HR><FONT size=3>[name]</FONT></B>
<BR><HR>
<BR><B>Head(Mask):</B> <A href='?src=\ref[src];item=mask'>[(wear_mask ? wear_mask : "Nothing")]</A>
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=l_hand'>[(l_hand ? l_hand : "Nothing")]</A>
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=r_hand'>[(r_hand ? r_hand : "Nothing")]</A>
<BR><B>Back:</B> <A href='?src=\ref[src];item=back'>[(back ? back : "Nothing")]</A> [((istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank) && !( internal )) ? text(" <A href='?src=\ref[];item=internal'>Set Internal</A>", src) : "")]
<BR>[(internal ? text("<A href='?src=\ref[src];item=internal'>Remove Internal</A>") : "")]
<BR><A href='?src=\ref[src];item=pockets'>Empty Pockets</A>
<BR><A href='?src=\ref[user];refresh=1'>Refresh</A>
<BR><A href='?src=\ref[user];mach_close=mob[name]'>Close</A>
<BR>"}
user << browse(dat, text("window=mob[];size=325x500", name))
onclose(user, "mob[name]")
return
//mob verbs are faster than object verbs. See http://www.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine()

View File

@@ -0,0 +1,7 @@
author: RavingManiac
delete-after: True
changes:
- rscadd: "Tape recorders now record hearable emotes and action messages (e.g. gunshots)."
- bugfix: "You can now see actions from inside mechs and closets."