Files
Paradise/code/modules/mob/living/say.dm
mport2004@gmail.com 17ed3899c4 Fixed the map/code issues that the body bags caused.
/obj/effects is now /obj/effect.
/obj/station_objects is now /obj/structure.
Did a bit of minor blob work. 
The Bay 12 body bags were replaced with closets because having two sets of code that do almost the same thing is silly.
Changed back a few of the last jobproc edits as the remove from list before assign was a check to see if the mob was fucked up and if it was remove it so we did not check it again as it would still be fucked up.
The medbay/tox monkeys names are random once more.  More random name monkeys will help with changeling and clean up the observe/mob menus.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2324 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-03 10:28:57 +00:00

434 lines
11 KiB
Plaintext
Raw Blame History

/mob/living/proc/binarycheck()
if (istype(src, /mob/living/silicon/pai)) return
if (issilicon(src)) return 1
if (!ishuman(src)) return
var/mob/living/carbon/human/H = src
if (H.ears)
var/obj/item/device/radio/headset/dongle = H.ears
if(!istype(dongle)) return
if(dongle.translate_binary) return 1
/mob/living/proc/hivecheck()
if (isalien(src)) return 1
if (!ishuman(src)) return
var/mob/living/carbon/human/H = src
if (H.ears)
var/obj/item/device/radio/headset/dongle = H.ears
if(!istype(dongle)) return
if(dongle.translate_hive) return 1
/mob/living/say(var/message)
message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN))
if (!message)
return
if (length(message) >= 1)
if (miming && copytext(message, 1, 2) != "*")
return
if (stat == 2)
return say_dead(message)
if (muted || silent)
return
// wtf?
if (stat)
return
// Mute disability
if (sdisabilities & 2)
return
if (istype(wear_mask, /obj/item/clothing/mask/muzzle))
return
// emotes
if (copytext(message, 1, 2) == "*" && !stat)
return emote(copytext(message, 2))
var/alt_name = ""
if (istype(src, /mob/living/carbon/human) && name != real_name)
var/mob/living/carbon/human/H = src
alt_name = " (as [H.get_visible_name()])"
var/italics = 0
var/message_range = null
var/message_mode = null
if (brainloss >= 60 && prob(50))
if (ishuman(src))
message_mode = "headset"
// Special message handling
else if (copytext(message, 1, 2) == ";")
if (ishuman(src))
message_mode = "headset"
else if(istype(src, /mob/living/silicon/pai) || istype(src, /mob/living/silicon/robot))
message_mode = "pAI"
message = copytext(message, 2)
else if (length(message) >= 2)
var/channel_prefix = copytext(message, 1, 3)
var/list/keys = list(
":r" = "right hand",
":l" = "left hand",
":i" = "intercom",
":h" = "department",
":c" = "Command",
":n" = "Science",
":m" = "Medical",
":e" = "Engineering",
":s" = "Security",
":w" = "whisper",
":b" = "binary",
":a" = "alientalk",
":t" = "Syndicate",
":d" = "Mining",
":q" = "Cargo",
":g" = "changeling",
//kinda localization -- rastaf0
//same keys as above, but on russian keyboard layout. This file uses cp1251 as encoding.
":<3A>" = "right hand",
":<3A>" = "left hand",
":<3A>" = "intercom",
":<3A>" = "department",
":<3A>" = "Command",
":<3A>" = "Science",
":<3A>" = "Medical",
":<3A>" = "Engineering",
":<3A>" = "Security",
":<3A>" = "whisper",
":<3A>" = "binary",
":<3A>" = "alientalk",
":<3A>" = "Syndicate",
":<3A>" = "Mining",
":<3A>" = "Cargo",
":<3A>" = "changeling",
)
message_mode = keys[channel_prefix]
//world << "channel_prefix=[channel_prefix]; message_mode=[message_mode]"
if (message_mode)
message = trim(copytext(message, 3))
if (!ishuman(src) && (message_mode=="department" || (message_mode in radiochannels)))
message_mode = null //only humans can use headsets
if (!message)
return
// :downs:
if (brainloss >= 60)
message = dd_replacetext(message, " am ", " ")
message = dd_replacetext(message, " is ", " ")
message = dd_replacetext(message, " are ", " ")
message = dd_replacetext(message, "you", "u")
message = dd_replacetext(message, "help", "halp")
message = dd_replacetext(message, "grief", "grife")
message = dd_replacetext(message, "space", "spess")
message = dd_replacetext(message, "carp", "crap")
if(prob(50))
message = uppertext(message)
message += "[stutter(pick("!", "!!", "!!!"))]"
if(!stuttering && prob(15))
message = stutter(message)
if (stuttering)
message = stutter(message)
/* //qw do not have beesease atm.
if(virus)
if(virus.name=="beesease" && virus.stage>=2)
if(prob(virus.stage*10))
var/bzz = length(message)
message = "B"
for(var/i=0,i<bzz,i++)
message += "Z"
*/
var/list/obj/item/used_radios = new
switch (message_mode)
if ("headset")
if (src:ears)
src:ears.talk_into(src, message)
used_radios += src:ears
message_range = 1
italics = 1
if ("secure headset")
if (src:ears)
src:ears.talk_into(src, message, 1)
used_radios += src:ears
message_range = 1
italics = 1
if ("right hand")
if (r_hand)
r_hand.talk_into(src, message)
used_radios += src:r_hand
message_range = 1
italics = 1
if ("left hand")
if (l_hand)
l_hand.talk_into(src, message)
used_radios += src:l_hand
message_range = 1
italics = 1
if ("intercom")
for (var/obj/item/device/radio/intercom/I in view(1, null))
I.talk_into(src, message)
used_radios += I
message_range = 1
italics = 1
//I see no reason to restrict such way of whispering
if ("whisper")
whisper(message)
return
if ("binary")
if(robot_talk_understand || binarycheck())
//message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) //seems redundant
robot_talk(message)
return
if ("alientalk")
if(alien_talk_understand || hivecheck())
//message = trim(copytext(sanitize(message), 1, MAX_MESSAGE_LEN)) //seems redundant
alien_talk(message)
return
if ("department")
if (src:ears)
src:ears.talk_into(src, message, message_mode)
used_radios += src:ears
message_range = 1
italics = 1
if ("pAI")
if (src:radio)
src:radio.talk_into(src, message)
used_radios += src:radio
message_range = 1
italics = 1
if("changeling")
if(src.changeling)
for(var/mob/living/carbon/aChangeling in world)
if(aChangeling.changeling)
aChangeling << "<i><font color=#800080><b>[gender=="male"?"Mr.":"Mrs."] [changeling.changelingID]:</b> [message]</font></i>"
return
////SPECIAL HEADSETS START
else
//world << "SPECIAL HEADSETS"
if (message_mode in radiochannels)
if (src:ears)
src:ears.talk_into(src, message, message_mode)
used_radios += src:ears
message_range = 1
italics = 1
/////SPECIAL HEADSETS END
var/list/listening
/*
if(istype(loc, /obj/item/device/aicard)) // -- TLE
var/obj/O = loc
if(istype(O.loc, /mob))
var/mob/M = O.loc
listening = hearers(message_range, M)
else
listening = hearers(message_range, O)
else
listening = hearers(message_range, src)
for (var/obj/O in view(message_range, src))
for (var/mob/M in O)
listening += M // maybe need to check if M can hear src
spawn (0)
if (O)
O.hear_talk(src, message)
if (!(src in listening))
listening += src
*/
var/turf/T = get_turf(src)
listening = hearers(message_range, T)
var/list/V = view(message_range, T)
//find mobs in lockers, cryo, intellicards, brains, MMIs, and so on.
for (var/mob/M in world)
if (!M.client)
continue //skip monkeys and leavers
if (istype(M, /mob/new_player))
continue
if (M.stat <2) //is alive
if (isturf(M.loc))
continue //if M can hear us it was already found by hearers()
if (get_turf(M) in V) //this is slow, but I don't think we'd have a lot of wardrobewhores every round --rastaf0
listening+=M
else
if (M.client && M.client.ghost_ears)
listening|=M
for (var/obj/O in ((V | contents)-used_radios)) //radio in pocket could work, radio in backpack wouldn't --rastaf0
spawn (0)
if (O)
O.hear_talk(src, message)
if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
for(var/obj/O in loc)//Kinda ugly but whatever.
if(O)
spawn(0)
O.hear_talk(src, message)
var/list/heard_a = list() // understood us
var/list/heard_b = list() // didn't understand us
for (var/mob/M in listening)
if (M.say_understands(src))
heard_a += M
else
heard_b += M
var/rendered = null
if (length(heard_a))
var/message_a = say_quote(message)
if (italics)
message_a = "<i>[message_a]</i>"
if (!istype(src, /mob/living/carbon/human))
rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message_a]</span></span>"
else if(istype(wear_mask, /obj/item/clothing/mask/gas/voice))
if(wear_mask:vchange)
rendered = "<span class='game say'><span class='name'>[wear_mask:voice]</span> <span class='message'>[message_a]</span></span>"
else
rendered = "<span class='game say'><span class='name'>[name]</span> <span class='message'>[message_a]</span></span>"
else
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] <span class='message'>[message_a]</span></span>"
/*
// Create speech bubble
var/obj/effect/speech_bubble/B = new/obj/effect/speech_bubble
B.icon = 'speechbubble.dmi'
B.parent = src
B.mouse_opacity = 0
B.invisibility = invisibility
B.layer = 10
// Determine if the speech bubble's going to have a special look
var/presay = ""
if(istype(src, /mob/living/silicon))
presay = "bot"
if(istype(src, /mob/living/carbon/alien))
presay = "xeno"
if(istype(src, /mob/living/carbon/metroid))
presay = "metroid"
*/
for (var/mob/M in heard_a)
M.show_message(rendered, 2)
/*
if(M.client)
// If this client has bubbles disabled, obscure the bubble
if(!M.client.bubbles || M == src)
var/image/I = image('speechbubble.dmi', B, "override")
I.override = 1
M << I
*/
/*
// find the suffix, if bot, human or monkey
var/punctuation = ""
if(presay == "bot" || presay == "")
var/ending = copytext(text, length(text))
if (ending == "?")
punctuation = "question"
else if (ending == "!")
punctuation = "exclamation"
else
punctuation = ""
// flick the bubble
flick("[presay]say[punctuation]", B)
if(istype(loc, /turf))
B.loc = loc
else
B.loc = loc.loc
spawn()
sleep(11)
del(B)
*/
if (length(heard_b))
var/message_b
if (voice_message)
message_b = voice_message
else
message_b = stars(message)
message_b = say_quote(message_b)
if (italics)
message_b = "<i>[message_b]</i>"
rendered = "<span class='game say'><span class='name'>[voice_name]</span> <span class='message'>[message_b]</span></span>"
/*
// Create speech bubble
var/obj/effect/speech_bubble/B = new/obj/effect/speech_bubble
B.icon = 'speechbubble.dmi'
B.parent = src
B.mouse_opacity = 0
B.invisibility = invisibility
B.layer = 10
// Determine if the speech bubble's going to have a special look
var/presay = ""
if(istype(src, /mob/living/silicon))
presay = "bot"
if(istype(src, /mob/living/carbon/alien))
presay = "xeno"
if(istype(src, /mob/living/carbon/metroid))
presay = "metroid"
*/
for (var/mob/M in heard_b)
M.show_message(rendered, 2)
/*
if(M.client)
if(!M.client.bubbles || M == src)
var/image/I = image('speechbubble.dmi', B, "override")
I.override = 1
M << I
*/ /*
flick("[presay]say", B)
if(istype(loc, /turf))
B.loc = loc
else
B.loc = loc.loc
spawn()
sleep(11)
del(B)
*/
log_say("[name]/[key] : [message]")
/obj/effect/speech_bubble
var/mob/parent