From df0f4bd49202589f11c27e10dde8f040fc16bb59 Mon Sep 17 00:00:00 2001 From: Shdorsh <32726535+Shdorsh@users.noreply.github.com> Date: Tue, 31 Jul 2018 23:36:46 +0200 Subject: [PATCH] Turning circuits literate (#39223) Adds A text replacer circuit. Who knows, maybe one day we will be able to have a real discussion with a circuit? --- .../integrated_electronics/subtypes/text.dm | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 code/modules/integrated_electronics/subtypes/text.dm diff --git a/code/modules/integrated_electronics/subtypes/text.dm b/code/modules/integrated_electronics/subtypes/text.dm new file mode 100644 index 00000000000..bcc3d947665 --- /dev/null +++ b/code/modules/integrated_electronics/subtypes/text.dm @@ -0,0 +1,29 @@ +/obj/item/integrated_circuit/text + name = "text thingy" + desc = "Does text-processing related things." + category_text = "Text" + complexity = 1 + +// - Text Replacer - // +/obj/item/integrated_circuit/text/text_replacer + name = "find-replace circuit" + desc = "Replaces all of one bit of text with another" + extended_desc = "Takes a string(haystack) and puts out the string while having a certain word(needle) replaced with another." + spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH + inputs = list( + "haystack" = IC_PINTYPE_STRING, + "needle" = IC_PINTYPE_STRING, + "replacement" = IC_PINTYPE_STRING + ) + activators = list( + "replace" = IC_PINTYPE_PULSE_IN, + "on replaced" = IC_PINTYPE_PULSE_OUT + ) + outputs = list( + "replaced string" = IC_PINTYPE_STRING + ) + +/obj/item/integrated_circuit/text/text_replacer/do_work() + set_pin_data(IC_OUTPUT, 1,replacetext(get_pin_data(IC_INPUT, 1), get_pin_data(IC_INPUT, 2), get_pin_data(IC_INPUT, 3))) + push_data() + activate_pin(2)