added hear_message, like hear_talk but for audible emotes, voice analyzer & newscaster support

This commit is contained in:
Tastyfish
2015-12-13 04:36:41 -05:00
parent 3986cbe698
commit f39649be57
12 changed files with 68 additions and 9 deletions
+3
View File
@@ -85,6 +85,9 @@
if(bombassembly)
bombassembly.hear_talk(M, msg)
/obj/item/device/onetankbomb/hear_message(mob/living/M as mob, msg)
if(bombassembly)
bombassembly.hear_message(M, msg)
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
+6
View File
@@ -100,6 +100,12 @@
a_left.hear_talk(M, msg)
if(a_right)
a_right.hear_talk(M, msg)
hear_message(mob/living/M as mob, msg)
if(a_left)
a_left.hear_message(M, msg)
if(a_right)
a_right.hear_message(M, msg)
proc/process_movement() // infrared beams and prox sensors
if(a_left && a_right)
+10 -2
View File
@@ -6,6 +6,7 @@
origin_tech = "magnets=1"
var/listening = 0
var/recorded = null //the activation message
var/recorded_type = 0 // 0 for say, 1 for emote
bomb_name = "voice-activated bomb"
@@ -16,15 +17,22 @@
return "[src] is deactivated."
hear_talk(mob/living/M as mob, msg)
hear_input(M, msg, 0)
hear_message(mob/living/M as mob, msg)
hear_input(M, msg, 1)
proc/hear_input(mob/living/M as mob, msg, type)
if(!istype(M,/mob/living))
return
if(listening)
recorded = msg
recorded_type = type
listening = 0
var/turf/T = get_turf(src) //otherwise it won't work in hand
T.visible_message("\icon[src] beeps, \"Activation message is '[recorded]'.\"")
T.visible_message("\icon[src] beeps, \"Activation message is [type ? "the sound when one [recorded]" : "'[recorded]'."]\"")
else
if(findtext(msg, recorded))
if(findtext(msg, recorded) && type == recorded_type)
pulse(0)
var/turf/T = get_turf(src) //otherwise it won't work in hand
T.visible_message("\icon[src] \red beeps!")