Files
Aurora.3/code/modules/assembly/voice.dm
skull132 77c7e23ebe Port initial Bay12 object listener fix (#2106)
Port of Baystation12/Baystation12#13264

Large PR to put into Master, but the bug is really annoying and since it affect a traitor item, an often used one, I'll take the risk.

Fixes #1956
Fixes explosives implants and lawgiver not working.
2017-04-19 10:15:19 +03:00

45 lines
1.2 KiB
Plaintext

/obj/item/device/assembly/voice
name = "voice analyzer"
desc = "A small electronic device able to record a voice sample, and send a signal when that sample is repeated."
icon_state = "voice"
origin_tech = list(TECH_MAGNET = 1)
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
var/listening = 0
var/recorded //the activation message
/obj/item/device/assembly/voice/New()
..()
listening_objects += src
/obj/item/device/assembly/voice/Destroy()
listening_objects -= src
return ..()
/obj/item/device/assembly/voice/hear_talk(mob/living/M as mob, msg)
if(listening)
recorded = msg
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]'.\"")
else
if(findtext(msg, recorded))
pulse(0)
/obj/item/device/assembly/voice/activate()
if(secured)
if(!holder)
listening = !listening
var/turf/T = get_turf(src)
T.visible_message("\icon[src] beeps, \"[listening ? "Now" : "No longer"] recording input.\"")
/obj/item/device/assembly/voice/attack_self(mob/user)
if(!user) return 0
activate()
return 1
/obj/item/device/assembly/voice/toggle_secure()
. = ..()
listening = 0