From c8fab7d070060b59e4483dde008da302a166e37c Mon Sep 17 00:00:00 2001 From: Neerti Date: Sun, 18 Sep 2016 16:13:25 -0400 Subject: [PATCH] I Can't Believe It's Not Circuits (it is) Fixes numberpad and letterpad pulsing. Debugger and Constant chip can now have null written to it. Adds new sound output, with two types so far. One being the 'beeper' type, which can do things like buzz, ping, beep, etc. The second type is a securitron speaker, which allows us to get closer to building a functioning Beepsky. --- .../integrated_electronics/input_output.dm | 75 +++++++++++++++++-- code/modules/integrated_electronics/memory.dm | 5 +- code/modules/integrated_electronics/tools.dm | 5 +- code/modules/research/designs.dm | 11 +++ 4 files changed, 89 insertions(+), 7 deletions(-) diff --git a/code/modules/integrated_electronics/input_output.dm b/code/modules/integrated_electronics/input_output.dm index 6a3ef7a065..0af2710c0b 100644 --- a/code/modules/integrated_electronics/input_output.dm +++ b/code/modules/integrated_electronics/input_output.dm @@ -47,8 +47,7 @@ O.data = new_input O.push_data() var/datum/integrated_io/A = activators[1] - if(A.linked) - A.holder.work() + A.push_data() /obj/item/integrated_circuit/input/textpad name = "text pad" @@ -73,8 +72,7 @@ O.data = new_input O.push_data() var/datum/integrated_io/A = activators[1] - if(A.linked) - A.holder.work() + A.push_data() /obj/item/integrated_circuit/input/med_scanner name = "integrated medical analyser" @@ -368,4 +366,71 @@ ) /obj/item/integrated_circuit/output/light/advanced/on_data_written() - update_lighting() \ No newline at end of file + update_lighting() + +/obj/item/integrated_circuit/output/sound + name = "speaker circuit" + desc = "A miniature speaker is attached to this component." + icon_state = "speaker" + complexity = 8 + cooldown_per_use = 4 SECONDS + number_of_inputs = 3 + number_of_outputs = 0 + number_of_activators = 1 + input_names = list( + "sound ID", + "volume", + "frequency" + ) + activator_names = list( + "play sound" + ) + var/list/sounds = list() + +/obj/item/integrated_circuit/output/sound/work() + if(..()) + var/datum/integrated_io/ID = inputs[1] + var/datum/integrated_io/vol = inputs[2] + var/datum/integrated_io/frequency = inputs[3] + if(istext(ID.data) && isnum(vol.data) && isnum(frequency.data)) + var/selected_sound = sounds[ID.data] + vol.data = Clamp(vol.data, 0, 1) + frequency.data = Clamp(frequency.data, 0, 100) + playsound(get_turf(src), selected_sound, vol.data, frequency.data, -1) + +/obj/item/integrated_circuit/output/sound/beeper + name = "beeper circuit" + desc = "A miniature speaker is attached to this component. This is often used in the construction of motherboards, which use \ + the speaker to tell the user if something goes very wrong when booting up. It can also do other similar synthetic sounds such \ + as buzzing, pinging, chiming, and more." + extended_desc = "The first input pin determines what sound is used. The choices are; beep, chime, buzz sigh, buzz twice, ping, \ + synth yes, synth no, warning buzz. The second pin determines the volume of sound that is played, and the third determines if \ + the frequency of the sound will vary with each activation." + sounds = list( + "beep" = 'sound/machines/twobeep.ogg', + "chime" = 'sound/machines/chime.ogg', + "buzz sigh" = 'sound/machines/buzz-sigh.ogg', + "buzz twice" = 'sound/machines/buzz-two.ogg', + "ping" = 'sound/machines/ping.ogg', + "synth yes" = 'sound/machines/synth_yes.ogg', + "synth no" = 'sound/machines/synth_no.ogg', + "warning buzz" = 'sound/machines/warning-buzzer.ogg' + ) + +/obj/item/integrated_circuit/output/sound/beepsky + name = "securitron sound circuit" + desc = "A miniature speaker is attached to this component. Considered by some to be the essential component for a securitron." + extended_desc = "The first input pin determines what sound is used. The choices are; creep, criminal, freeze, god, \ + i am the law, insult, radio, secure day. The second pin determines the volume of sound that is played, and the \ + third determines if the frequency of the sound will vary with each activation." + sounds = list( + "creep" = 'sound/voice/bcreep.ogg', + "criminal" = 'sound/voice/bcriminal.ogg', + "freeze" = 'sound/voice/bfreeze.ogg', + "god" = 'sound/voice/bgod.ogg', + "i am the law" = 'sound/voice/biamthelaw.ogg', + "insult" = 'sound/voice/binsult.ogg', + "radio" = 'sound/voice/bradio.ogg', + "secure day" = 'sound/voice/bsecureday.ogg', + ) + diff --git a/code/modules/integrated_electronics/memory.dm b/code/modules/integrated_electronics/memory.dm index ec06c7784b..8599cc2aed 100644 --- a/code/modules/integrated_electronics/memory.dm +++ b/code/modules/integrated_electronics/memory.dm @@ -68,7 +68,7 @@ /obj/item/integrated_circuit/memory/constant/attack_self(mob/user) var/datum/integrated_io/O = outputs[1] - var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref") + var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref", "null") var/new_data = null switch(type_to_use) if("string") @@ -87,6 +87,9 @@ accepting_refs = 1 user << "You turn \the [src]'s ref scanner on. Slide it across \ an object for a ref of that object to save it in memory." + if("null") + O.data = null + user << "You set \the [src]'s memory to absolutely nothing." /obj/item/integrated_circuit/memory/constant/afterattack(atom/target, mob/living/user, proximity) if(accepting_refs && proximity) diff --git a/code/modules/integrated_electronics/tools.dm b/code/modules/integrated_electronics/tools.dm index 915fe0f17b..75609ca59c 100644 --- a/code/modules/integrated_electronics/tools.dm +++ b/code/modules/integrated_electronics/tools.dm @@ -116,7 +116,7 @@ var/accepting_refs = 0 /obj/item/device/integrated_electronics/debugger/attack_self(mob/user) - var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref") + var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref", "null") var/new_data = null switch(type_to_use) if("string") @@ -135,6 +135,9 @@ accepting_refs = 1 user << "You turn \the [src]'s ref scanner on. Slide it across \ an object for a ref of that object to save it in memory." + if("null") + data_to_write = null + user << "You set \the [src]'s memory to absolutely nothing." /obj/item/device/integrated_electronics/debugger/afterattack(atom/target, mob/living/user, proximity) if(accepting_refs && proximity) diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index b99543514a..97d4bb22b4 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -1732,6 +1732,17 @@ CIRCUITS BELOW build_path = /obj/item/integrated_circuit/output/light/advanced sort_string = "WAAEI" +/datum/design/circuit/integrated_circuit/input_output/beeper + id = "cc-sound_beeper" + build_path = /obj/item/integrated_circuit/output/sound/beeper + sort_string = "WAAEJ" + +/datum/design/circuit/integrated_circuit/input_output/beepsky_sound + id = "cc-sound_beepsky" + build_path = /obj/item/integrated_circuit/output/sound/beepsky + sort_string = "WAAEK" + req_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_ILLEGAL = 1) + /datum/design/circuit/integrated_circuit/logic/AssembleDesignName() ..()