diff --git a/code/modules/integrated_electronics/_defines.dm b/code/modules/integrated_electronics/_defines.dm index 9e0fa6039c..7e0655c80c 100644 --- a/code/modules/integrated_electronics/_defines.dm +++ b/code/modules/integrated_electronics/_defines.dm @@ -92,6 +92,9 @@ var/mob/M = usr + if(!M.canmove || M.stat || M.restrained()) + return + var/input = sanitizeSafe(input("What do you want to name the circuit?", ,""), MAX_NAME_LEN) if(src && input) @@ -156,13 +159,14 @@ words += "\[[linked.name]\] \ @ [linked.holder]
" if(outputs.len > inputs.len) - height = Floor(outputs.len / inputs.len) - //world << "I wrote [words] at ([i],[j])." + // height = Floor(outputs.len / inputs.len) + height = 1 // Because of bugs, if there's more outputs than inputs, it causes the output side to be hidden. + //world << "I wrote [words] at ([i],[j]). Height = [height]." if(2) if(i == 1) words = "[src.name]

[src.desc]" height = row_height - //world << "I wrote the center piece because i was equal to 1, at ([i],[j])." + //world << "I wrote the center piece because i was equal to 1, at ([i],[j]). Height = [height]." else continue if(3) @@ -179,8 +183,9 @@ words += "\[[linked.name]\] \ @ [linked.holder]
" if(inputs.len > outputs.len) - height = Floor(inputs.len / outputs.len) - //world << "I wrote [words] at ([i],[j])." + // height = Floor(inputs.len / outputs.len) + height = 1 // See above. + //world << "I wrote [words] at ([i],[j]). Height = [height]." HTML += "[words]" //HTML += "[words]" //world << "Writing to ([i],[j])." @@ -209,11 +214,15 @@ HTML += "" HTML += "" + HTML += "
Complexity: [complexity]" HTML += "
[extended_desc]" HTML += "" user << browse(HTML, "window=circuit-\ref[src];size=600x350;border=1;can_resize=1;can_close=1;can_minimize=1") + //user << sanitize(HTML, "window=debug;size=400x400;border=1;can_resize=1;can_close=1;can_minimize=1") + //world << sanitize(HTML) + user.set_machine(src) onclose(user, "circuit-\ref[src]") @@ -224,6 +233,9 @@ if(!user || !user.Adjacent(get_turf(src)) ) return 1 + if(!user.canmove || user.stat || user.restrained()) + return + if(href_list["wire"]) if(ishuman(user) && Adjacent(user)) var/mob/living/carbon/human/H = user @@ -265,7 +277,7 @@ ..() /datum/integrated_io/proc/display_data() - if(!data) + if(isnull(data)) return "(null)" // Empty data means nothing to show. if(istext(data)) return "(\"[data]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'. diff --git a/code/modules/integrated_electronics/assemblies.dm b/code/modules/integrated_electronics/assemblies.dm index 97690b977f..e727f4c3d8 100644 --- a/code/modules/integrated_electronics/assemblies.dm +++ b/code/modules/integrated_electronics/assemblies.dm @@ -3,19 +3,21 @@ desc = "It's a case, for building electronics with." w_class = 2 icon = 'icons/obj/electronic_assemblies.dmi' - icon_state = "setup" + icon_state = "setup_small" var/max_components = 10 var/max_complexity = 30 var/opened = 0 /obj/item/device/electronic_assembly/medium name = "electronic mechanism" + icon_state = "setup_medium" w_class = 3 max_components = 20 max_complexity = 50 /obj/item/device/electronic_assembly/large name = "electronic machine" + icon_state = "setup" w_class = 4 max_components = 30 max_complexity = 60 @@ -35,16 +37,23 @@ IC.work() */ +/obj/item/device/electronic_assembly/update_icon() + if(opened) + icon_state = initial(icon_state) + "-open" + else + icon_state = initial(icon_state) + /obj/item/device/electronic_assembly/examine(mob/user) ..() - if(!opened) - for(var/obj/item/integrated_circuit/output/screen/S in contents) - if(S.stuff_to_display) - user << "There's a little screen labeled '[S.name]', which displays '[S.stuff_to_display]'." - else - var/obj/item/integrated_circuit/IC = input(user, "Which circuit do you want to examine?", "Examination") as null|anything in contents - if(IC) - IC.examine(user) + if(user.Adjacent(src)) + if(!opened) + for(var/obj/item/integrated_circuit/output/screen/S in contents) + if(S.stuff_to_display) + user << "There's a little screen labeled '[S.name]', which displays '[S.stuff_to_display]'." + else + var/obj/item/integrated_circuit/IC = input(user, "Which circuit do you want to examine?", "Examination") as null|anything in contents + if(IC) + IC.examine(user) /obj/item/device/electronic_assembly/attackby(var/obj/item/I, var/mob/user) if(istype(I, /obj/item/integrated_circuit)) @@ -86,6 +95,7 @@ playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) opened = !opened user << "You [opened ? "opened" : "closed"] \the [src]." + update_icon() if(istype(I, /obj/item/device/integrated_electronics/wirer)) if(opened) var/obj/item/integrated_circuit/IC = input(user, "Which circuit do you want to examine?", "Examination") as null|anything in contents @@ -98,7 +108,8 @@ /obj/item/device/electronic_assembly/attack_self(mob/user) var/list/available_inputs = list() for(var/obj/item/integrated_circuit/input/input in contents) - available_inputs.Add(input) + if(input.can_be_asked_input) + available_inputs.Add(input) var/obj/item/integrated_circuit/input/choice = input(user, "What do you want to interact with?", "Interaction") as null|anything in available_inputs if(choice) choice.ask_for_input(user) diff --git a/code/modules/integrated_electronics/input_output.dm b/code/modules/integrated_electronics/input_output.dm index 8f9c2cac04..4bb4c01309 100644 --- a/code/modules/integrated_electronics/input_output.dm +++ b/code/modules/integrated_electronics/input_output.dm @@ -1,3 +1,6 @@ +/obj/item/integrated_circuit/input + var/can_be_asked_input = 0 + /obj/item/integrated_circuit/input/proc/ask_for_input(mob/user) return @@ -9,6 +12,7 @@ number_of_outputs = 0 number_of_activators = 1 complexity = 1 + can_be_asked_input = 1 activator_names = list( "on pressed" ) @@ -28,6 +32,7 @@ number_of_outputs = 1 number_of_activators = 1 complexity = 2 + can_be_asked_input = 1 output_names = list( "number entered" ) @@ -36,8 +41,8 @@ ) /obj/item/integrated_circuit/input/numberpad/ask_for_input(mob/user) - var/new_input = input(user, "Enter a number, please.","Number pad") as num - if(new_input && isnum(new_input)) + var/new_input = input(user, "Enter a number, please.","Number pad") as null|num + if(isnum(new_input)) var/datum/integrated_io/O = outputs[1] O.data = new_input O.push_data() @@ -53,6 +58,7 @@ number_of_outputs = 1 number_of_activators = 1 complexity = 2 + can_be_asked_input = 1 output_names = list( "string entered" ) @@ -61,7 +67,7 @@ ) /obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user) - var/new_input = input(user, "Enter some words, please.","Number pad") as text + var/new_input = input(user, "Enter some words, please.","Number pad") as null|text if(new_input && istext(new_input)) var/datum/integrated_io/O = outputs[1] O.data = new_input @@ -70,6 +76,127 @@ if(A.linked) A.holder.work() +/obj/item/integrated_circuit/input/med_scanner + name = "integrated medical analyser" + desc = "A very small version of the common medical analyser. This allows the machine to know how healthy someone is." + number_of_inputs = 1 + number_of_outputs = 2 + number_of_activators = 1 + complexity = 4 + input_names = list( + "target ref" + ) + output_names = list( + "total health %", + "total missing health" + ) + activator_names = list( + "scan" + ) + +/obj/item/integrated_circuit/input/med_scanner/work() + if(..()) + var/datum/integrated_io/I = inputs[1] + if(!I.data || !ishuman(I.data)) //Invalid input + return + var/mob/living/carbon/human/H = I.data + if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. + var/total_health = round(H.health/H.maxHealth, 0.1)*100 + var/missing_health = H.maxHealth - H.health + + var/datum/integrated_io/total = outputs[1] + var/datum/integrated_io/missing = outputs[2] + + total.data = total_health + missing.data = missing_health + + for(var/datum/integrated_io/output/O in outputs) + O.push_data() + +/obj/item/integrated_circuit/input/adv_med_scanner + name = "integrated advanced medical analyser" + desc = "A very small version of the common medical analyser. This allows the machine to know how healthy someone is. \ + This type is much more precise, allowing the machine to know much more about the target than a normal analyzer." + number_of_inputs = 1 + number_of_outputs = 7 + number_of_activators = 1 + complexity = 12 + input_names = list( + "target ref" + ) + output_names = list( + "total health %", + "total missing health", + "brute damage", + "burn damage", + "tox damage", + "oxy damage", + "clone damage" + ) + activator_names = list( + "scan" + ) + +/obj/item/integrated_circuit/input/adv_med_scanner/work() + if(..()) + var/datum/integrated_io/I = inputs[1] + if(!I.data || !ishuman(I.data)) //Invalid input + return + var/mob/living/carbon/human/H = I.data + if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. + var/total_health = round(H.health/H.maxHealth, 0.1)*100 + var/missing_health = H.maxHealth - H.health + + var/datum/integrated_io/total = outputs[1] + var/datum/integrated_io/missing = outputs[2] + var/datum/integrated_io/brute = outputs[3] + var/datum/integrated_io/burn = outputs[4] + var/datum/integrated_io/tox = outputs[5] + var/datum/integrated_io/oxy = outputs[6] + var/datum/integrated_io/clone = outputs[7] + + total.data = total_health + missing.data = missing_health + brute.data = H.getBruteLoss() + burn.data = H.getFireLoss() + tox.data = H.getToxLoss() + oxy.data = H.getOxyLoss() + clone.data = H.getCloneLoss() + + for(var/datum/integrated_io/output/O in outputs) + O.push_data() + +/obj/item/integrated_circuit/input/local_locator + name = "local locator" + desc = "This is needed for certain devices that demand a reference for a target to act upon. This type only locates something \ + that is holding the machine containing it." + number_of_inputs = 0 + number_of_outputs = 1 + number_of_activators = 1 + complexity = 4 + output_names = list( + "located ref" + ) + activator_names = list( + "locate" + ) + +/obj/item/integrated_circuit/input/local_locator/work() + if(..()) + var/mob/living/L = null + var/datum/integrated_io/O = outputs[1] + O.data = null + if(istype(src.loc, /obj/item/device/electronic_assembly)) // Check to make sure we're actually in a machine. + var/obj/item/device/electronic_assembly/assembly = src.loc + if(istype(assembly.loc, /mob/living)) // Now check if someone's holding us. + L = assembly.loc + + if(L) + O.data = L + + O.push_data() + + /obj/item/integrated_circuit/output/screen name = "screen" desc = "This small screen can display a single piece of data, when the machine is examined closely." diff --git a/code/modules/integrated_electronics/memory.dm b/code/modules/integrated_electronics/memory.dm index 3305cf0a93..ec06c7784b 100644 --- a/code/modules/integrated_electronics/memory.dm +++ b/code/modules/integrated_electronics/memory.dm @@ -58,26 +58,41 @@ number_of_outputs = 1 number_of_activators = 1 activator_names = list( - "trigger output" + "push data" ) + var/accepting_refs = 0 /obj/item/integrated_circuit/memory/constant/work() - if(..()) - var/datum/integrated_io/O = outputs[1] - O.push_data() - -/obj/item/integrated_circuit/memory/constant/attack_hand(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") + O.push_data() + +/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/new_data = null switch(type_to_use) if("string") + accepting_refs = 0 new_data = input("Now type in a string.","[src] string writing") as null|text if(istext(new_data)) O.data = new_data - user << "You set \the [src]'s memory to '[new_data]'." + user << "You set \the [src]'s memory to [O.display_data()]." if("number") + accepting_refs = 0 new_data = input("Now type in a number.","[src] number writing") as null|num if(isnum(new_data)) O.data = new_data - user << "You set \the [src]'s memory to '[new_data]'." \ No newline at end of file + user << "You set \the [src]'s memory to [O.display_data()]." + if("ref") + 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." + +/obj/item/integrated_circuit/memory/constant/afterattack(atom/target, mob/living/user, proximity) + if(accepting_refs && proximity) + var/datum/integrated_io/O = outputs[1] + O.data = target + visible_message("[user] slides \a [src]'s over \the [target].") + user << "You set \the [src]'s memory to a reference to [O.display_data()]. The ref scanner is \ + now off." + accepting_refs = 0 \ No newline at end of file diff --git a/code/modules/integrated_electronics/time.dm b/code/modules/integrated_electronics/time.dm index 99c8a42436..6f8d18cdb1 100644 --- a/code/modules/integrated_electronics/time.dm +++ b/code/modules/integrated_electronics/time.dm @@ -26,7 +26,7 @@ name = "five-sec delay circuit" desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \ This circuit is set to send a pulse after a delay of five seconds." - delay = 10 + delay = 50 /obj/item/integrated_circuit/time/delay/one_sec name = "one-sec delay circuit" @@ -109,12 +109,26 @@ name = "integrated clock" desc = "Tells you what the local time is, specific to your station or planet." number_of_inputs = 0 - number_of_outputs = 6 + number_of_outputs = 4 number_of_activators = 1 output_names = list( "time (string)", - "minute (string)", - "hour (string)", - "minute (number)", - "hour (number)", - ) \ No newline at end of file + "hours (number)", + "minutes (number)", + "seconds (number)" + ) + +/obj/item/integrated_circuit/time/clock/work() + if(..()) + var/datum/integrated_io/time = outputs[1] + var/datum/integrated_io/hour = outputs[2] + var/datum/integrated_io/min = outputs[3] + var/datum/integrated_io/sec = outputs[4] + + time.data = time2text(station_time_in_ticks, "hh:mm:ss") + hour.data = text2num(time2text(station_time_in_ticks, "hh")) + min.data = text2num(time2text(station_time_in_ticks, "mm")) + sec.data = text2num(time2text(station_time_in_ticks, "ss")) + + for(var/datum/integrated_io/output/O in outputs) + O.push_data() \ No newline at end of file diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 943dd7a903..8461d87ea7 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -1682,6 +1682,23 @@ CIRCUITS BELOW build_path = /obj/item/integrated_circuit/output/screen sort_string = "WAAED" +/datum/design/circuit/integrated_circuit/input_output/med_scanner + id = "cc-medscanner" + build_path = /obj/item/integrated_circuit/input/med_scanner + req_tech = list(TECH_MATERIAL = 2, TECH_MAGNETS = 2, TECH_BIOMED = 2) + sort_string = "WAAEE" + +/datum/design/circuit/integrated_circuit/input_output/adv_med_scanner + id = "cc-advmedscanner" + build_path = /obj/item/integrated_circuit/input/adv_med_scanner + req_tech = list(TECH_MATERIAL = 2, TECH_MAGNETS = 3, TECH_BIOMED = 4) + sort_string = "WAAEF" + +/datum/design/circuit/integrated_circuit/input_output/local_locator + id = "cc-locallocator" + build_path = /obj/item/integrated_circuit/input/local_locator + sort_string = "WAAEG" + /datum/design/circuit/integrated_circuit/logic/AssembleDesignName() @@ -1740,7 +1757,7 @@ CIRCUITS BELOW sort_string = "WAAGA" req_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 4, TECH_COMBAT = 5) -/datum/design/circuit/integrated_circuit/manipulation/weapon_firing +/datum/design/circuit/integrated_circuit/manipulation/smoke id = "cc-smoke" build_path = /obj/item/integrated_circuit/manipulation/smoke sort_string = "WAAGB" diff --git a/icons/obj/electronic_assemblies.dmi b/icons/obj/electronic_assemblies.dmi index e4fd3c230b..18ba8650ee 100644 Binary files a/icons/obj/electronic_assemblies.dmi and b/icons/obj/electronic_assemblies.dmi differ