mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Ported new kinda of assemblies from TG - voice assembly.
It can be set to trigger on hearing a specific phrase. Credit to PeteTheGoat.
This commit is contained in:
@@ -212,7 +212,11 @@
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
/obj/item/device/assembly_holder/hear_talk(mob/living/M as mob, msg)
|
||||
if(a_right)
|
||||
a_right.hear_talk(M,msg)
|
||||
if(a_left)
|
||||
a_left.hear_talk(M,msg)
|
||||
|
||||
|
||||
|
||||
|
||||
36
code/modules/assembly/voice.dm
Normal file
36
code/modules/assembly/voice.dm
Normal file
@@ -0,0 +1,36 @@
|
||||
/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"
|
||||
matter = list("metal" = 500, "glass" = 50, "waste" = 10)
|
||||
origin_tech = "magnets=1"
|
||||
var/listening = 0
|
||||
var/recorded //the activation message
|
||||
|
||||
/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
|
||||
Reference in New Issue
Block a user