diff --git a/code/modules/integrated_electronics/_defines.dm b/code/modules/integrated_electronics/_defines.dm index 4741f4f89e..e4c103d63f 100644 --- a/code/modules/integrated_electronics/_defines.dm +++ b/code/modules/integrated_electronics/_defines.dm @@ -7,6 +7,7 @@ icon = 'icons/obj/electronic_assemblies.dmi' icon_state = "template" w_class = 1 + var/extended_desc = null var/list/inputs = list() var/list/outputs = list() var/list/activators = list() @@ -34,6 +35,8 @@ if(A.linked.len) user << "\The [A.name] is connected to [A.get_linked_to_desc()]." + interact(user) + /obj/item/integrated_circuit/New() ..() var/i = 0 @@ -65,7 +68,7 @@ i = 1 if(activator_names.len) - for(var/datum/integrated_io/activate/A in outputs) + for(var/datum/integrated_io/activate/A in activators) A.name = "[activator_names[i]]" i++ @@ -78,6 +81,10 @@ qdel(A) ..() +/obj/item/integrated_circuit/emp_act(severity) + for(var/datum/integrated_io/io in inputs + outputs + activators) + io.scramble() + /obj/item/integrated_circuit/verb/rename_component() set name = "Rename Circuit" set category = "Object" @@ -91,6 +98,153 @@ M << "The circuit '[src.name]' is now labeled '[input]'." name = input +/obj/item/integrated_circuit/proc/get_pin_ref(var/pin_type, var/pin_number) + switch(pin_type) + if("input") + if(pin_number > inputs.len) + return null + return inputs[pin_number] + if("output") + if(pin_number > outputs.len) + return null + return outputs[pin_number] + if("activator") + if(pin_number > activators.len) + return null + return activators[pin_number] + return null + +/obj/item/integrated_circuit/interact(mob/user) + if(get_dist(src, user) > 1) + user.unset_machine(src) + return + var/HTML = "[src.name]" + HTML += "
" + HTML += "" + + HTML += "" + HTML += "" + HTML += "" + HTML += "" + HTML += "" + + var/column_width = 3 + var/row_height = max(inputs.len, outputs.len, 1) + var/i + var/j + for(i = 1, i < row_height+1, i++) + HTML += "" + for(j = 1, j < column_width+1, j++) + var/datum/integrated_io/io = null + var/words = null + var/height = 1 + switch(j) + if(1) + io = get_pin_ref("input",i) + if(io) + if(io.linked.len) + words = "[io.name] [io.display_data()]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + else // "Click here!" + words = "[io.name] [io.display_data()]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + if(outputs.len > inputs.len) + height = Floor(outputs.len / inputs.len) + //world << "I wrote [words] at ([i],[j])." + 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])." + else + continue + if(3) + io = get_pin_ref("output",i) + if(io) + if(io.linked.len) + words = "[io.name] [io.display_data()]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + else + words = "[io.name] [io.display_data()]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + if(inputs.len > outputs.len) + height = Floor(inputs.len / outputs.len) + //world << "I wrote [words] at ([i],[j])." + HTML += "" + //HTML += "" + //world << "Writing to ([i],[j])." + HTML += "" + + if(activators.len) + for(i = 1, i < activators.len+1, i++) + var/datum/integrated_io/io = null + var/words = null + io = get_pin_ref("activator",i) + if(io) + if(io.linked.len) + words = "[io.name]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + else // "Click here!" + words = "[io.name]
" + for(var/datum/integrated_io/linked in io.linked) + words += "\[[linked.name]\] \ + @ [linked.holder]
" + HTML += "" + HTML += "" + HTML += "" + + HTML += "
[words][words]
[words]
" + HTML += "
" + + HTML += "

Refresh" + HTML += "
[extended_desc]" + + HTML += "" + user << browse(HTML, "window=circuit-\ref[src];size=400x440;border=1;can_resize=1;can_close=1;can_minimize=1") + + user.set_machine(src) + onclose(user, "circuit-\ref[src]") + //user << sanitize(HTML, "window=debug;size=400x400;border=1;can_resize=1;can_close=1;can_minimize=1") + //world << sanitize(HTML) + +/obj/item/integrated_circuit/Topic(href, href_list[]) + if(..()) + return 1 + var/user = locate(href_list["user"]) in mob_list + var/pin = locate(href_list["pin"]) in contents + switch(href_list["action"]) + if("examine") + examine(user) + + if("wire") + if(ishuman(user) && Adjacent(user)) + var/mob/living/carbon/human/H = user + var/obj/item/device/integrated_electronics/wirer/wirer = null + if(istype(H.r_hand, /obj/item/device/integrated_electronics/wirer)) + wirer = H.r_hand + else if(istype(H.l_hand, /obj/item/device/integrated_electronics/wirer)) + wirer = H.l_hand + + if(wirer && pin) + wirer.wire(pin, user) + else + user << "You can't do a whole lot without tools." + + //updateDialog() + world << "[src] received Topic([href], [href_list]) call from [user]." + world << "href_list contained [english_list(href_list)]." + interact(user) + /datum/integrated_io var/name = "input/output" var/obj/item/integrated_circuit/holder = null @@ -110,6 +264,70 @@ holder = null ..() +/datum/integrated_io/Topic(href, href_list[]) + if(..()) + return 1 + var/user = locate(href_list["user"]) in mob_list + switch(href_list["action"]) + // if("view") + // var/HTML = "[src.name]" + // HTML += "Parent: [holder]" + // HTML += "Pin Type: [io_type]" + // HTML += "Linked Pins:
" + // for(var/datum/integrated_io/io in src.linked) + // HTML += "[io.name] [io.display_data()] @ [io.holder]
" + // HTML += "\[Wire This\]" + // + // HTML += "" + // user << browse(HTML, "window=pin-\ref[src];size=400x400;border=1;can_resize=1;can_close=1;can_minimize=1") + + if("examine_holder") + holder.examine(user) + + if("wire") + if(ishuman(user)) + var/mob/living/carbon/human/H = user + var/obj/item/device/integrated_electronics/wirer/wirer = null + if(istype(H.r_hand, /obj/item/device/integrated_electronics/wirer)) + wirer = H.r_hand + else if(istype(H.l_hand, /obj/item/device/integrated_electronics/wirer)) + wirer = H.l_hand + + if(wirer) + wirer.wire(src, user) + + + + else + user << "You can't do a whole lot without tools." + //updateDialog() + //world << "[src] inside [src.holder] was clicked by [user]." + +/datum/integrated_io/proc/display_data() + if(!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'. + if(istype(data, /atom)) + var/atom/A = data + return "([A.name] \[Ref\])" // For refs, we want just the name displayed. + return "([data])" // Nothing special needed for numbers or other stuff. + +/datum/integrated_io/activate/display_data() + return "(\[pulse\])" + +/datum/integrated_io/proc/scramble() + if(isnull(data)) + return + if(isnum(data)) + data = rand(-10000, 10000) + if(istext(data)) + data = "ERROR" + push_data() + +/datum/integrated_io/activate/scramble() + push_data() + /datum/integrated_io/proc/push_data() if(linked.len) for(var/datum/integrated_io/io in linked) diff --git a/code/modules/integrated_electronics/assemblies.dm b/code/modules/integrated_electronics/assemblies.dm index edb8276419..92faa84750 100644 --- a/code/modules/integrated_electronics/assemblies.dm +++ b/code/modules/integrated_electronics/assemblies.dm @@ -6,6 +6,7 @@ icon_state = "setup" var/max_components = 10 var/max_complexity = 30 + var/opened = 0 /obj/item/device/electronic_assembly/medium name = "electronic setup" @@ -36,12 +37,20 @@ /obj/item/device/electronic_assembly/examine(mob/user) ..() - for(var/obj/item/integrated_circuit/output/screen/S in contents) - if(S.stuff_to_display) - user << "There's a little screen which displays '[S.stuff_to_display]'." + if(!opened) + for(var/obj/item/integrated_circuit/output/screen/S in contents) + if(S.stuff_to_display) + user << "There's a little screen 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)) + if(!opened) + user << "\The [src] isn't opened, so you can't put anything inside. Try using a crowbar." + return 0 var/obj/item/integrated_circuit/IC = I var/total_parts = 0 var/total_complexity = 0 @@ -50,17 +59,20 @@ total_complexity = total_complexity + part.complexity if( (total_parts + 1) >= max_components) - user << "You can't seem to add this [IC.name], since this setup's too complicated for the case." + user << "You can't seem to add this [IC.name], since there's no more room." return 0 if( (total_complexity + IC.complexity) >= max_complexity) - user << "You can't seem to add this [IC.name], since there's no more room." + user << "You can't seem to add this [IC.name], since this setup's too complicated for the case." return 0 user << "You slide \the [IC] inside \the [src]." user.drop_item() IC.forceMove(src) playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1) - if(istype(I, /obj/item/weapon/crowbar)) + if(istype(I, /obj/item/weapon/screwdriver)) + if(!opened) + user << "\The [src] isn't opened, so you can't remove anything inside. Try using a crowbar." + return 0 if(!contents.len) user << "There's nothing inside this to remove!" return 0 @@ -69,6 +81,11 @@ option.disconnect_all() option.forceMove(get_turf(src)) playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) + user << "You pop \the [option] out of the case, and slide it out." + if(istype(I, /obj/item/weapon/crowbar)) + playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) + opened = !opened + user << "You [opened ? "opened" : "closed"] \the [src]." /obj/item/device/electronic_assembly/attack_self(mob/user) var/list/available_inputs = list() @@ -77,3 +94,8 @@ 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) + +/obj/item/device/electronic_assembly/emp_act(severity) + ..() + for(var/atom/movable/AM in contents) + AM.emp_act(severity) diff --git a/code/modules/integrated_electronics/converters.dm b/code/modules/integrated_electronics/converters.dm new file mode 100644 index 0000000000..c32197922d --- /dev/null +++ b/code/modules/integrated_electronics/converters.dm @@ -0,0 +1,101 @@ +//These circuits convert one variable to another. +/obj/item/integrated_circuit/converter + complexity = 2 + number_of_inputs = 1 + number_of_outputs = 1 + number_of_activators = 1 + input_names = list( + "input", + ) + output_names = list( + "result" + ) + activator_names = list( + "convert" + ) + +/obj/item/integrated_circuit/converter/num2text + name = "number to string" + desc = "This circuit can convert a number variable into a string." + icon_state = "addition" + +/obj/item/integrated_circuit/converter/num2text/work() + var/result = null + var/datum/integrated_io/incoming = inputs[1] + var/datum/integrated_io/outgoing = outputs[1] + if(incoming.data && isnum(incoming.data)) + result = num2text(incoming.data) + + outgoing.data = result + outgoing.push_data() + + ..() + +/obj/item/integrated_circuit/converter/text2num + name = "number to string" + desc = "This circuit can convert a string variable into a number." + icon_state = "addition" + +/obj/item/integrated_circuit/converter/text2num/work() + var/result = null + var/datum/integrated_io/incoming = inputs[1] + var/datum/integrated_io/outgoing = outputs[1] + if(incoming.data && istext(incoming.data)) + result = text2num(incoming.data) + + outgoing.data = result + outgoing.push_data() + + ..() + +/obj/item/integrated_circuit/converter/ref2text + name = "reference to string" + desc = "This circuit can convert a reference to something else to a string, specifically the name of that reference." + icon_state = "addition" + +/obj/item/integrated_circuit/converter/ref2text/work() + var/result = null + var/datum/integrated_io/incoming = inputs[1] + var/datum/integrated_io/outgoing = outputs[1] + if(incoming.data && istype(incoming.data, /atom/)) + var/atom/A = incoming.data + result = A.name + + outgoing.data = result + outgoing.push_data() + + ..() + +/obj/item/integrated_circuit/converter/lowercase + name = "lowercase string converter" + desc = "this will cause a string to come out in all lowercase." + icon_state = "addition" + +/obj/item/integrated_circuit/converter/lowercase/work() + var/result = null + var/datum/integrated_io/incoming = inputs[1] + var/datum/integrated_io/outgoing = outputs[1] + if(incoming.data && istext(incoming.data)) + result = lowertext(incoming.data) + + outgoing.data = result + outgoing.push_data() + + ..() + +/obj/item/integrated_circuit/converter/uppercase + name = "uppercase string converter" + desc = "THIS WILL CAUSE A STRING TO COME OUT IN ALL UPPERCASE." + icon_state = "addition" + +/obj/item/integrated_circuit/converter/uppercase/work() + var/result = null + var/datum/integrated_io/incoming = inputs[1] + var/datum/integrated_io/outgoing = outputs[1] + if(incoming.data && istext(incoming.data)) + result = uppertext(incoming.data) + + outgoing.data = result + outgoing.push_data() + + ..() \ No newline at end of file diff --git a/code/modules/integrated_electronics/coordinate.dm b/code/modules/integrated_electronics/coordinate.dm new file mode 100644 index 0000000000..89fd592def --- /dev/null +++ b/code/modules/integrated_electronics/coordinate.dm @@ -0,0 +1,74 @@ +//This circuit gives information on where the machine is. +/obj/item/integrated_circuit/gps + name = "global positioning system" + desc = "This allows you to easily know the position of a machine containing this device." + complexity = 4 + number_of_inputs = 0 + number_of_outputs = 2 + number_of_activators = 1 + input_names = list( + ) + output_names = list( + "X (abs)", + "Y (abs)" + ) + activator_names = list( + "get coordinates" + ) + +/obj/item/integrated_circuit/gps/work() + var/turf/T = get_turf(src) + var/datum/integrated_io/result_x = outputs[1] + var/datum/integrated_io/result_y = outputs[2] + + result_x.data = null + result_y.data = null + if(!T) + return + + result_x.data = T.x + result_y.data = T.y + + for(var/datum/integrated_io/output/O in outputs) + O.push_data() + ..() + +/obj/item/integrated_circuit/abs_to_rel_coords + name = "abs to rel coordinate converter" + desc = "Easily convert absolute coordinates to relative coordinates with this." + complexity = 4 + number_of_inputs = 0 + number_of_outputs = 4 + number_of_activators = 1 + input_names = list( + "X1 (abs)", + "Y1 (abs)", + "X2 (abs)", + "Y2 (abs)" + ) + output_names = list( + "X (rel)", + "Y (rel)" + ) + activator_names = list( + "compute rel coordinates" + ) + +/obj/item/integrated_circuit/abs_to_rel_coords/work() + var/datum/integrated_io/x1 = inputs[1] + var/datum/integrated_io/y1 = inputs[2] + + var/datum/integrated_io/x2 = inputs[3] + var/datum/integrated_io/y2 = inputs[4] + + var/datum/integrated_io/result_x = outputs[1] + var/datum/integrated_io/result_y = outputs[2] + + if(x1.data && y1.data && x2.data && y2.data) + result_x.data = x1.data - x2.data + result_y.data = y1.data - y2.data + + + for(var/datum/integrated_io/output/O in outputs) + O.push_data() + ..() diff --git a/code/modules/integrated_electronics/logic.dm b/code/modules/integrated_electronics/logic.dm index 1492db34b9..4a5d65c5f9 100644 --- a/code/modules/integrated_electronics/logic.dm +++ b/code/modules/integrated_electronics/logic.dm @@ -72,6 +72,7 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 @@ -90,6 +91,7 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 @@ -108,6 +110,7 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 @@ -126,6 +129,7 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 @@ -134,7 +138,7 @@ desc = "This will output 'one' if the first input is greater than the second input." icon_state = "greater_than" -/obj/item/integrated_circuit/logic/geater_than/work() +/obj/item/integrated_circuit/logic/greater_than/work() ..() var/datum/integrated_io/A = inputs[1] var/datum/integrated_io/B = inputs[2] @@ -144,6 +148,7 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 @@ -162,5 +167,6 @@ O.data = 1 O.push_data() A.push_data() + P.push_data() else O.data = 0 \ No newline at end of file diff --git a/code/modules/integrated_electronics/manipulation.dm b/code/modules/integrated_electronics/manipulation.dm new file mode 100644 index 0000000000..5724c79ad8 --- /dev/null +++ b/code/modules/integrated_electronics/manipulation.dm @@ -0,0 +1,87 @@ +/obj/item/integrated_circuit/weapon_firing + name = "weapon firing mechanism" + desc = "This somewhat complicated system allows one to slot in a gun, direct it towards a position, and remotely fire it." + extended_desc = "The firing mechanism can slot in most ranged weapons, ballistic and energy. \ + The first and second inputs need to be numbers. They are coordinates for the gun to fire at, relative to the machine itself. \ + The 'fire' activator will cause the mechanism to attempt to fire the weapon at the coordinates, if possible. Note that the \ + normal limitations to firearms, such as ammunition requirements and firing delays, still hold true if fired by the mechanism." + complexity = 20 + number_of_inputs = 2 + number_of_outputs = 0 + number_of_activators = 1 + input_names = list( + "target X rel", + "target Y rel" + ) + activator_names = list( + "fire" + ) + var/obj/item/weapon/gun/installed_gun = null + +/obj/item/integrated_circuit/weapon_firing/Destroy() + qdel(installed_gun) + ..() + +/obj/item/integrated_circuit/weapon_firing/attackby(var/obj/O, var/mob/user) + if(istype(O, /obj/item/weapon/gun)) + var/obj/item/weapon/gun/gun = O + if(installed_gun) + user << "There's already a weapon installed." + return + user.drop_from_inventory(gun) + installed_gun = gun + gun.forceMove(src) + user << "You slide \the [gun] into the firing mechanism." + playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) + else + ..() + +/obj/item/integrated_circuit/weapon_firing/attack_self(var/mob/user) + if(installed_gun) + installed_gun.forceMove(get_turf(src)) + user << "You slide \the [installed_gun] out of the firing mechanism." + playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1) + installed_gun = null + else + user << "There's no weapon to remove from the mechanism." + +/obj/item/integrated_circuit/weapon_firing/work() + if(!installed_gun) + return + + var/datum/integrated_io/target_x = inputs[1] + var/datum/integrated_io/target_y = inputs[2] + + if(target_x.data && target_y.data && isnum(target_x.data) && isnum(target_y.data)) + var/turf/T = get_turf(src) + + if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves. + return + + // We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates. + var/i + if(target_x.data > 0) + i = abs(target_x.data) + while(i) + T = get_step(T, EAST) + i-- + else if(target_x.data < 0) + i = abs(target_x.data) + while(i) + T = get_step(T, WEST) + i-- + + if(target_y.data > 0) + i = abs(target_y.data) + while(i) + T = get_step(T, NORTH) + i-- + else if(target_y.data < 0) + i = abs(target_y.data) + while(i) + T = get_step(T, SOUTH) + i-- + + if(!T) + return + installed_gun.Fire_userless(T) \ No newline at end of file diff --git a/code/modules/integrated_electronics/time.dm b/code/modules/integrated_electronics/time.dm index 9585495ec6..f076506222 100644 --- a/code/modules/integrated_electronics/time.dm +++ b/code/modules/integrated_electronics/time.dm @@ -5,13 +5,113 @@ number_of_inputs = 0 number_of_outputs = 0 +/obj/item/integrated_circuit/time/delay + name = "two-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 two seconds." + number_of_activators = 2 + var/delay = 20 + activator_names = list( + "incoming pulse", + "outgoing pulse" + ) + +/obj/item/integrated_circuit/time/delay/work() + ..() + var/datum/integrated_io/out_pulse = activators[2] + sleep(delay) + out_pulse.push_data() + +/obj/item/integrated_circuit/time/delay/five_sec + 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 + +/obj/item/integrated_circuit/time/delay/one_sec + name = "one-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 one second." + delay = 10 + +/obj/item/integrated_circuit/time/delay/half_sec + name = "half-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 half a second." + delay = 5 + +/obj/item/integrated_circuit/time/delay/tenth_sec + name = "tenth-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 1/10th of a second." + delay = 1 + +/obj/item/integrated_circuit/time/delay/custom + name = "custom delay circuit" + desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \ + This circuit's delay can be customized, between 1/10th of a second to one hour. The delay is updated upon receiving a pulse." + number_of_inputs = 1 + input_names = list( + "delay time", + ) + +/obj/item/integrated_circuit/time/delay/custom/work() + var/datum/integrated_io/delay_input = inputs[1] + if(delay_input.data && isnum(delay_input.data) ) + var/new_delay = min(delay_input.data, 1) + new_delay = max(new_delay, 36000) //An hour. + delay = new_delay + + ..() + +/obj/item/integrated_circuit/time/ticker + name = "ticker circuit" + desc = "This circuit sends an automatic pulse every four seconds." + complexity = 8 + number_of_inputs = 1 + number_of_activators = 1 + var/ticks_to_pulse = 2 + var/ticks_completed = 0 + input_names = list( + "toggle ticking" + ) + activator_names = list( + "outgoing pulse" + ) + +/obj/item/integrated_circuit/time/ticker/New() + ..() + processing_objects |= src + +/obj/item/integrated_circuit/time/ticker/Destroy() + processing_objects -= src + +/obj/item/integrated_circuit/time/ticker/process() + ticks_completed++ + if( (ticks_completed % ticks_to_pulse) == 0) + var/datum/integrated_io/pulser = activators[1] + pulser.push_data() + +/obj/item/integrated_circuit/time/ticker/fast + name = "fast ticker" + desc = "This advanced circuit sends an automatic pulse every two seconds." + complexity = 12 + ticks_to_pulse = 1 + +/obj/item/integrated_circuit/time/ticker/slow + name = "slow ticker" + desc = "This simple circuit sends an automatic pulse every six seconds." + complexity = 4 + ticks_to_pulse = 3 + + /obj/item/integrated_circuit/time/clock 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_activators = 1 - name_of_outputs = list( + output_names = list( "time (string)", "minute (string)", "hour (string)", diff --git a/code/modules/integrated_electronics/tools.dm b/code/modules/integrated_electronics/tools.dm index a0d9048e91..79ba8b95a2 100644 --- a/code/modules/integrated_electronics/tools.dm +++ b/code/modules/integrated_electronics/tools.dm @@ -22,7 +22,7 @@ if(istext(temporary_data)) probe.data = temporary_data if("number") - temporary_data = sanitize(input(user, "Please a number.", "number input") as null|num) + temporary_data = sanitize(input(user, "Please give a number.", "number input") as null|num) if(isnum(temporary_data)) probe.data = temporary_data if("reference") @@ -63,8 +63,10 @@ /obj/item/device/integrated_electronics/wirer - name = "data wirer" - desc = "Used to connect various inputs and outputs together." + name = "circuit wirer" + desc = "It's a small wiring tool, with a wire roll, electric soldering iron, wire cutter, and more in one package. \ + The wires used are generally useful for small electronics, such as circuitboards and breadboards, as opposed to larger wires \ + used for power or data transmission." icon_state = "multitool" flags = CONDUCT w_class = 2 @@ -74,6 +76,58 @@ /obj/item/device/integrated_electronics/wirer/New() ..() +/obj/item/device/integrated_electronics/wirer/proc/wire(var/datum/integrated_io/io, mob/user) + if(mode == WIRE) + selected_io = io + user << "You attach a data wire to \the [selected_io.holder]'s [selected_io.name] data channel." + mode = WIRING + else if(mode == WIRING) + if(io == selected_io) + user << "Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless." + return + if(io.io_type != selected_io.io_type) + user << "Those two types of channels are incompatable. The first is a [selected_io.io_type], \ + while the second is a [io.io_type]." + return + selected_io.linked |= io + io.linked |= selected_io + + user << "You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name]." + mode = WIRE + //io.updateDialog() + //selected_io.updateDialog() + selected_io = null + + else if(mode == UNWIRE) + selected_io = io + if(!io.linked.len) + user << "There is nothing connected to \the [selected_io] data channel." + selected_io = null + return + user << "You prepare to detach a data wire from \the [selected_io.holder]'s [selected_io.name] data channel." + mode = UNWIRING + return + + else if(mode == UNWIRING) + if(io == selected_io) + user << "You can't wire a pin into each other, so unwiring \the [selected_io.holder] from \ + the same pin is rather moot." + return + if(selected_io in io.linked) + io.linked.Remove(selected_io) + selected_io.linked.Remove(io) + user << "You disconnect \the [selected_io.holder]'s [selected_io.name] from \ + \the [io.holder]'s [io.name]." + //io.updateDialog() + //selected_io.updateDialog() + selected_io = null + mode = UNWIRE + else + user << "\The [selected_io.holder]'s [selected_io.name] and \the [io.holder]'s \ + [io.name] are not connected." + return + return + /obj/item/device/integrated_electronics/wirer/afterattack(atom/target, mob/user) if(isobj(target)) if(mode == WIRE) @@ -158,6 +212,11 @@ mode = UNWIRE if(UNWIRE) mode = WIRE + if(UNWIRING) + if(selected_io) + user << "You decide not to disconnect the data channel." + selected_io = null + mode = UNWIRE user << "You set \the [src] to [mode]." #undef WIRE diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 8c3169b682..115d9f057f 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -254,6 +254,76 @@ if(muzzle_flash) set_light(0) +// Similar to the above proc, but does not require a user, which is ideal for things like turrets. +/obj/item/weapon/gun/proc/Fire_userless(atom/target) + if(!target) + return + + if(world.time < next_fire_time) + return + + var/shoot_time = (burst - 1)* burst_delay + next_fire_time = world.time + shoot_time + + var/turf/targloc = get_turf(target) //cache this in case target gets deleted during shooting, e.g. if it was a securitron that got destroyed. + for(var/i in 1 to burst) + var/obj/projectile = consume_next_projectile() + if(!projectile) + handle_click_empty() + break + + if(istype(projectile, /obj/item/projectile)) + var/obj/item/projectile/P = projectile + + var/acc = burst_accuracy[min(i, burst_accuracy.len)] + var/disp = dispersion[min(i, dispersion.len)] + + P.accuracy = accuracy + acc + P.dispersion = disp + + P.shot_from = src.name + P.silenced = silenced + + P.launch(target) + + if(silenced) + playsound(src, fire_sound, 10, 1) + else + playsound(src, fire_sound, 50, 1) + + if(muzzle_flash) + set_light(muzzle_flash) + update_icon() + + //process_accuracy(projectile, user, target, acc, disp) + + // if(pointblank) + // process_point_blank(projectile, user, target) + + // if(process_projectile(projectile, null, target, user.zone_sel.selecting, clickparams)) + // handle_post_fire(null, target, pointblank, reflex) + + // update_icon() + + if(i < burst) + sleep(burst_delay) + + if(!(target && target.loc)) + target = targloc + //pointblank = 0 + + log_and_message_admins("Fired [src].") + + //admin_attack_log(usr, attacker_message="Fired [src]", admin_message="fired a gun ([src]) (MODE: [src.mode_name]) [reflex ? "by reflex" : "manually"].") + + //update timing + next_fire_time = world.time + fire_delay + + if(muzzle_flash) + set_light(0) + + + //obtains the next projectile to fire /obj/item/weapon/gun/proc/consume_next_projectile() return null diff --git a/code/modules/shuttles/shuttle_ferry.dm b/code/modules/shuttles/shuttle_ferry.dm index 5d6663f3b5..0a288a1ba9 100644 --- a/code/modules/shuttles/shuttle_ferry.dm +++ b/code/modules/shuttles/shuttle_ferry.dm @@ -16,7 +16,7 @@ //TODO: change location to a string and use a mapping for area and dock targets. var/dock_target_station var/dock_target_offsite - + var/last_dock_attempt_time = 0 /datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination) @@ -85,15 +85,15 @@ long_jump(interim=area_transition, travel_time=move_time, direction=transit_direction) else short_jump() - + process_state = WAIT_ARRIVE - + if (WAIT_ARRIVE) if (moving_status == SHUTTLE_IDLE) dock() in_use = null //release lock process_state = WAIT_FINISH - + if (WAIT_FINISH) if (skip_docking_checks() || docking_controller.docked() || world.time > last_dock_attempt_time + DOCK_ATTEMPT_TIMEOUT) process_state = IDLE_STATE diff --git a/icons/obj/electronic_assemblies.dmi b/icons/obj/electronic_assemblies.dmi index e269d8b3e7..e4fd3c230b 100644 Binary files a/icons/obj/electronic_assemblies.dmi and b/icons/obj/electronic_assemblies.dmi differ diff --git a/polaris.dme b/polaris.dme index 784e6619a6..e2e62ef971 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1365,9 +1365,12 @@ #include "code\modules\integrated_electronics\_limits.dm" #include "code\modules\integrated_electronics\arithmetic.dm" #include "code\modules\integrated_electronics\assemblies.dm" +#include "code\modules\integrated_electronics\converters.dm" +#include "code\modules\integrated_electronics\coordinate.dm" #include "code\modules\integrated_electronics\data_transfer.dm" #include "code\modules\integrated_electronics\input_output.dm" #include "code\modules\integrated_electronics\logic.dm" +#include "code\modules\integrated_electronics\manipulation.dm" #include "code\modules\integrated_electronics\memory.dm" #include "code\modules\integrated_electronics\time.dm" #include "code\modules\integrated_electronics\tools.dm"