Fixes Circuit Bugs & QoL chances

This commit is contained in:
Neerti
2017-04-23 09:51:53 -04:00
parent 59a19f7197
commit 2c25fcec02
15 changed files with 431 additions and 405 deletions

View File

@@ -38,7 +38,10 @@
IC.examine(user) IC.examine(user)
/obj/item/weapon/implant/integrated_circuit/attackby(var/obj/item/O, var/mob/user) /obj/item/weapon/implant/integrated_circuit/attackby(var/obj/item/O, var/mob/user)
if(istype(O, /obj/item/weapon/crowbar) || istype(O, /obj/item/device/integrated_electronics) || istype(O, /obj/item/integrated_circuit) || istype(O, /obj/item/weapon/screwdriver) ) if(istype(O, /obj/item/weapon/crowbar) || istype(O, /obj/item/device/integrated_electronics) || istype(O, /obj/item/integrated_circuit) || istype(O, /obj/item/weapon/screwdriver) || istype(O, /obj/item/weapon/cell/device) )
IC.attackby(O, user) IC.attackby(O, user)
else else
..() ..()
/obj/item/weapon/implant/integrated_circuit/attack_self(mob/user)
IC.attack_self(user)

View File

@@ -8,7 +8,7 @@
#define IC_SPAWN_DEFAULT 1 // If the circuit comes in the default circuit box. #define IC_SPAWN_DEFAULT 1 // If the circuit comes in the default circuit box.
#define IC_SPAWN_RESEARCH 2 // If the circuit design will be autogenerated for RnD. #define IC_SPAWN_RESEARCH 2 // If the circuit design will be autogenerated for RnD.
#define IC_FORMAT_STRING "\<STRING\>" #define IC_FORMAT_STRING "\<TEXT\>"
#define IC_FORMAT_NUMBER "\<NUM\>" #define IC_FORMAT_NUMBER "\<NUM\>"
#define IC_FORMAT_REF "\<REF\>" #define IC_FORMAT_REF "\<REF\>"
#define IC_FORMAT_LIST "\<LIST\>" #define IC_FORMAT_LIST "\<LIST\>"

View File

@@ -107,6 +107,7 @@
for(var/obj/item/integrated_circuit/circuit in contents) for(var/obj/item/integrated_circuit/circuit in contents)
HTML += "<a href=?src=\ref[circuit];examine=1>[circuit.name]</a> | " HTML += "<a href=?src=\ref[circuit];examine=1>[circuit.name]</a> | "
HTML += "<a href=?src=\ref[circuit];rename=1>\[Rename\]</a> | " HTML += "<a href=?src=\ref[circuit];rename=1>\[Rename\]</a> | "
HTML += "<a href=?src=\ref[circuit];scan=1>\[Scan with Debugger\]</a> | "
if(circuit.removable) if(circuit.removable)
HTML += "<a href=?src=\ref[circuit];remove=1>\[Remove\]</a>" HTML += "<a href=?src=\ref[circuit];remove=1>\[Remove\]</a>"
HTML += "<br>" HTML += "<br>"
@@ -223,9 +224,10 @@
if(proximity) if(proximity)
var/scanned = FALSE var/scanned = FALSE
for(var/obj/item/integrated_circuit/input/sensor/S in contents) for(var/obj/item/integrated_circuit/input/sensor/S in contents)
S.set_pin_data(IC_OUTPUT, 1, weakref(target)) // S.set_pin_data(IC_OUTPUT, 1, weakref(target))
S.check_then_do_work() // S.check_then_do_work()
scanned = TRUE if(S.scan(target))
scanned = TRUE
if(scanned) if(scanned)
visible_message("<span class='notice'>\The [user] waves \the [src] around [target].</span>") visible_message("<span class='notice'>\The [user] waves \the [src] around [target].</span>")

View File

@@ -6,6 +6,7 @@ a creative player the means to solve many problems. Circuits are held inside an
/obj/item/integrated_circuit/examine(mob/user) /obj/item/integrated_circuit/examine(mob/user)
. = ..() . = ..()
external_examine(user) external_examine(user)
interact(user)
// This should be used when someone is examining while the case is opened. // This should be used when someone is examining while the case is opened.
/obj/item/integrated_circuit/proc/internal_examine(mob/user) /obj/item/integrated_circuit/proc/internal_examine(mob/user)
@@ -86,16 +87,14 @@ a creative player the means to solve many problems. Circuits are held inside an
var/HTML = list() var/HTML = list()
HTML += "<html><head><title>[src.name]</title></head><body>" HTML += "<html><head><title>[src.name]</title></head><body>"
HTML += "<div align='center'>" HTML += "<div align='center'>"
HTML += "<table border='1' style='undefined;table-layout: fixed; width: 424px'>" HTML += "<table border='1' style='undefined;table-layout: fixed; width: 80%'>"
HTML += "<br><a href='?src=\ref[src];'>\[Refresh\]</a> | " HTML += "<br><a href='?src=\ref[src];'>\[Refresh\]</a> | "
HTML += "<a href='?src=\ref[src];rename=1'>\[Rename\]</a> | " HTML += "<a href='?src=\ref[src];rename=1'>\[Rename\]</a> | "
HTML += "<a href='?src=\ref[src];scan=1'>\[Scan with Debugger\]</a> | "
HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>" HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>"
HTML += "<colgroup>" HTML += "<colgroup>"
//HTML += "<col style='width: 121px'>"
//HTML += "<col style='width: 181px'>"
//HTML += "<col style='width: 122px'>"
HTML += "<col style='width: [table_edge_width]'>" HTML += "<col style='width: [table_edge_width]'>"
HTML += "<col style='width: [table_middle_width]'>" HTML += "<col style='width: [table_middle_width]'>"
HTML += "<col style='width: [table_edge_width]'>" HTML += "<col style='width: [table_edge_width]'>"
@@ -212,6 +211,16 @@ a creative player the means to solve many problems. Circuits are held inside an
if(href_list["rename"]) if(href_list["rename"])
rename_component(usr) rename_component(usr)
if(href_list["scan"])
if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
var/obj/item/device/integrated_electronics/debugger/D = held_item
if(D.accepting_refs)
D.afterattack(src, usr, TRUE)
else
to_chat(usr, "<span class='warning'>The Debugger's 'ref scanner' needs to be on.</span>")
else
to_chat(usr, "<span class='warning'>You need a Debugger set to 'ref' mode to do that.</span>")
if(href_list["autopulse"]) if(href_list["autopulse"])
if(autopulse != -1) if(autopulse != -1)
autopulse = !autopulse autopulse = !autopulse
@@ -260,10 +269,10 @@ a creative player the means to solve many problems. Circuits are held inside an
return TRUE // Battery has enough. return TRUE // Battery has enough.
return FALSE // Not enough power. return FALSE // Not enough power.
/obj/item/integrated_circuit/proc/check_then_do_work() /obj/item/integrated_circuit/proc/check_then_do_work(var/ignore_power = FALSE)
if(world.time < next_use) // All intergrated circuits have an internal cooldown, to protect from spam. if(world.time < next_use) // All intergrated circuits have an internal cooldown, to protect from spam.
return return
if(power_draw_per_use) if(power_draw_per_use && !ignore_power)
if(!check_power()) if(!check_power())
power_fail() power_fail()
return return

View File

@@ -160,7 +160,7 @@
data_to_show = A.name data_to_show = A.name
to_chat(user, "<span class='notice'>You write '[data_to_write ? data_to_show : "NULL"]' to the '[io]' pin of \the [io.holder].</span>") to_chat(user, "<span class='notice'>You write '[data_to_write ? data_to_show : "NULL"]' to the '[io]' pin of \the [io.holder].</span>")
else if(io.io_type == PULSE_CHANNEL) else if(io.io_type == PULSE_CHANNEL)
io.holder.check_then_do_work() io.holder.check_then_do_work(ignore_power = TRUE)
to_chat(user, "<span class='notice'>You pulse \the [io.holder]'s [io].</span>") to_chat(user, "<span class='notice'>You pulse \the [io.holder]'s [io].</span>")
io.holder.interact(user) // This is to update the UI. io.holder.interact(user) // This is to update the UI.

View File

@@ -1,9 +1,18 @@
//These circuits do simple math. //These circuits do simple math.
/obj/item/integrated_circuit/arithmetic /obj/item/integrated_circuit/arithmetic
complexity = 1 complexity = 1
inputs = list("A","B","C","D","E","F","G","H") inputs = list(
outputs = list("result") "\<NUM\> A",
activators = list("compute") "\<NUM\> B",
"\<NUM\> C",
"\<NUM\> D",
"\<NUM\> E",
"\<NUM\> F",
"\<NUM\> G",
"\<NUM\> H"
)
outputs = list("\<NUM\> result")
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
category_text = "Arithmetic" category_text = "Arithmetic"
autopulse = 1 autopulse = 1
power_draw_per_use = 5 // Math is pretty cheap. power_draw_per_use = 5 // Math is pretty cheap.
@@ -30,9 +39,9 @@
if(isnum(I.data)) if(isnum(I.data))
result = result + I.data result = result + I.data
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// -Subtracting- // // -Subtracting- //
@@ -58,9 +67,9 @@
if(isnum(I.data)) if(isnum(I.data))
result = result - I.data result = result - I.data
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// *Multiply* // // *Multiply* //
@@ -86,9 +95,9 @@
if(isnum(I.data)) if(isnum(I.data))
result = result * I.data result = result * I.data
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// /Division/ // // /Division/ //
@@ -114,9 +123,9 @@
if(isnum(I.data) && I.data != 0) //No runtimes here. if(isnum(I.data) && I.data != 0) //No runtimes here.
result = result / I.data result = result / I.data
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
//^ Exponent ^// //^ Exponent ^//
@@ -134,9 +143,9 @@
if(isnum(A.data) && isnum(B.data)) if(isnum(A.data) && isnum(B.data))
result = A.data ** B.data result = A.data ** B.data
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// +-Sign-+ // // +-Sign-+ //
@@ -159,9 +168,9 @@
else else
result = 0 result = 0
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Round // // Round //
@@ -183,9 +192,9 @@
else else
result = round(A.data) result = round(A.data)
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Absolute // // Absolute //
@@ -204,9 +213,9 @@
if(isnum(I.data)) if(isnum(I.data))
result = abs(I.data) result = abs(I.data)
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Averaging // // Averaging //
@@ -229,9 +238,9 @@
if(inputs_used) if(inputs_used)
result = result / inputs_used result = result / inputs_used
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Pi, because why the hell not? // // Pi, because why the hell not? //
/obj/item/integrated_circuit/arithmetic/pi /obj/item/integrated_circuit/arithmetic/pi
@@ -242,9 +251,9 @@
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/arithmetic/pi/do_work() /obj/item/integrated_circuit/arithmetic/pi/do_work()
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, 3.14159)
O.data = 3.14159 push_data()
O.push_data() activate_pin(2)
// Random // // Random //
/obj/item/integrated_circuit/arithmetic/random /obj/item/integrated_circuit/arithmetic/random
@@ -253,20 +262,20 @@
extended_desc = "'Inclusive' means that the upper bound is included in the range of numbers, e.g. L = 1 and H = 3 will allow \ extended_desc = "'Inclusive' means that the upper bound is included in the range of numbers, e.g. L = 1 and H = 3 will allow \
for outputs of 1, 2, or 3. H being the higher number is not <i>strictly</i> required." for outputs of 1, 2, or 3. H being the higher number is not <i>strictly</i> required."
icon_state = "random" icon_state = "random"
inputs = list("L","H") inputs = list("\<NUM\> L","\<NUM\> H")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/arithmetic/random/do_work() /obj/item/integrated_circuit/arithmetic/random/do_work()
var/result = 0 var/result = 0
var/datum/integrated_io/L = inputs[1] var/L = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/H = inputs[2] var/H = get_pin_data(IC_INPUT, 2)
if(isnum(L.data) && isnum(H.data)) if(isnum(L) && isnum(H))
result = rand(L.data, H.data) result = rand(L, H)
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Square Root // // Square Root //
@@ -274,7 +283,7 @@
name = "square root circuit" name = "square root circuit"
desc = "This outputs the square root of a number you put in." desc = "This outputs the square root of a number you put in."
icon_state = "square_root" icon_state = "square_root"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/arithmetic/square_root/do_work() /obj/item/integrated_circuit/arithmetic/square_root/do_work()
@@ -284,9 +293,9 @@
if(isnum(I.data)) if(isnum(I.data))
result = sqrt(I.data) result = sqrt(I.data)
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// % Modulo % // // % Modulo % //
@@ -294,17 +303,17 @@
name = "modulo circuit" name = "modulo circuit"
desc = "Gets the remainder of A / B." desc = "Gets the remainder of A / B."
icon_state = "modulo" icon_state = "modulo"
inputs = list("A", "B") inputs = list("\<NUM\> A", "\<NUM\> B")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/arithmetic/modulo/do_work() /obj/item/integrated_circuit/arithmetic/modulo/do_work()
var/result = 0 var/result = 0
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/input/B = inputs[2] var/B = get_pin_data(IC_INPUT, 2)
if(isnum(A.data) && isnum(B.data) && B.data != 0) if(isnum(A) && isnum(B) && B != 0)
result = A.data % B.data result = A % B
for(var/datum/integrated_io/output/O in outputs) set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)

View File

@@ -3,7 +3,7 @@
complexity = 2 complexity = 2
inputs = list("input") inputs = list("input")
outputs = list("output") outputs = list("output")
activators = list("convert") activators = list("\<PULSE IN\> convert", "\<PULSE OUT\> on convert")
category_text = "Converter" category_text = "Converter"
autopulse = 1 autopulse = 1
power_draw_per_use = 10 power_draw_per_use = 10
@@ -16,89 +16,113 @@
name = "number to string" name = "number to string"
desc = "This circuit can convert a number variable into a string." desc = "This circuit can convert a number variable into a string."
icon_state = "num-string" icon_state = "num-string"
inputs = list("\<NUM\> input")
outputs = list("\<TEXT\> output")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/num2text/do_work() /obj/item/integrated_circuit/converter/num2text/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
if(incoming.data && isnum(incoming.data)) if(incoming && isnum(incoming))
result = num2text(incoming.data) result = num2text(incoming)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/text2num /obj/item/integrated_circuit/converter/text2num
name = "string to number" name = "string to number"
desc = "This circuit can convert a string variable into a number." desc = "This circuit can convert a string variable into a number."
icon_state = "string-num" icon_state = "string-num"
inputs = list("\<TEXT\> input")
outputs = list("\<NUM\> output")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/text2num/do_work() /obj/item/integrated_circuit/converter/text2num/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
if(incoming.data && istext(incoming.data)) if(incoming && istext(incoming))
result = text2num(incoming.data) result = text2num(incoming)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/ref2text /obj/item/integrated_circuit/converter/ref2text
name = "reference to string" name = "reference to string"
desc = "This circuit can convert a reference to something else to a string, specifically the name of that reference." desc = "This circuit can convert a reference to something else to a string, specifically the name of that reference."
icon_state = "ref-string" icon_state = "ref-string"
inputs = list("\<REF\> input")
outputs = list("\<TEXT\> output")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/ref2text/do_work() /obj/item/integrated_circuit/converter/ref2text/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/atom/A = get_pin_data(IC_INPUT, 1)
var/atom/A = incoming.data_as_type(/atom) if(A && istype(A))
result = A && A.name result = A.name
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/lowercase /obj/item/integrated_circuit/converter/lowercase
name = "lowercase string converter" name = "lowercase string converter"
desc = "this will cause a string to come out in all lowercase." desc = "this will cause a string to come out in all lowercase."
icon_state = "lowercase" icon_state = "lowercase"
inputs = list("\<TEXT\> input")
outputs = list("\<TEXT\> output")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/lowercase/do_work() /obj/item/integrated_circuit/converter/lowercase/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
if(incoming.data && istext(incoming.data)) if(incoming && istext(incoming))
result = lowertext(incoming.data) result = lowertext(incoming)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/uppercase /obj/item/integrated_circuit/converter/uppercase
name = "uppercase string converter" name = "uppercase string converter"
desc = "THIS WILL CAUSE A STRING TO COME OUT IN ALL UPPERCASE." desc = "THIS WILL CAUSE A STRING TO COME OUT IN ALL UPPERCASE."
icon_state = "uppercase" icon_state = "uppercase"
inputs = list("\<TEXT\> input")
outputs = list("\<TEXT\> output")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/uppercase/do_work() /obj/item/integrated_circuit/converter/uppercase/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
if(incoming.data && istext(incoming.data)) if(incoming && istext(incoming))
result = uppertext(incoming.data) result = uppertext(incoming)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/concatenatior /obj/item/integrated_circuit/converter/concatenatior
name = "concatenatior" name = "concatenatior"
desc = "This joins many strings together to get one big string." desc = "This joins many strings or numbers together to get one big string."
complexity = 4 complexity = 4
inputs = list("A","B","C","D","E","F","G","H") inputs = list(
outputs = list("result") "\<TEXT/NUM\> A",
activators = list("concatenate") "\<TEXT/NUM\> B",
"\<TEXT/NUM\> C",
"\<TEXT/NUM\> D",
"\<TEXT/NUM\> E",
"\<TEXT/NUM\> F",
"\<TEXT/NUM\> G",
"\<TEXT/NUM\> H"
)
outputs = list("\<TEXT\> result")
activators = list("\<PULSE IN\> concatenate", "\<PULSE OUT\> on concatenated")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/concatenatior/do_work() /obj/item/integrated_circuit/converter/concatenatior/do_work()
@@ -107,70 +131,70 @@
I.pull_data() I.pull_data()
if(istext(I.data)) if(istext(I.data))
result = result + I.data result = result + I.data
else if(!isnull(I.data) && num2text(I.data))
result = result + num2text(I.data)
var/datum/integrated_io/outgoing = outputs[1] var/datum/integrated_io/outgoing = outputs[1]
outgoing.data = result outgoing.data = result
outgoing.push_data() outgoing.push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/radians2degrees /obj/item/integrated_circuit/converter/radians2degrees
name = "radians to degrees converter" name = "radians to degrees converter"
desc = "Converts radians to degrees." desc = "Converts radians to degrees."
inputs = list("radian") inputs = list("\<NUM\> radian")
outputs = list("degrees") outputs = list("\<NUM\> degrees")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/radians2degrees/do_work() /obj/item/integrated_circuit/converter/radians2degrees/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
incoming.pull_data() if(incoming && isnum(incoming))
if(incoming.data && isnum(incoming.data)) result = ToDegrees(incoming)
result = ToDegrees(incoming.data)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/degrees2radians /obj/item/integrated_circuit/converter/degrees2radians
name = "degrees to radians converter" name = "degrees to radians converter"
desc = "Converts degrees to radians." desc = "Converts degrees to radians."
inputs = list("degrees") inputs = list("\<NUM\> degrees")
outputs = list("radians") outputs = list("\<NUM\> radians")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/degrees2radians/do_work() /obj/item/integrated_circuit/converter/degrees2radians/do_work()
var/result = null var/result = null
var/datum/integrated_io/incoming = inputs[1] pull_data()
var/datum/integrated_io/outgoing = outputs[1] var/incoming = get_pin_data(IC_INPUT, 1)
incoming.pull_data() if(incoming && isnum(incoming))
if(incoming.data && isnum(incoming.data)) result = ToRadians(incoming)
result = ToRadians(incoming.data)
outgoing.data = result set_pin_data(IC_OUTPUT, 1, result)
outgoing.push_data() push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/abs_to_rel_coords /obj/item/integrated_circuit/converter/abs_to_rel_coords
name = "abs to rel coordinate converter" name = "abs to rel coordinate converter"
desc = "Easily convert absolute coordinates to relative coordinates with this." desc = "Easily convert absolute coordinates to relative coordinates with this."
complexity = 4 complexity = 4
inputs = list("X1 (abs)", "Y1 (abs)", "X2 (abs)", "Y2 (abs)") inputs = list("\<NUM\> X1", "\<NUM\> Y1", "\<NUM\> X2", "\<NUM\> Y2")
outputs = list("X (rel)", "Y (rel)") outputs = list("\<NUM\> X", "\<NUM\> Y")
activators = list("compute rel coordinates") activators = list("\<PULSE IN\> compute rel coordinates", "\<PULSE OUT\> on convert")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/abs_to_rel_coords/do_work() /obj/item/integrated_circuit/converter/abs_to_rel_coords/do_work()
var/datum/integrated_io/x1 = inputs[1] var/x1 = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/y1 = inputs[2] var/y1 = get_pin_data(IC_INPUT, 2)
var/datum/integrated_io/x2 = inputs[3] var/x2 = get_pin_data(IC_INPUT, 3)
var/datum/integrated_io/y2 = inputs[4] var/y2 = get_pin_data(IC_INPUT, 4)
var/datum/integrated_io/result_x = outputs[1] if(x1 && y1 && x2 && y2)
var/datum/integrated_io/result_y = outputs[2] set_pin_data(IC_OUTPUT, 1, x1 - x2)
set_pin_data(IC_OUTPUT, 2, y1 - y2)
if(x1.data && y1.data && x2.data && y2.data) push_data()
result_x.data = x1.data - x2.data activate_pin(2)
result_y.data = y1.data - y2.data
for(var/datum/integrated_io/output/O in outputs)
O.push_data()

View File

@@ -14,28 +14,27 @@
can_be_asked_input = 1 can_be_asked_input = 1
inputs = list() inputs = list()
outputs = list() outputs = list()
activators = list("on pressed") activators = list("\<PULSE OUT\> on pressed")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/input/button/ask_for_input(mob/user) //Bit misleading name for this specific use. /obj/item/integrated_circuit/input/button/ask_for_input(mob/user) //Bit misleading name for this specific use.
var/datum/integrated_io/A = activators[1]
if(A.linked.len)
for(var/datum/integrated_io/activate/target in A.linked)
target.holder.check_then_do_work()
to_chat(user, "<span class='notice'>You press the button labeled '[src.name]'.</span>") to_chat(user, "<span class='notice'>You press the button labeled '[src.name]'.</span>")
activate_pin(1)
/obj/item/integrated_circuit/input/toggle_button /obj/item/integrated_circuit/input/toggle_button
name = "toggle button" name = "toggle button"
desc = "It toggles on, off, on, off..." desc = "It toggles on, off, on, off..."
icon_state = "toggle_button" icon_state = "toggle_button"
complexity = 1 complexity = 1
can_be_asked_input = 1
inputs = list() inputs = list()
outputs = list("on" = 0) outputs = list("\<NUM\> on" = 0)
activators = list("on toggle") activators = list("\<PULSE OUT\> on toggle")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/input/toggle_button/ask_for_input(mob/user) // Ditto. /obj/item/integrated_circuit/input/toggle_button/ask_for_input(mob/user) // Ditto.
set_pin_data(IC_OUTPUT, 1, !get_pin_data(IC_OUTPUT, 1)) set_pin_data(IC_OUTPUT, 1, !get_pin_data(IC_OUTPUT, 1))
push_data()
activate_pin(1) activate_pin(1)
to_chat(user, "<span class='notice'>You toggle the button labeled '[src.name]' [get_pin_data(IC_OUTPUT, 1) ? "on" : "off"].</span>") to_chat(user, "<span class='notice'>You toggle the button labeled '[src.name]' [get_pin_data(IC_OUTPUT, 1) ? "on" : "off"].</span>")
@@ -46,19 +45,17 @@
complexity = 2 complexity = 2
can_be_asked_input = 1 can_be_asked_input = 1
inputs = list() inputs = list()
outputs = list("number entered") outputs = list("\<NUM\> number entered")
activators = list("on entered") activators = list("\<PULSE OUT\> on entered")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4 power_draw_per_use = 4
/obj/item/integrated_circuit/input/numberpad/ask_for_input(mob/user) /obj/item/integrated_circuit/input/numberpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter a number, please.","Number pad") as null|num var/new_input = input(user, "Enter a number, please.","Number pad") as null|num
if(isnum(new_input) && CanInteract(user, physical_state)) if(isnum(new_input) && CanInteract(user, physical_state))
var/datum/integrated_io/O = outputs[1] set_pin_data(IC_OUTPUT, 1, new_input)
O.data = new_input push_data()
O.push_data() activate_pin(1)
var/datum/integrated_io/A = activators[1]
A.push_data()
/obj/item/integrated_circuit/input/textpad /obj/item/integrated_circuit/input/textpad
name = "text pad" name = "text pad"
@@ -67,49 +64,43 @@
complexity = 2 complexity = 2
can_be_asked_input = 1 can_be_asked_input = 1
inputs = list() inputs = list()
outputs = list("string entered") outputs = list("\<TEXT\> string entered")
activators = list("on entered") activators = list("\<PULSE OUT\> on entered")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4 power_draw_per_use = 4
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user) /obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter some words, please.","Number pad") as null|text var/new_input = input(user, "Enter some words, please.","Number pad") as null|text
if(istext(new_input) && CanInteract(user, physical_state)) if(istext(new_input) && CanInteract(user, physical_state))
var/datum/integrated_io/O = outputs[1] set_pin_data(IC_OUTPUT, 1, new_input)
O.data = new_input push_data()
O.push_data() activate_pin(1)
var/datum/integrated_io/A = activators[1]
A.push_data()
/obj/item/integrated_circuit/input/med_scanner /obj/item/integrated_circuit/input/med_scanner
name = "integrated medical analyser" name = "integrated medical analyser"
desc = "A very small version of the common medical analyser. This allows the machine to know how healthy someone is." desc = "A very small version of the common medical analyser. This allows the machine to know how healthy someone is."
icon_state = "medscan" icon_state = "medscan"
complexity = 4 complexity = 4
inputs = list("target ref") inputs = list("\<REF\> target")
outputs = list("total health %", "total missing health") outputs = list("\<NUM\> total health %", "\<NUM\> total missing health")
activators = list("scan") activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2) origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
power_draw_per_use = 40 power_draw_per_use = 40
/obj/item/integrated_circuit/input/med_scanner/do_work() /obj/item/integrated_circuit/input/med_scanner/do_work()
var/datum/integrated_io/I = inputs[1] var/mob/living/carbon/human/H = get_pin_data_as_type(IC_INPUT, 1, /mob/living/carbon/human)
var/mob/living/carbon/human/H = I.data_as_type(/mob/living/carbon/human)
if(!istype(H)) //Invalid input if(!istype(H)) //Invalid input
return return
if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range.
var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100 var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100
var/missing_health = H.getMaxHealth() - H.health var/missing_health = H.getMaxHealth() - H.health
var/datum/integrated_io/total = outputs[1] set_pin_data(IC_OUTPUT, 1, total_health)
var/datum/integrated_io/missing = outputs[2] set_pin_data(IC_OUTPUT, 2, missing_health)
total.data = total_health push_data()
missing.data = missing_health activate_pin(2)
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
/obj/item/integrated_circuit/input/adv_med_scanner /obj/item/integrated_circuit/input/adv_med_scanner
name = "integrated advanced medical analyser" name = "integrated advanced medical analyser"
@@ -117,48 +108,39 @@
This type is much more precise, allowing the machine to know much more about the target than a normal analyzer." This type is much more precise, allowing the machine to know much more about the target than a normal analyzer."
icon_state = "medscan_adv" icon_state = "medscan_adv"
complexity = 12 complexity = 12
inputs = list("target ref") inputs = list("\<REF\> target")
outputs = list( outputs = list(
"total health %", "\<NUM\> total health %",
"total missing health", "\<NUM\> total missing health",
"brute damage", "\<NUM\> brute damage",
"burn damage", "\<NUM\> burn damage",
"tox damage", "\<NUM\> tox damage",
"oxy damage", "\<NUM\> oxy damage",
"clone damage" "\<NUM\> clone damage"
) )
activators = list("scan") activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4) origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4)
power_draw_per_use = 80 power_draw_per_use = 80
/obj/item/integrated_circuit/input/adv_med_scanner/do_work() /obj/item/integrated_circuit/input/adv_med_scanner/do_work()
var/datum/integrated_io/I = inputs[1] var/mob/living/carbon/human/H = get_pin_data_as_type(IC_INPUT, 1, /mob/living/carbon/human)
var/mob/living/carbon/human/H = I.data_as_type(/mob/living/carbon/human)
if(!istype(H)) //Invalid input if(!istype(H)) //Invalid input
return return
if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range. if(H.Adjacent(get_turf(src))) // Like normal analysers, it can't be used at range.
var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100 var/total_health = round(H.health/H.getMaxHealth(), 0.1)*100
var/missing_health = H.getMaxHealth() - H.health var/missing_health = H.getMaxHealth() - H.health
var/datum/integrated_io/total = outputs[1] set_pin_data(IC_OUTPUT, 1, total_health)
var/datum/integrated_io/missing = outputs[2] set_pin_data(IC_OUTPUT, 2, missing_health)
var/datum/integrated_io/brute = outputs[3] set_pin_data(IC_OUTPUT, 3, H.getBruteLoss())
var/datum/integrated_io/burn = outputs[4] set_pin_data(IC_OUTPUT, 4, H.getFireLoss())
var/datum/integrated_io/tox = outputs[5] set_pin_data(IC_OUTPUT, 5, H.getToxLoss())
var/datum/integrated_io/oxy = outputs[6] set_pin_data(IC_OUTPUT, 6, H.getOxyLoss())
var/datum/integrated_io/clone = outputs[7] set_pin_data(IC_OUTPUT, 7, H.getCloneLoss())
total.data = total_health push_data()
missing.data = missing_health activate_pin(2)
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 /obj/item/integrated_circuit/input/local_locator
name = "local locator" name = "local locator"
@@ -222,9 +204,9 @@
Meaning the default frequency is expressed as 1457, not 145.7. To send a signal, pulse the 'send signal' activator pin." Meaning the default frequency is expressed as 1457, not 145.7. To send a signal, pulse the 'send signal' activator pin."
icon_state = "signal" icon_state = "signal"
complexity = 4 complexity = 4
inputs = list("frequency","code") inputs = list("\<NUM\> frequency","\<NUM\> code")
outputs = list() outputs = list()
activators = list("send signal","on signal received") activators = list("\<PULSE IN\> send signal","\<PULSE OUT\> on signal sent", "\<PULSE OUT\> on signal received")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2) origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2)
power_draw_idle = 5 power_draw_idle = 5
@@ -237,11 +219,9 @@
/obj/item/integrated_circuit/input/signaler/initialize() /obj/item/integrated_circuit/input/signaler/initialize()
..() ..()
set_frequency(frequency) set_frequency(frequency)
var/datum/integrated_io/new_freq = inputs[1]
var/datum/integrated_io/new_code = inputs[2]
// Set the pins so when someone sees them, they won't show as null // Set the pins so when someone sees them, they won't show as null
new_freq.data = frequency set_pin_data(IC_INPUT, 1, frequency)
new_code.data = code set_pin_data(IC_INPUT, 2, code)
/obj/item/integrated_circuit/input/signaler/Destroy() /obj/item/integrated_circuit/input/signaler/Destroy()
if(radio_controller) if(radio_controller)
@@ -250,12 +230,12 @@
. = ..() . = ..()
/obj/item/integrated_circuit/input/signaler/on_data_written() /obj/item/integrated_circuit/input/signaler/on_data_written()
var/datum/integrated_io/new_freq = inputs[1] var/new_freq = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/new_code = inputs[2] var/new_code = get_pin_data(IC_INPUT, 2)
if(isnum(new_freq.data) && new_freq.data > 0) if(isnum(new_freq) && new_freq > 0)
set_frequency(new_freq.data) set_frequency(new_freq)
if(isnum(new_code.data)) if(isnum(new_code))
code = new_code.data code = new_code
/obj/item/integrated_circuit/input/signaler/do_work() // Sends a signal. /obj/item/integrated_circuit/input/signaler/do_work() // Sends a signal.
@@ -267,6 +247,7 @@
signal.encryption = code signal.encryption = code
signal.data["message"] = "ACTIVATE" signal.data["message"] = "ACTIVATE"
radio_connection.post_signal(src, signal) radio_connection.post_signal(src, signal)
activate_pin(2)
/obj/item/integrated_circuit/input/signaler/proc/set_frequency(new_frequency) /obj/item/integrated_circuit/input/signaler/proc/set_frequency(new_frequency)
if(!frequency) if(!frequency)
@@ -280,11 +261,11 @@
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT) radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
/obj/item/integrated_circuit/input/signaler/receive_signal(datum/signal/signal) /obj/item/integrated_circuit/input/signaler/receive_signal(datum/signal/signal)
var/datum/integrated_io/new_code = inputs[2] var/new_code = get_pin_data(IC_INPUT, 2)
var/code = 0 var/code = 0
if(isnum(new_code.data)) if(isnum(new_code))
code = new_code.data code = new_code
if(!signal) if(!signal)
return 0 return 0
if(signal.encryption != code) if(signal.encryption != code)
@@ -292,8 +273,7 @@
if(signal.source == src) // Don't trigger ourselves. if(signal.source == src) // Don't trigger ourselves.
return 0 return 0
var/datum/integrated_io/A = activators[2] activate_pin(3)
A.push_data()
for(var/mob/O in hearers(1, get_turf(src))) for(var/mob/O in hearers(1, get_turf(src)))
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2) O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
@@ -306,9 +286,9 @@
will pulse whatever's connected to it. Pulsing the first activation pin will send a message." will pulse whatever's connected to it. Pulsing the first activation pin will send a message."
icon_state = "signal" icon_state = "signal"
complexity = 4 complexity = 4
inputs = list("target EPv2 address", "data to send", "secondary text") inputs = list("\<TEXT\> target EPv2 address", "\<TEXT\> data to send", "\<TEXT\> secondary text")
outputs = list("address received", "data received", "secondary text received") outputs = list("\<TEXT\> address received", "\<TEXT\> data received", "\<TEXT\> secondary text received")
activators = list("send data", "on data received") activators = list("\<PULSE IN\> send data", "\<PULSE OUT\> on data received")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2) origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2)
power_draw_per_use = 50 power_draw_per_use = 50
@@ -318,7 +298,7 @@
..() ..()
exonet = new(src) exonet = new(src)
exonet.make_address("EPv2_circuit-\ref[src]") exonet.make_address("EPv2_circuit-\ref[src]")
desc += "<br>This circuit's EPv2 address is: [exonet.address]." desc += "<br>This circuit's EPv2 address is: [exonet.address]"
/obj/item/integrated_circuit/input/EPv2/Destroy() /obj/item/integrated_circuit/input/EPv2/Destroy()
if(exonet) if(exonet)
@@ -327,64 +307,60 @@
..() ..()
/obj/item/integrated_circuit/input/EPv2/do_work() /obj/item/integrated_circuit/input/EPv2/do_work()
var/datum/integrated_io/target_address = inputs[1] var/target_address = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/message = inputs[2] var/message = get_pin_data(IC_INPUT, 2)
var/datum/integrated_io/text = inputs[3] var/text = get_pin_data(IC_INPUT, 3)
if(istext(target_address.data))
exonet.send_message(target_address.data, message.data, text.data) if(target_address && istext(target_address))
exonet.send_message(target_address, message, text)
/obj/item/integrated_circuit/input/receive_exonet_message(var/atom/origin_atom, var/origin_address, var/message, var/text) /obj/item/integrated_circuit/input/receive_exonet_message(var/atom/origin_atom, var/origin_address, var/message, var/text)
var/datum/integrated_io/message_received = outputs[1] set_pin_data(IC_OUTPUT, 1, origin_address)
var/datum/integrated_io/data_received = outputs[2] set_pin_data(IC_OUTPUT, 2, message)
var/datum/integrated_io/text_received = outputs[3] set_pin_data(IC_OUTPUT, 3, text)
var/datum/integrated_io/A = activators[2] push_data()
A.push_data() activate_pin(2)
message_received.write_data_to_pin(origin_address)
data_received.write_data_to_pin(message)
text_received.write_data_to_pin(text)
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
//This circuit gives information on where the machine is. //This circuit gives information on where the machine is.
/obj/item/integrated_circuit/input/gps /obj/item/integrated_circuit/input/gps
name = "global positioning system" name = "global positioning system"
desc = "This allows you to easily know the position of a machine containing this device." desc = "This allows you to easily know the position of a machine containing this device."
extended_desc = "The GPS's coordinates it gives is absolute, not relative."
icon_state = "gps" icon_state = "gps"
complexity = 4 complexity = 4
inputs = list() inputs = list()
outputs = list("X (abs)", "Y (abs)") outputs = list("\<NUM\> X", "\<NUM\> Y")
activators = list("get coordinates") activators = list("\<PULSE IN\> get coordinates", "\<PULSE OUT\> on get coordinates")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 30 power_draw_per_use = 30
/obj/item/integrated_circuit/input/gps/do_work() /obj/item/integrated_circuit/input/gps/do_work()
var/turf/T = get_turf(src) 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 set_pin_data(IC_OUTPUT, 1, null)
result_y.data = null set_pin_data(IC_OUTPUT, 2, null)
if(!T) if(!T)
return return
result_x.data = T.x set_pin_data(IC_OUTPUT, 1, T.x)
result_y.data = T.y set_pin_data(IC_OUTPUT, 2, T.y)
for(var/datum/integrated_io/output/O in outputs) push_data()
O.push_data() activate_pin(2)
/obj/item/integrated_circuit/input/microphone /obj/item/integrated_circuit/input/microphone
name = "microphone" name = "microphone"
desc = "Useful for spying on people or for voice activated machines." desc = "Useful for spying on people or for voice activated machines."
extended_desc = "This will automatically translate most languages it hears to Galactic Common. \
The first activation pin is always pulsed when the circuit hears someone talk, while the second one \
is only triggered if it hears someone speaking a language other than Galactic Common."
icon_state = "recorder" icon_state = "recorder"
complexity = 8 complexity = 8
inputs = list() inputs = list()
outputs = list("speaker \<String\>", "message \<String\>") outputs = list("\<TEXT\> speaker", "\<TEXT\> message")
activators = list("on message received") activators = list("\<PULSE OUT\> on message received", "\<PULSE OUT\> on translation")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 15 power_draw_per_use = 15
@@ -397,42 +373,45 @@
..() ..()
/obj/item/integrated_circuit/input/microphone/hear_talk(mob/living/M, msg, var/verb="says", datum/language/speaking=null) /obj/item/integrated_circuit/input/microphone/hear_talk(mob/living/M, msg, var/verb="says", datum/language/speaking=null)
var/datum/integrated_io/V = outputs[1] var/translated = FALSE
var/datum/integrated_io/O = outputs[2]
var/datum/integrated_io/A = activators[1]
if(M && msg) if(M && msg)
if(speaking) if(speaking)
if(!speaking.machine_understands) if(!speaking.machine_understands)
msg = speaking.scramble(msg) msg = speaking.scramble(msg)
V.data = M.GetVoice() if(!istype(speaking, /datum/language/common))
O.data = msg translated = TRUE
A.push_data() set_pin_data(IC_OUTPUT, 1, M.GetVoice())
set_pin_data(IC_OUTPUT, 2, msg)
for(var/datum/integrated_io/output/out in outputs) push_data()
out.push_data() activate_pin(1)
if(translated)
A.push_data() activate_pin(2)
/obj/item/integrated_circuit/input/sensor /obj/item/integrated_circuit/input/sensor
name = "sensor" name = "sensor"
desc = "Scans and obtains a reference for any objects or persons near you. All you need to do is shove the machine in their face." desc = "Scans and obtains a reference for any objects or persons near you. All you need to do is shove the machine in their face."
extended_desc = "If 'ignore storage' pin is set to 1, the sensor will disregard scanning various storage containers such as backpacks."
icon_state = "recorder" icon_state = "recorder"
complexity = 12 complexity = 12
inputs = list() inputs = list("\<NUM\> ignore storage" = 1)
outputs = list("scanned ref \<Ref\>") outputs = list("\<REF\> scanned")
activators = list("on scanned") activators = list("\<PULSE OUT\> on scanned")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 120 power_draw_per_use = 120
/obj/item/integrated_circuit/input/sensor/do_work() /obj/item/integrated_circuit/input/sensor/proc/scan(var/atom/A)
// Because this gets called by attack(), all this needs to do is pulse the activator. var/ignore_bags = get_pin_data(IC_INPUT, 1)
for(var/datum/integrated_io/output/O in outputs) if(ignore_bags)
O.push_data() if(istype(A, /obj/item/weapon/storage))
var/datum/integrated_io/activate/A = activators[1] return FALSE
A.push_data()
set_pin_data(IC_OUTPUT, 1, weakref(A))
push_data()
activate_pin(1)
return TRUE
/obj/item/integrated_circuit/output /obj/item/integrated_circuit/output
category_text = "Output" category_text = "Output"
@@ -441,9 +420,9 @@
name = "small screen" name = "small screen"
desc = "This small screen can display a single piece of data, when the machine is examined closely." desc = "This small screen can display a single piece of data, when the machine is examined closely."
icon_state = "screen" icon_state = "screen"
inputs = list("displayed data") inputs = list("\<TEXT/NUM\> displayed data")
outputs = list() outputs = list()
activators = list("load data") activators = list("\<PULSE IN\> load data")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 10 power_draw_per_use = 10
autopulse = 1 autopulse = 1
@@ -497,7 +476,7 @@
complexity = 4 complexity = 4
inputs = list() inputs = list()
outputs = list() outputs = list()
activators = list("toggle light") activators = list("\<PULSE IN\> toggle light")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
var/light_toggled = 0 var/light_toggled = 0
var/light_brightness = 3 var/light_brightness = 3
@@ -519,18 +498,18 @@
power_draw_idle = light_toggled ? light_brightness * 2 : 0 power_draw_idle = light_toggled ? light_brightness * 2 : 0
/obj/item/integrated_circuit/output/light/advanced/update_lighting() /obj/item/integrated_circuit/output/light/advanced/update_lighting()
var/datum/integrated_io/R = inputs[1] var/R = get_pin_data(IC_INPUT, 1)
var/datum/integrated_io/G = inputs[2] var/G = get_pin_data(IC_INPUT, 2)
var/datum/integrated_io/B = inputs[3] var/B = get_pin_data(IC_INPUT, 3)
var/datum/integrated_io/brightness = inputs[4] var/brightness = get_pin_data(IC_INPUT, 4)
if(isnum(R.data) && isnum(G.data) && isnum(B.data) && isnum(brightness.data)) if(isnum(R) && isnum(G) && isnum(B) && isnum(brightness))
R.data = Clamp(R.data, 0, 255) R = Clamp(R, 0, 255)
G.data = Clamp(G.data, 0, 255) G = Clamp(G, 0, 255)
B.data = Clamp(B.data, 0, 255) B = Clamp(B, 0, 255)
brightness.data = Clamp(brightness.data, 0, 6) brightness = Clamp(brightness, 0, 6)
light_rgb = rgb(R.data, G.data, B.data) light_rgb = rgb(R, G, B)
light_brightness = brightness.data light_brightness = brightness
..() ..()
@@ -544,10 +523,10 @@
icon_state = "light_adv" icon_state = "light_adv"
complexity = 8 complexity = 8
inputs = list( inputs = list(
"R", "\<NUM\> R",
"G", "\<NUM\> G",
"B", "\<NUM\> B",
"Brightness" "\<NUM\> Brightness"
) )
outputs = list() outputs = list()
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
@@ -563,9 +542,9 @@
complexity = 8 complexity = 8
cooldown_per_use = 4 SECONDS cooldown_per_use = 4 SECONDS
inputs = list( inputs = list(
"sound ID", "\<TEXT\> sound ID",
"volume", "\<NUM\> volume",
"frequency" "\<NUM\> frequency"
) )
outputs = list() outputs = list()
activators = list("play sound") activators = list("play sound")

View File

@@ -4,7 +4,7 @@
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE." extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE."
complexity = 3 complexity = 3
outputs = list("result") outputs = list("result")
activators = list("compare", "on true result", "on false result") activators = list("\<PULSE IN\> compare", "\<PULSE OUT\> on true result", "\<PULSE OUT\> on false result")
category_text = "Logic" category_text = "Logic"
autopulse = 1 autopulse = 1
power_draw_per_use = 1 power_draw_per_use = 1
@@ -14,19 +14,17 @@
check_then_do_work() check_then_do_work()
/obj/item/integrated_circuit/logic/do_work() /obj/item/integrated_circuit/logic/do_work()
var/datum/integrated_io/O = outputs[1] push_data()
var/datum/integrated_io/T = activators[2] if(get_pin_data(IC_INPUT, 1))
var/datum/integrated_io/F = activators[3] activate_pin(1)
O.push_data()
if(O.data)
T.push_data()
else else
F.push_data() activate_pin(2)
/obj/item/integrated_circuit/logic/binary /obj/item/integrated_circuit/logic/binary
inputs = list("A","B") inputs = list("\<ANY\> A","\<ANY\> B")
/obj/item/integrated_circuit/logic/binary/do_work() /obj/item/integrated_circuit/logic/binary/do_work()
pull_data()
var/datum/integrated_io/A = inputs[1] var/datum/integrated_io/A = inputs[1]
var/datum/integrated_io/B = inputs[2] var/datum/integrated_io/B = inputs[2]
var/datum/integrated_io/O = outputs[1] var/datum/integrated_io/O = outputs[1]
@@ -37,9 +35,10 @@
return FALSE return FALSE
/obj/item/integrated_circuit/logic/unary /obj/item/integrated_circuit/logic/unary
inputs = list("A") inputs = list("\<ANY\> A")
/obj/item/integrated_circuit/logic/unary/do_work() /obj/item/integrated_circuit/logic/unary/do_work()
pull_data()
var/datum/integrated_io/A = inputs[1] var/datum/integrated_io/A = inputs[1]
var/datum/integrated_io/O = outputs[1] var/datum/integrated_io/O = outputs[1]
O.data = do_check(A) ? TRUE : FALSE O.data = do_check(A) ? TRUE : FALSE

View File

@@ -11,12 +11,12 @@
complexity = 20 complexity = 20
w_class = ITEMSIZE_NORMAL w_class = ITEMSIZE_NORMAL
inputs = list( inputs = list(
"target X rel", "\<NUM\> target X rel",
"target Y rel" "\<NUM\> target Y rel"
) )
outputs = list() outputs = list()
activators = list( activators = list(
"fire" "\<PULSE IN\> fire"
) )
var/obj/item/weapon/gun/installed_gun = null var/obj/item/weapon/gun/installed_gun = null
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH

View File

@@ -11,9 +11,9 @@
some power is lost due to ineffiency." some power is lost due to ineffiency."
w_class = ITEMSIZE_SMALL w_class = ITEMSIZE_SMALL
complexity = 16 complexity = 16
inputs = list("target ref") inputs = list("\<REF\> target")
outputs = list("target cell charge", "target cell max charge", "target cell percentage") outputs = list("\<NUM\> target cell charge", "\<NUM\> target cell max charge", "\<NUM\> target cell percentage")
activators = list("transmit") activators = list("\<PULSE IN\> transmit")
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 4, TECH_POWER = 4, TECH_MAGNET = 3) origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 4, TECH_POWER = 4, TECH_MAGNET = 3)
power_draw_per_use = 500 // Inefficency has to come from somewhere. power_draw_per_use = 500 // Inefficency has to come from somewhere.

View File

@@ -43,39 +43,39 @@
flags = OPENCONTAINER flags = OPENCONTAINER
complexity = 20 complexity = 20
cooldown_per_use = 6 SECONDS cooldown_per_use = 6 SECONDS
inputs = list("target ref", "injection amount" = 5) inputs = list("\<REF\> target", "\<NUM\> injection amount" = 5)
outputs = list() outputs = list()
activators = list("inject") activators = list("\<PULSE IN\> inject")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
volume = 30 volume = 30
power_draw_per_use = 15 power_draw_per_use = 15
/obj/item/integrated_circuit/reagent/injector/proc/inject_amount() /obj/item/integrated_circuit/reagent/injector/proc/inject_amount()
var/datum/integrated_io/amount = inputs[2] var/amount = get_pin_data(IC_INPUT, 2)
if(isnum(amount.data)) if(isnum(amount))
return Clamp(amount.data, 0, 30) return Clamp(amount, 0, 30)
/obj/item/integrated_circuit/reagent/injector/do_work() /obj/item/integrated_circuit/reagent/injector/do_work()
set waitfor = 0 // Don't sleep in a proc that is called by a processor without this set, otherwise it'll delay the entire thing set waitfor = 0 // Don't sleep in a proc that is called by a processor without this set, otherwise it'll delay the entire thing
var/datum/integrated_io/target = inputs[1] var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
var/atom/movable/AM = target.data_as_type(/atom/movable)
if(!istype(AM)) //Invalid input if(!istype(AM)) //Invalid input
return return
if(!reagents.total_volume) // Empty if(!reagents.total_volume) // Empty
return return
if(AM.can_be_injected_by(src)) if(AM.can_be_injected_by(src))
if(isliving(AM)) if(isliving(AM))
var/mob/living/L = AM
var/turf/T = get_turf(AM) var/turf/T = get_turf(AM)
T.visible_message("<span class='warning'>[src] is trying to inject [AM]!</span>") T.visible_message("<span class='warning'>[src] is trying to inject [L]!</span>")
sleep(3 SECONDS) sleep(3 SECONDS)
if(!AM.can_be_injected_by(src)) if(!L.can_be_injected_by(src))
return return
var/contained = reagents.get_reagents() var/contained = reagents.get_reagents()
var/trans = reagents.trans_to_mob(target, inject_amount(), CHEM_BLOOD) var/trans = reagents.trans_to_mob(L, inject_amount(), CHEM_BLOOD)
message_admins("[src] injected \the [AM] with [trans]u of [contained].") message_admins("[src] injected \the [L] with [trans]u of [contained].")
to_chat(AM, "<span class='notice'>You feel a tiny prick!</span>") to_chat(AM, "<span class='notice'>You feel a tiny prick!</span>")
visible_message("<span class='warning'>[src] injects [AM]!</span>") visible_message("<span class='warning'>[src] injects [L]!</span>")
else else
reagents.trans_to(AM, inject_amount()) reagents.trans_to(AM, inject_amount())
@@ -88,9 +88,9 @@
outside the machine if it is next to the machine. Note that this cannot be used on entities." outside the machine if it is next to the machine. Note that this cannot be used on entities."
flags = OPENCONTAINER flags = OPENCONTAINER
complexity = 8 complexity = 8
inputs = list("source ref", "target ref", "injection amount" = 10) inputs = list("\<REF\> source", "\<REF\> target", "\<NUM\> injection amount" = 10)
outputs = list() outputs = list()
activators = list("transfer reagents") activators = list("\<PULSE IN\> transfer reagents", "\<PULSE OUT\> on transfer")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2) origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
var/transfer_amount = 10 var/transfer_amount = 10
@@ -103,10 +103,9 @@
transfer_amount = amount.data transfer_amount = amount.data
/obj/item/integrated_circuit/reagent/pump/do_work() /obj/item/integrated_circuit/reagent/pump/do_work()
var/datum/integrated_io/A = inputs[1] var/atom/movable/source = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
var/datum/integrated_io/B = inputs[2] var/atom/movable/target = get_pin_data_as_type(IC_INPUT, 2, /atom/movable)
var/atom/movable/source = A.data_as_type(/atom/movable)
var/atom/movable/target = B.data_as_type(/atom/movable)
if(!istype(source) || !istype(target)) //Invalid input if(!istype(source) || !istype(target)) //Invalid input
return return
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
@@ -117,10 +116,11 @@
return return
if(!source.is_open_container() || !target.is_open_container()) if(!source.is_open_container() || !target.is_open_container())
return return
if(!source.reagents.get_free_space() || !target.reagents.get_free_space()) if(!target.reagents.get_free_space())
return return
source.reagents.trans_to(target, transfer_amount) source.reagents.trans_to(target, transfer_amount)
activate_pin(2)
/obj/item/integrated_circuit/reagent/storage /obj/item/integrated_circuit/reagent/storage
name = "reagent storage" name = "reagent storage"

View File

@@ -8,17 +8,16 @@
cannot see the target, it will not be able to calculate the correct direction." cannot see the target, it will not be able to calculate the correct direction."
icon_state = "numberpad" icon_state = "numberpad"
complexity = 25 complexity = 25
inputs = list("target ref") inputs = list("\<REF\> target")
outputs = list("dir") outputs = list("\<NUM\> dir")
activators = list("calculate dir") activators = list("\<PULSE IN\> calculate dir", "\<PULSE OUT\> on calculated")
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5) origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5)
power_draw_per_use = 40 power_draw_per_use = 40
/obj/item/integrated_circuit/smart/basic_pathfinder/do_work() /obj/item/integrated_circuit/smart/basic_pathfinder/do_work()
var/datum/integrated_io/I = inputs[1] var/datum/integrated_io/I = inputs[1]
var/datum/integrated_io/O = outputs[1] set_pin_data(IC_OUTPUT, 1, null)
O.data = null
if(!isweakref(I.data)) if(!isweakref(I.data))
return return
@@ -28,6 +27,6 @@
if(!(A in view(get_turf(src)))) if(!(A in view(get_turf(src))))
return // Can't see the target. return // Can't see the target.
var/desired_dir = get_dir(get_turf(src), A) var/desired_dir = get_dir(get_turf(src), A)
if(desired_dir)
O.data = desired_dir set_pin_data(IC_OUTPUT, 1, desired_dir)
O.push_data() push_data()

View File

@@ -12,16 +12,15 @@
This circuit is set to send a pulse after a delay of two seconds." This circuit is set to send a pulse after a delay of two seconds."
icon_state = "delay-20" icon_state = "delay-20"
var/delay = 2 SECONDS var/delay = 2 SECONDS
activators = list("incoming pulse","outgoing pulse") activators = list("\<PULSE IN\> incoming","\<PULSE OUT\> outgoing")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 2 power_draw_per_use = 2
/obj/item/integrated_circuit/time/delay/do_work() /obj/item/integrated_circuit/time/delay/do_work()
set waitfor = 0 // Don't sleep in a proc that is called by a processor. It'll delay the entire thing set waitfor = 0 // Don't sleep in a proc that is called by a processor. It'll delay the entire thing
var/datum/integrated_io/out_pulse = activators[2]
sleep(delay) sleep(delay)
out_pulse.push_data() activate_pin(2)
/obj/item/integrated_circuit/time/delay/five_sec /obj/item/integrated_circuit/time/delay/five_sec
name = "five-sec delay circuit" name = "five-sec delay circuit"
@@ -60,14 +59,13 @@
desc = "This sends a pulse signal out after a delay, critical for ensuring proper control flow in a complex machine. \ 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." This circuit's delay can be customized, between 1/10th of a second to one hour. The delay is updated upon receiving a pulse."
icon_state = "delay" icon_state = "delay"
inputs = list("delay time") inputs = list("\<NUM\> delay time")
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/time/delay/custom/do_work() /obj/item/integrated_circuit/time/delay/custom/do_work()
var/datum/integrated_io/delay_input = inputs[1] var/delay_input = get_pin_data(IC_INPUT, 1)
if(delay_input.data && isnum(delay_input.data) ) if(delay_input && isnum(delay_input) )
var/new_delay = min(delay_input.data, 1) var/new_delay = between(1, delay_input, 36000) //An hour.
new_delay = max(new_delay, 36000) //An hour.
delay = new_delay delay = new_delay
..() ..()
@@ -80,8 +78,8 @@
var/ticks_to_pulse = 4 var/ticks_to_pulse = 4
var/ticks_completed = 0 var/ticks_completed = 0
var/is_running = FALSE var/is_running = FALSE
inputs = list("enable ticking") inputs = list("\<NUM\> enable ticking" = 0)
activators = list("outgoing pulse") activators = list("\<PULSE OUT\> outgoing pulse")
spawn_flags = IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 4 power_draw_per_use = 4
@@ -91,8 +89,8 @@
. = ..() . = ..()
/obj/item/integrated_circuit/time/ticker/on_data_written() /obj/item/integrated_circuit/time/ticker/on_data_written()
var/datum/integrated_io/do_tick = inputs[1] var/do_tick = get_pin_data(IC_INPUT, 1)
if(do_tick.data && !is_running) if(do_tick && !is_running)
is_running = TRUE is_running = TRUE
processing_objects |= src processing_objects |= src
else if(is_running) else if(is_running)
@@ -108,8 +106,7 @@
ticks_completed -= ticks_to_pulse ticks_completed -= ticks_to_pulse
else else
ticks_completed = 0 ticks_completed = 0
var/datum/integrated_io/pulser = activators[1] activate_pin(1)
pulser.push_data()
/obj/item/integrated_circuit/time/ticker/fast /obj/item/integrated_circuit/time/ticker/fast
name = "fast ticker" name = "fast ticker"
@@ -134,20 +131,16 @@
desc = "Tells you what the local time is, specific to your station or planet." desc = "Tells you what the local time is, specific to your station or planet."
icon_state = "clock" icon_state = "clock"
inputs = list() inputs = list()
outputs = list("time (string)", "hours (number)", "minutes (number)", "seconds (number)") outputs = list("\<TEXT\> time", "\<NUM\> hours", "\<NUM\> minutes", "\<NUM\> seconds")
activators = list("\<PULSE IN\> get time","\<PULSE OUT\> on time got")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4 power_draw_per_use = 4
/obj/item/integrated_circuit/time/clock/do_work() /obj/item/integrated_circuit/time/clock/do_work()
var/datum/integrated_io/time = outputs[1] set_pin_data(IC_OUTPUT, 1, time2text(station_time_in_ticks, "hh:mm:ss") )
var/datum/integrated_io/hour = outputs[2] set_pin_data(IC_OUTPUT, 2, text2num(time2text(station_time_in_ticks, "hh") ) )
var/datum/integrated_io/min = outputs[3] set_pin_data(IC_OUTPUT, 3, text2num(time2text(station_time_in_ticks, "mm") ) )
var/datum/integrated_io/sec = outputs[4] set_pin_data(IC_OUTPUT, 4, text2num(time2text(station_time_in_ticks, "ss") ) )
time.data = time2text(station_time_in_ticks, "hh:mm:ss") push_data()
hour.data = text2num(time2text(station_time_in_ticks, "hh")) activate_pin(2)
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()

View File

@@ -1,9 +1,18 @@
//These circuits do not-so-simple math. //These circuits do not-so-simple math.
/obj/item/integrated_circuit/trig /obj/item/integrated_circuit/trig
complexity = 1 complexity = 1
inputs = list("A","B","C","D","E","F","G","H") inputs = list(
outputs = list("result") "\<NUM\> A",
activators = list("compute") "\<NUM\> B",
"\<NUM\> C",
"\<NUM\> D",
"\<NUM\> E",
"\<NUM\> F",
"\<NUM\> G",
"\<NUM\> H"
)
outputs = list("\<NUM\> result")
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
category_text = "Trig" category_text = "Trig"
extended_desc = "Input and output are in degrees." extended_desc = "Input and output are in degrees."
autopulse = 1 autopulse = 1
@@ -19,19 +28,19 @@
name = "sin circuit" name = "sin circuit"
desc = "Has nothing to do with evil, unless you consider trigonometry to be evil. Outputs the sine of A." desc = "Has nothing to do with evil, unless you consider trigonometry to be evil. Outputs the sine of A."
icon_state = "sine" icon_state = "sine"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/sine/do_work() /obj/item/integrated_circuit/trig/sine/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = sin(A)
result = sin(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Cosine // // Cosine //
@@ -39,19 +48,19 @@
name = "cos circuit" name = "cos circuit"
desc = "Outputs the cosine of A." desc = "Outputs the cosine of A."
icon_state = "cosine" icon_state = "cosine"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cosine/do_work() /obj/item/integrated_circuit/trig/cosine/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = cos(A)
result = cos(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Tangent // // Tangent //
@@ -59,19 +68,19 @@
name = "tan circuit" name = "tan circuit"
desc = "Outputs the tangent of A. Guaranteed to not go on a tangent about its existance." desc = "Outputs the tangent of A. Guaranteed to not go on a tangent about its existance."
icon_state = "tangent" icon_state = "tangent"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/tangent/do_work() /obj/item/integrated_circuit/trig/tangent/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = Tan(A)
result = Tan(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Cosecant // // Cosecant //
@@ -79,19 +88,19 @@
name = "csc circuit" name = "csc circuit"
desc = "Outputs the cosecant of A." desc = "Outputs the cosecant of A."
icon_state = "cosecant" icon_state = "cosecant"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cosecant/do_work() /obj/item/integrated_circuit/trig/cosecant/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = Csc(A)
result = Csc(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Secant // // Secant //
@@ -100,19 +109,19 @@
name = "sec circuit" name = "sec circuit"
desc = "Outputs the secant of A. Has nothing to do with the security department." desc = "Outputs the secant of A. Has nothing to do with the security department."
icon_state = "secant" icon_state = "secant"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/secant/do_work() /obj/item/integrated_circuit/trig/secant/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = Sec(A)
result = Sec(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)
// Cotangent // // Cotangent //
@@ -121,16 +130,16 @@
name = "cot circuit" name = "cot circuit"
desc = "Outputs the cotangent of A." desc = "Outputs the cotangent of A."
icon_state = "cotangent" icon_state = "cotangent"
inputs = list("A") inputs = list("\<NUM\> A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cotangent/do_work() /obj/item/integrated_circuit/trig/cotangent/do_work()
pull_data()
var/result = null var/result = null
var/datum/integrated_io/input/A = inputs[1] var/A = get_pin_data(IC_INPUT, 1)
A.pull_data() if(isnum(A))
if(isnum(A.data)) result = Cot(A)
result = Cot(A.data)
var/datum/integrated_io/output/O = outputs[1] set_pin_data(IC_OUTPUT, 1, result)
O.data = result push_data()
O.push_data() activate_pin(2)