From 6d3345d166e9972caa9af7ddcf1c10fa7e1e2e82 Mon Sep 17 00:00:00 2001 From: r4d6 Date: Sun, 5 Jan 2020 23:32:44 -0500 Subject: [PATCH] Add the Playback Device --- code/modules/assembly/playback.dm | 50 +++++++++++++++++++++++++++++++ code/modules/vending/assist.dm | 1 + tgstation.dme | 1 + 3 files changed, 52 insertions(+) create mode 100644 code/modules/assembly/playback.dm diff --git a/code/modules/assembly/playback.dm b/code/modules/assembly/playback.dm new file mode 100644 index 0000000000..088f186adc --- /dev/null +++ b/code/modules/assembly/playback.dm @@ -0,0 +1,50 @@ +/obj/item/assembly/playback + name = "playback device" + desc = "A small electronic device able to record a voice sample, and repeat that sample when it receive a signal." + icon_state = "radio" + materials = list(MAT_METAL=500, MAT_GLASS=50) + flags_1 = HEAR_1 + attachable = TRUE + verb_say = "beeps" + verb_ask = "beeps" + verb_exclaim = "beeps" + var/listening = FALSE + var/recorded = "" //the activation message + var/languages + +/obj/item/assembly/playback/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source) + . = ..() + if(speaker == src) + return + + if(listening && !radio_freq) + record_speech(speaker, raw_message, message_language) + +/obj/item/assembly/playback/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language) + recorded = raw_message + listening = FALSE + languages = message_language + say("Activation message is '[recorded]'.", language = message_language) + +/obj/item/assembly/playback/activate() + if(recorded == "") // Why say anything when there isn't anything to say + return FALSE + say("[recorded]", language = languages) // Repeat the message in the language it was said in + return TRUE + +/obj/item/assembly/playback/proc/record() + if(!secured || holder) + return FALSE + listening = !listening + say("[listening ? "Now" : "No longer"] recording input.") + return TRUE + +/obj/item/assembly/playback/attack_self(mob/user) + if(!user) + return FALSE + record() + return TRUE + +/obj/item/assembly/playback/toggle_secure() + . = ..() + listening = FALSE \ No newline at end of file diff --git a/code/modules/vending/assist.dm b/code/modules/vending/assist.dm index 280bcb5ca2..0d0dd40b36 100644 --- a/code/modules/vending/assist.dm +++ b/code/modules/vending/assist.dm @@ -1,6 +1,7 @@ /obj/machinery/vending/assist products = list(/obj/item/assembly/prox_sensor = 7, /obj/item/assembly/igniter = 6, + /obj/item/assembly/playback = 4, /obj/item/assembly/signaler = 6, /obj/item/wirecutters = 3, /obj/item/stock_parts/cell/crap = 6, diff --git a/tgstation.dme b/tgstation.dme index 7e7d69d6f1..6818de8d04 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1440,6 +1440,7 @@ #include "code\modules\assembly\igniter.dm" #include "code\modules\assembly\infrared.dm" #include "code\modules\assembly\mousetrap.dm" +#include "code\modules\assembly\playback.dm" #include "code\modules\assembly\proximity.dm" #include "code\modules\assembly\shock_kit.dm" #include "code\modules\assembly\signaler.dm"