mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #3353 from Neerti/4/21/2017_circuit_fixes
Circuit Bugfixes & QoL
This commit is contained in:
@@ -38,7 +38,10 @@
|
||||
IC.examine(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)
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/weapon/implant/integrated_circuit/attack_self(mob/user)
|
||||
IC.attack_self(user)
|
||||
@@ -8,7 +8,7 @@
|
||||
#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_FORMAT_STRING "\<STRING\>"
|
||||
#define IC_FORMAT_STRING "\<TEXT\>"
|
||||
#define IC_FORMAT_NUMBER "\<NUM\>"
|
||||
#define IC_FORMAT_REF "\<REF\>"
|
||||
#define IC_FORMAT_LIST "\<LIST\>"
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
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];rename=1>\[Rename\]</a> | "
|
||||
HTML += "<a href=?src=\ref[circuit];scan=1>\[Scan with Debugger\]</a> | "
|
||||
if(circuit.removable)
|
||||
HTML += "<a href=?src=\ref[circuit];remove=1>\[Remove\]</a>"
|
||||
HTML += "<br>"
|
||||
@@ -223,9 +224,10 @@
|
||||
if(proximity)
|
||||
var/scanned = FALSE
|
||||
for(var/obj/item/integrated_circuit/input/sensor/S in contents)
|
||||
S.set_pin_data(IC_OUTPUT, 1, weakref(target))
|
||||
S.check_then_do_work()
|
||||
scanned = TRUE
|
||||
// S.set_pin_data(IC_OUTPUT, 1, weakref(target))
|
||||
// S.check_then_do_work()
|
||||
if(S.scan(target))
|
||||
scanned = TRUE
|
||||
if(scanned)
|
||||
visible_message("<span class='notice'>\The [user] waves \the [src] around [target].</span>")
|
||||
|
||||
|
||||
@@ -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)
|
||||
. = ..()
|
||||
external_examine(user)
|
||||
interact(user)
|
||||
|
||||
// This should be used when someone is examining while the case is opened.
|
||||
/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()
|
||||
HTML += "<html><head><title>[src.name]</title></head><body>"
|
||||
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 += "<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 += "<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_middle_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"])
|
||||
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(autopulse != -1)
|
||||
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 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.
|
||||
return
|
||||
if(power_draw_per_use)
|
||||
if(power_draw_per_use && !ignore_power)
|
||||
if(!check_power())
|
||||
power_fail()
|
||||
return
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
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>")
|
||||
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>")
|
||||
|
||||
io.holder.interact(user) // This is to update the UI.
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
//These circuits do simple math.
|
||||
/obj/item/integrated_circuit/arithmetic
|
||||
complexity = 1
|
||||
inputs = list("A","B","C","D","E","F","G","H")
|
||||
outputs = list("result")
|
||||
activators = list("compute")
|
||||
inputs = list(
|
||||
"\<NUM\> A",
|
||||
"\<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"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 5 // Math is pretty cheap.
|
||||
@@ -30,9 +39,9 @@
|
||||
if(isnum(I.data))
|
||||
result = result + I.data
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// -Subtracting- //
|
||||
|
||||
@@ -58,9 +67,9 @@
|
||||
if(isnum(I.data))
|
||||
result = result - I.data
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// *Multiply* //
|
||||
|
||||
@@ -86,9 +95,9 @@
|
||||
if(isnum(I.data))
|
||||
result = result * I.data
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// /Division/ //
|
||||
|
||||
@@ -114,9 +123,9 @@
|
||||
if(isnum(I.data) && I.data != 0) //No runtimes here.
|
||||
result = result / I.data
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
//^ Exponent ^//
|
||||
|
||||
@@ -134,9 +143,9 @@
|
||||
if(isnum(A.data) && isnum(B.data))
|
||||
result = A.data ** B.data
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// +-Sign-+ //
|
||||
|
||||
@@ -159,9 +168,9 @@
|
||||
else
|
||||
result = 0
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Round //
|
||||
|
||||
@@ -183,9 +192,9 @@
|
||||
else
|
||||
result = round(A.data)
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
// Absolute //
|
||||
@@ -204,9 +213,9 @@
|
||||
if(isnum(I.data))
|
||||
result = abs(I.data)
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Averaging //
|
||||
|
||||
@@ -229,9 +238,9 @@
|
||||
if(inputs_used)
|
||||
result = result / inputs_used
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Pi, because why the hell not? //
|
||||
/obj/item/integrated_circuit/arithmetic/pi
|
||||
@@ -242,9 +251,9 @@
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/arithmetic/pi/do_work()
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = 3.14159
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, 3.14159)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// 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 \
|
||||
for outputs of 1, 2, or 3. H being the higher number is not <i>strictly</i> required."
|
||||
icon_state = "random"
|
||||
inputs = list("L","H")
|
||||
inputs = list("\<NUM\> L","\<NUM\> H")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/arithmetic/random/do_work()
|
||||
var/result = 0
|
||||
var/datum/integrated_io/L = inputs[1]
|
||||
var/datum/integrated_io/H = inputs[2]
|
||||
var/L = get_pin_data(IC_INPUT, 1)
|
||||
var/H = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
if(isnum(L.data) && isnum(H.data))
|
||||
result = rand(L.data, H.data)
|
||||
if(isnum(L) && isnum(H))
|
||||
result = rand(L, H)
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Square Root //
|
||||
|
||||
@@ -274,7 +283,7 @@
|
||||
name = "square root circuit"
|
||||
desc = "This outputs the square root of a number you put in."
|
||||
icon_state = "square_root"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/arithmetic/square_root/do_work()
|
||||
@@ -284,9 +293,9 @@
|
||||
if(isnum(I.data))
|
||||
result = sqrt(I.data)
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// % Modulo % //
|
||||
|
||||
@@ -294,17 +303,17 @@
|
||||
name = "modulo circuit"
|
||||
desc = "Gets the remainder of A / B."
|
||||
icon_state = "modulo"
|
||||
inputs = list("A", "B")
|
||||
inputs = list("\<NUM\> A", "\<NUM\> B")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/arithmetic/modulo/do_work()
|
||||
var/result = 0
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
var/datum/integrated_io/input/B = inputs[2]
|
||||
if(isnum(A.data) && isnum(B.data) && B.data != 0)
|
||||
result = A.data % B.data
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
var/B = get_pin_data(IC_INPUT, 2)
|
||||
if(isnum(A) && isnum(B) && B != 0)
|
||||
result = A % B
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
complexity = 2
|
||||
inputs = list("input")
|
||||
outputs = list("output")
|
||||
activators = list("convert")
|
||||
activators = list("\<PULSE IN\> convert", "\<PULSE OUT\> on convert")
|
||||
category_text = "Converter"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 10
|
||||
@@ -16,89 +16,113 @@
|
||||
name = "number to string"
|
||||
desc = "This circuit can convert a number variable into a string."
|
||||
icon_state = "num-string"
|
||||
inputs = list("\<NUM\> input")
|
||||
outputs = list("\<TEXT\> output")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/num2text/do_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)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && isnum(incoming))
|
||||
result = num2text(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/text2num
|
||||
name = "string to number"
|
||||
desc = "This circuit can convert a string variable into a number."
|
||||
icon_state = "string-num"
|
||||
inputs = list("\<TEXT\> input")
|
||||
outputs = list("\<NUM\> output")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/text2num/do_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)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && istext(incoming))
|
||||
result = text2num(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/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 = "ref-string"
|
||||
inputs = list("\<REF\> input")
|
||||
outputs = list("\<TEXT\> output")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/ref2text/do_work()
|
||||
var/result = null
|
||||
var/datum/integrated_io/incoming = inputs[1]
|
||||
var/datum/integrated_io/outgoing = outputs[1]
|
||||
var/atom/A = incoming.data_as_type(/atom)
|
||||
result = A && A.name
|
||||
pull_data()
|
||||
var/atom/A = get_pin_data(IC_INPUT, 1)
|
||||
if(A && istype(A))
|
||||
result = A.name
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/lowercase
|
||||
name = "lowercase string converter"
|
||||
desc = "this will cause a string to come out in all lowercase."
|
||||
icon_state = "lowercase"
|
||||
inputs = list("\<TEXT\> input")
|
||||
outputs = list("\<TEXT\> output")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/lowercase/do_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)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && istext(incoming))
|
||||
result = lowertext(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/uppercase
|
||||
name = "uppercase string converter"
|
||||
desc = "THIS WILL CAUSE A STRING TO COME OUT IN ALL UPPERCASE."
|
||||
icon_state = "uppercase"
|
||||
inputs = list("\<TEXT\> input")
|
||||
outputs = list("\<TEXT\> output")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/uppercase/do_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)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && istext(incoming))
|
||||
result = uppertext(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/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
|
||||
inputs = list("A","B","C","D","E","F","G","H")
|
||||
outputs = list("result")
|
||||
activators = list("concatenate")
|
||||
inputs = list(
|
||||
"\<TEXT/NUM\> A",
|
||||
"\<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
|
||||
|
||||
/obj/item/integrated_circuit/converter/concatenatior/do_work()
|
||||
@@ -107,70 +131,70 @@
|
||||
I.pull_data()
|
||||
if(istext(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]
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/radians2degrees
|
||||
name = "radians to degrees converter"
|
||||
desc = "Converts radians to degrees."
|
||||
inputs = list("radian")
|
||||
outputs = list("degrees")
|
||||
inputs = list("\<NUM\> radian")
|
||||
outputs = list("\<NUM\> degrees")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/radians2degrees/do_work()
|
||||
var/result = null
|
||||
var/datum/integrated_io/incoming = inputs[1]
|
||||
var/datum/integrated_io/outgoing = outputs[1]
|
||||
incoming.pull_data()
|
||||
if(incoming.data && isnum(incoming.data))
|
||||
result = ToDegrees(incoming.data)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && isnum(incoming))
|
||||
result = ToDegrees(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/converter/degrees2radians
|
||||
name = "degrees to radians converter"
|
||||
desc = "Converts degrees to radians."
|
||||
inputs = list("degrees")
|
||||
outputs = list("radians")
|
||||
inputs = list("\<NUM\> degrees")
|
||||
outputs = list("\<NUM\> radians")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/degrees2radians/do_work()
|
||||
var/result = null
|
||||
var/datum/integrated_io/incoming = inputs[1]
|
||||
var/datum/integrated_io/outgoing = outputs[1]
|
||||
incoming.pull_data()
|
||||
if(incoming.data && isnum(incoming.data))
|
||||
result = ToRadians(incoming.data)
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(incoming && isnum(incoming))
|
||||
result = ToRadians(incoming)
|
||||
|
||||
outgoing.data = result
|
||||
outgoing.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/converter/abs_to_rel_coords
|
||||
name = "abs to rel coordinate converter"
|
||||
desc = "Easily convert absolute coordinates to relative coordinates with this."
|
||||
complexity = 4
|
||||
inputs = list("X1 (abs)", "Y1 (abs)", "X2 (abs)", "Y2 (abs)")
|
||||
outputs = list("X (rel)", "Y (rel)")
|
||||
activators = list("compute rel coordinates")
|
||||
inputs = list("\<NUM\> X1", "\<NUM\> Y1", "\<NUM\> X2", "\<NUM\> Y2")
|
||||
outputs = list("\<NUM\> X", "\<NUM\> Y")
|
||||
activators = list("\<PULSE IN\> compute rel coordinates", "\<PULSE OUT\> on convert")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/converter/abs_to_rel_coords/do_work()
|
||||
var/datum/integrated_io/x1 = inputs[1]
|
||||
var/datum/integrated_io/y1 = inputs[2]
|
||||
var/x1 = get_pin_data(IC_INPUT, 1)
|
||||
var/y1 = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
var/datum/integrated_io/x2 = inputs[3]
|
||||
var/datum/integrated_io/y2 = inputs[4]
|
||||
var/x2 = get_pin_data(IC_INPUT, 3)
|
||||
var/y2 = get_pin_data(IC_INPUT, 4)
|
||||
|
||||
var/datum/integrated_io/result_x = outputs[1]
|
||||
var/datum/integrated_io/result_y = outputs[2]
|
||||
if(x1 && y1 && x2 && y2)
|
||||
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)
|
||||
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()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
@@ -14,28 +14,27 @@
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("on pressed")
|
||||
activators = list("\<PULSE OUT\> on pressed")
|
||||
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.
|
||||
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>")
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/input/toggle_button
|
||||
name = "toggle button"
|
||||
desc = "It toggles on, off, on, off..."
|
||||
icon_state = "toggle_button"
|
||||
complexity = 1
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("on" = 0)
|
||||
activators = list("on toggle")
|
||||
outputs = list("\<NUM\> on" = 0)
|
||||
activators = list("\<PULSE OUT\> on toggle")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/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))
|
||||
push_data()
|
||||
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>")
|
||||
|
||||
@@ -46,19 +45,17 @@
|
||||
complexity = 2
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("number entered")
|
||||
activators = list("on entered")
|
||||
outputs = list("\<NUM\> number entered")
|
||||
activators = list("\<PULSE OUT\> on entered")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
/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
|
||||
if(isnum(new_input) && CanInteract(user, physical_state))
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
O.data = new_input
|
||||
O.push_data()
|
||||
var/datum/integrated_io/A = activators[1]
|
||||
A.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, new_input)
|
||||
push_data()
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/input/textpad
|
||||
name = "text pad"
|
||||
@@ -67,49 +64,43 @@
|
||||
complexity = 2
|
||||
can_be_asked_input = 1
|
||||
inputs = list()
|
||||
outputs = list("string entered")
|
||||
activators = list("on entered")
|
||||
outputs = list("\<TEXT\> string entered")
|
||||
activators = list("\<PULSE OUT\> on entered")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
/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
|
||||
if(istext(new_input) && CanInteract(user, physical_state))
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
O.data = new_input
|
||||
O.push_data()
|
||||
var/datum/integrated_io/A = activators[1]
|
||||
A.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, new_input)
|
||||
push_data()
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/input/med_scanner
|
||||
name = "integrated medical analyser"
|
||||
desc = "A very small version of the common medical analyser. This allows the machine to know how healthy someone is."
|
||||
icon_state = "medscan"
|
||||
complexity = 4
|
||||
inputs = list("target ref")
|
||||
outputs = list("total health %", "total missing health")
|
||||
activators = list("scan")
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> total health %", "\<NUM\> total missing health")
|
||||
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
power_draw_per_use = 40
|
||||
|
||||
/obj/item/integrated_circuit/input/med_scanner/do_work()
|
||||
var/datum/integrated_io/I = inputs[1]
|
||||
var/mob/living/carbon/human/H = I.data_as_type(/mob/living/carbon/human)
|
||||
var/mob/living/carbon/human/H = get_pin_data_as_type(IC_INPUT, 1, /mob/living/carbon/human)
|
||||
if(!istype(H)) //Invalid input
|
||||
return
|
||||
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/missing_health = H.getMaxHealth() - H.health
|
||||
|
||||
var/datum/integrated_io/total = outputs[1]
|
||||
var/datum/integrated_io/missing = outputs[2]
|
||||
set_pin_data(IC_OUTPUT, 1, total_health)
|
||||
set_pin_data(IC_OUTPUT, 2, missing_health)
|
||||
|
||||
total.data = total_health
|
||||
missing.data = missing_health
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.push_data()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/input/adv_med_scanner
|
||||
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."
|
||||
icon_state = "medscan_adv"
|
||||
complexity = 12
|
||||
inputs = list("target ref")
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list(
|
||||
"total health %",
|
||||
"total missing health",
|
||||
"brute damage",
|
||||
"burn damage",
|
||||
"tox damage",
|
||||
"oxy damage",
|
||||
"clone damage"
|
||||
"\<NUM\> total health %",
|
||||
"\<NUM\> total missing health",
|
||||
"\<NUM\> brute damage",
|
||||
"\<NUM\> burn damage",
|
||||
"\<NUM\> tox damage",
|
||||
"\<NUM\> oxy damage",
|
||||
"\<NUM\> clone damage"
|
||||
)
|
||||
activators = list("scan")
|
||||
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4)
|
||||
power_draw_per_use = 80
|
||||
|
||||
/obj/item/integrated_circuit/input/adv_med_scanner/do_work()
|
||||
var/datum/integrated_io/I = inputs[1]
|
||||
var/mob/living/carbon/human/H = I.data_as_type(/mob/living/carbon/human)
|
||||
var/mob/living/carbon/human/H = get_pin_data_as_type(IC_INPUT, 1, /mob/living/carbon/human)
|
||||
if(!istype(H)) //Invalid input
|
||||
return
|
||||
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/missing_health = H.getMaxHealth() - H.health
|
||||
|
||||
var/datum/integrated_io/total = outputs[1]
|
||||
var/datum/integrated_io/missing = outputs[2]
|
||||
var/datum/integrated_io/brute = outputs[3]
|
||||
var/datum/integrated_io/burn = outputs[4]
|
||||
var/datum/integrated_io/tox = outputs[5]
|
||||
var/datum/integrated_io/oxy = outputs[6]
|
||||
var/datum/integrated_io/clone = outputs[7]
|
||||
set_pin_data(IC_OUTPUT, 1, total_health)
|
||||
set_pin_data(IC_OUTPUT, 2, missing_health)
|
||||
set_pin_data(IC_OUTPUT, 3, H.getBruteLoss())
|
||||
set_pin_data(IC_OUTPUT, 4, H.getFireLoss())
|
||||
set_pin_data(IC_OUTPUT, 5, H.getToxLoss())
|
||||
set_pin_data(IC_OUTPUT, 6, H.getOxyLoss())
|
||||
set_pin_data(IC_OUTPUT, 7, H.getCloneLoss())
|
||||
|
||||
total.data = total_health
|
||||
missing.data = missing_health
|
||||
brute.data = H.getBruteLoss()
|
||||
burn.data = H.getFireLoss()
|
||||
tox.data = H.getToxLoss()
|
||||
oxy.data = H.getOxyLoss()
|
||||
clone.data = H.getCloneLoss()
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.push_data()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/input/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."
|
||||
icon_state = "signal"
|
||||
complexity = 4
|
||||
inputs = list("frequency","code")
|
||||
inputs = list("\<NUM\> frequency","\<NUM\> code")
|
||||
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
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2)
|
||||
power_draw_idle = 5
|
||||
@@ -237,11 +219,9 @@
|
||||
/obj/item/integrated_circuit/input/signaler/initialize()
|
||||
..()
|
||||
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
|
||||
new_freq.data = frequency
|
||||
new_code.data = code
|
||||
set_pin_data(IC_INPUT, 1, frequency)
|
||||
set_pin_data(IC_INPUT, 2, code)
|
||||
|
||||
/obj/item/integrated_circuit/input/signaler/Destroy()
|
||||
if(radio_controller)
|
||||
@@ -250,12 +230,12 @@
|
||||
. = ..()
|
||||
|
||||
/obj/item/integrated_circuit/input/signaler/on_data_written()
|
||||
var/datum/integrated_io/new_freq = inputs[1]
|
||||
var/datum/integrated_io/new_code = inputs[2]
|
||||
if(isnum(new_freq.data) && new_freq.data > 0)
|
||||
set_frequency(new_freq.data)
|
||||
if(isnum(new_code.data))
|
||||
code = new_code.data
|
||||
var/new_freq = get_pin_data(IC_INPUT, 1)
|
||||
var/new_code = get_pin_data(IC_INPUT, 2)
|
||||
if(isnum(new_freq) && new_freq > 0)
|
||||
set_frequency(new_freq)
|
||||
if(isnum(new_code))
|
||||
code = new_code
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/input/signaler/do_work() // Sends a signal.
|
||||
@@ -267,6 +247,7 @@
|
||||
signal.encryption = code
|
||||
signal.data["message"] = "ACTIVATE"
|
||||
radio_connection.post_signal(src, signal)
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/input/signaler/proc/set_frequency(new_frequency)
|
||||
if(!frequency)
|
||||
@@ -280,11 +261,11 @@
|
||||
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
|
||||
|
||||
/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
|
||||
|
||||
if(isnum(new_code.data))
|
||||
code = new_code.data
|
||||
if(isnum(new_code))
|
||||
code = new_code
|
||||
if(!signal)
|
||||
return 0
|
||||
if(signal.encryption != code)
|
||||
@@ -292,8 +273,7 @@
|
||||
if(signal.source == src) // Don't trigger ourselves.
|
||||
return 0
|
||||
|
||||
var/datum/integrated_io/A = activators[2]
|
||||
A.push_data()
|
||||
activate_pin(3)
|
||||
|
||||
for(var/mob/O in hearers(1, get_turf(src)))
|
||||
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."
|
||||
icon_state = "signal"
|
||||
complexity = 4
|
||||
inputs = list("target EPv2 address", "data to send", "secondary text")
|
||||
outputs = list("address received", "data received", "secondary text received")
|
||||
activators = list("send data", "on data received")
|
||||
inputs = list("\<TEXT\> target EPv2 address", "\<TEXT\> data to send", "\<TEXT\> secondary text")
|
||||
outputs = list("\<TEXT\> address received", "\<TEXT\> data received", "\<TEXT\> secondary text received")
|
||||
activators = list("\<PULSE IN\> send data", "\<PULSE OUT\> on data received")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2, TECH_BLUESPACE = 2)
|
||||
power_draw_per_use = 50
|
||||
@@ -318,7 +298,7 @@
|
||||
..()
|
||||
exonet = new(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()
|
||||
if(exonet)
|
||||
@@ -327,64 +307,60 @@
|
||||
..()
|
||||
|
||||
/obj/item/integrated_circuit/input/EPv2/do_work()
|
||||
var/datum/integrated_io/target_address = inputs[1]
|
||||
var/datum/integrated_io/message = inputs[2]
|
||||
var/datum/integrated_io/text = inputs[3]
|
||||
if(istext(target_address.data))
|
||||
exonet.send_message(target_address.data, message.data, text.data)
|
||||
var/target_address = get_pin_data(IC_INPUT, 1)
|
||||
var/message = get_pin_data(IC_INPUT, 2)
|
||||
var/text = get_pin_data(IC_INPUT, 3)
|
||||
|
||||
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)
|
||||
var/datum/integrated_io/message_received = outputs[1]
|
||||
var/datum/integrated_io/data_received = outputs[2]
|
||||
var/datum/integrated_io/text_received = outputs[3]
|
||||
set_pin_data(IC_OUTPUT, 1, origin_address)
|
||||
set_pin_data(IC_OUTPUT, 2, message)
|
||||
set_pin_data(IC_OUTPUT, 3, text)
|
||||
|
||||
var/datum/integrated_io/A = activators[2]
|
||||
A.push_data()
|
||||
|
||||
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()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
//This circuit gives information on where the machine is.
|
||||
/obj/item/integrated_circuit/input/gps
|
||||
name = "global positioning system"
|
||||
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"
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list("X (abs)", "Y (abs)")
|
||||
activators = list("get coordinates")
|
||||
outputs = list("\<NUM\> X", "\<NUM\> Y")
|
||||
activators = list("\<PULSE IN\> get coordinates", "\<PULSE OUT\> on get coordinates")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 30
|
||||
|
||||
/obj/item/integrated_circuit/input/gps/do_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
|
||||
set_pin_data(IC_OUTPUT, 1, null)
|
||||
set_pin_data(IC_OUTPUT, 2, null)
|
||||
if(!T)
|
||||
return
|
||||
|
||||
result_x.data = T.x
|
||||
result_y.data = T.y
|
||||
set_pin_data(IC_OUTPUT, 1, T.x)
|
||||
set_pin_data(IC_OUTPUT, 2, T.y)
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.push_data()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/input/microphone
|
||||
name = "microphone"
|
||||
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"
|
||||
complexity = 8
|
||||
inputs = list()
|
||||
outputs = list("speaker \<String\>", "message \<String\>")
|
||||
activators = list("on message received")
|
||||
outputs = list("\<TEXT\> speaker", "\<TEXT\> message")
|
||||
activators = list("\<PULSE OUT\> on message received", "\<PULSE OUT\> on translation")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
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)
|
||||
var/datum/integrated_io/V = outputs[1]
|
||||
var/datum/integrated_io/O = outputs[2]
|
||||
var/datum/integrated_io/A = activators[1]
|
||||
var/translated = FALSE
|
||||
if(M && msg)
|
||||
if(speaking)
|
||||
if(!speaking.machine_understands)
|
||||
msg = speaking.scramble(msg)
|
||||
V.data = M.GetVoice()
|
||||
O.data = msg
|
||||
A.push_data()
|
||||
if(!istype(speaking, /datum/language/common))
|
||||
translated = TRUE
|
||||
set_pin_data(IC_OUTPUT, 1, M.GetVoice())
|
||||
set_pin_data(IC_OUTPUT, 2, msg)
|
||||
|
||||
for(var/datum/integrated_io/output/out in outputs)
|
||||
out.push_data()
|
||||
|
||||
A.push_data()
|
||||
push_data()
|
||||
activate_pin(1)
|
||||
if(translated)
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
|
||||
/obj/item/integrated_circuit/input/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."
|
||||
extended_desc = "If 'ignore storage' pin is set to 1, the sensor will disregard scanning various storage containers such as backpacks."
|
||||
icon_state = "recorder"
|
||||
complexity = 12
|
||||
inputs = list()
|
||||
outputs = list("scanned ref \<Ref\>")
|
||||
activators = list("on scanned")
|
||||
inputs = list("\<NUM\> ignore storage" = 1)
|
||||
outputs = list("\<REF\> scanned")
|
||||
activators = list("\<PULSE OUT\> on scanned")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 120
|
||||
|
||||
/obj/item/integrated_circuit/input/sensor/do_work()
|
||||
// Because this gets called by attack(), all this needs to do is pulse the activator.
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.push_data()
|
||||
var/datum/integrated_io/activate/A = activators[1]
|
||||
A.push_data()
|
||||
/obj/item/integrated_circuit/input/sensor/proc/scan(var/atom/A)
|
||||
var/ignore_bags = get_pin_data(IC_INPUT, 1)
|
||||
if(ignore_bags)
|
||||
if(istype(A, /obj/item/weapon/storage))
|
||||
return FALSE
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, weakref(A))
|
||||
push_data()
|
||||
activate_pin(1)
|
||||
return TRUE
|
||||
|
||||
/obj/item/integrated_circuit/output
|
||||
category_text = "Output"
|
||||
@@ -441,9 +420,9 @@
|
||||
name = "small screen"
|
||||
desc = "This small screen can display a single piece of data, when the machine is examined closely."
|
||||
icon_state = "screen"
|
||||
inputs = list("displayed data")
|
||||
inputs = list("\<TEXT/NUM\> displayed data")
|
||||
outputs = list()
|
||||
activators = list("load data")
|
||||
activators = list("\<PULSE IN\> load data")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 10
|
||||
autopulse = 1
|
||||
@@ -497,7 +476,7 @@
|
||||
complexity = 4
|
||||
inputs = list()
|
||||
outputs = list()
|
||||
activators = list("toggle light")
|
||||
activators = list("\<PULSE IN\> toggle light")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
var/light_toggled = 0
|
||||
var/light_brightness = 3
|
||||
@@ -519,18 +498,18 @@
|
||||
power_draw_idle = light_toggled ? light_brightness * 2 : 0
|
||||
|
||||
/obj/item/integrated_circuit/output/light/advanced/update_lighting()
|
||||
var/datum/integrated_io/R = inputs[1]
|
||||
var/datum/integrated_io/G = inputs[2]
|
||||
var/datum/integrated_io/B = inputs[3]
|
||||
var/datum/integrated_io/brightness = inputs[4]
|
||||
var/R = get_pin_data(IC_INPUT, 1)
|
||||
var/G = get_pin_data(IC_INPUT, 2)
|
||||
var/B = get_pin_data(IC_INPUT, 3)
|
||||
var/brightness = get_pin_data(IC_INPUT, 4)
|
||||
|
||||
if(isnum(R.data) && isnum(G.data) && isnum(B.data) && isnum(brightness.data))
|
||||
R.data = Clamp(R.data, 0, 255)
|
||||
G.data = Clamp(G.data, 0, 255)
|
||||
B.data = Clamp(B.data, 0, 255)
|
||||
brightness.data = Clamp(brightness.data, 0, 6)
|
||||
light_rgb = rgb(R.data, G.data, B.data)
|
||||
light_brightness = brightness.data
|
||||
if(isnum(R) && isnum(G) && isnum(B) && isnum(brightness))
|
||||
R = Clamp(R, 0, 255)
|
||||
G = Clamp(G, 0, 255)
|
||||
B = Clamp(B, 0, 255)
|
||||
brightness = Clamp(brightness, 0, 6)
|
||||
light_rgb = rgb(R, G, B)
|
||||
light_brightness = brightness
|
||||
|
||||
..()
|
||||
|
||||
@@ -544,10 +523,10 @@
|
||||
icon_state = "light_adv"
|
||||
complexity = 8
|
||||
inputs = list(
|
||||
"R",
|
||||
"G",
|
||||
"B",
|
||||
"Brightness"
|
||||
"\<NUM\> R",
|
||||
"\<NUM\> G",
|
||||
"\<NUM\> B",
|
||||
"\<NUM\> Brightness"
|
||||
)
|
||||
outputs = list()
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
@@ -563,9 +542,9 @@
|
||||
complexity = 8
|
||||
cooldown_per_use = 4 SECONDS
|
||||
inputs = list(
|
||||
"sound ID",
|
||||
"volume",
|
||||
"frequency"
|
||||
"\<TEXT\> sound ID",
|
||||
"\<NUM\> volume",
|
||||
"\<NUM\> frequency"
|
||||
)
|
||||
outputs = list()
|
||||
activators = list("play sound")
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE."
|
||||
complexity = 3
|
||||
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"
|
||||
autopulse = 1
|
||||
power_draw_per_use = 1
|
||||
@@ -14,19 +14,17 @@
|
||||
check_then_do_work()
|
||||
|
||||
/obj/item/integrated_circuit/logic/do_work()
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
var/datum/integrated_io/T = activators[2]
|
||||
var/datum/integrated_io/F = activators[3]
|
||||
O.push_data()
|
||||
if(O.data)
|
||||
T.push_data()
|
||||
push_data()
|
||||
if(get_pin_data(IC_INPUT, 1))
|
||||
activate_pin(1)
|
||||
else
|
||||
F.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary
|
||||
inputs = list("A","B")
|
||||
inputs = list("\<ANY\> A","\<ANY\> B")
|
||||
|
||||
/obj/item/integrated_circuit/logic/binary/do_work()
|
||||
pull_data()
|
||||
var/datum/integrated_io/A = inputs[1]
|
||||
var/datum/integrated_io/B = inputs[2]
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
@@ -37,9 +35,10 @@
|
||||
return FALSE
|
||||
|
||||
/obj/item/integrated_circuit/logic/unary
|
||||
inputs = list("A")
|
||||
inputs = list("\<ANY\> A")
|
||||
|
||||
/obj/item/integrated_circuit/logic/unary/do_work()
|
||||
pull_data()
|
||||
var/datum/integrated_io/A = inputs[1]
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
O.data = do_check(A) ? TRUE : FALSE
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
complexity = 20
|
||||
w_class = ITEMSIZE_NORMAL
|
||||
inputs = list(
|
||||
"target X rel",
|
||||
"target Y rel"
|
||||
"\<NUM\> target X rel",
|
||||
"\<NUM\> target Y rel"
|
||||
)
|
||||
outputs = list()
|
||||
activators = list(
|
||||
"fire"
|
||||
"\<PULSE IN\> fire"
|
||||
)
|
||||
var/obj/item/weapon/gun/installed_gun = null
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
some power is lost due to ineffiency."
|
||||
w_class = ITEMSIZE_SMALL
|
||||
complexity = 16
|
||||
inputs = list("target ref")
|
||||
outputs = list("target cell charge", "target cell max charge", "target cell percentage")
|
||||
activators = list("transmit")
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> target cell charge", "\<NUM\> target cell max charge", "\<NUM\> target cell percentage")
|
||||
activators = list("\<PULSE IN\> transmit")
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
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.
|
||||
|
||||
@@ -43,39 +43,39 @@
|
||||
flags = OPENCONTAINER
|
||||
complexity = 20
|
||||
cooldown_per_use = 6 SECONDS
|
||||
inputs = list("target ref", "injection amount" = 5)
|
||||
inputs = list("\<REF\> target", "\<NUM\> injection amount" = 5)
|
||||
outputs = list()
|
||||
activators = list("inject")
|
||||
activators = list("\<PULSE IN\> inject")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
volume = 30
|
||||
power_draw_per_use = 15
|
||||
|
||||
/obj/item/integrated_circuit/reagent/injector/proc/inject_amount()
|
||||
var/datum/integrated_io/amount = inputs[2]
|
||||
if(isnum(amount.data))
|
||||
return Clamp(amount.data, 0, 30)
|
||||
var/amount = get_pin_data(IC_INPUT, 2)
|
||||
if(isnum(amount))
|
||||
return Clamp(amount, 0, 30)
|
||||
|
||||
/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
|
||||
|
||||
var/datum/integrated_io/target = inputs[1]
|
||||
var/atom/movable/AM = target.data_as_type(/atom/movable)
|
||||
var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
|
||||
if(!istype(AM)) //Invalid input
|
||||
return
|
||||
if(!reagents.total_volume) // Empty
|
||||
return
|
||||
if(AM.can_be_injected_by(src))
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = 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)
|
||||
if(!AM.can_be_injected_by(src))
|
||||
if(!L.can_be_injected_by(src))
|
||||
return
|
||||
var/contained = reagents.get_reagents()
|
||||
var/trans = reagents.trans_to_mob(target, inject_amount(), CHEM_BLOOD)
|
||||
message_admins("[src] injected \the [AM] with [trans]u of [contained].")
|
||||
var/trans = reagents.trans_to_mob(L, inject_amount(), CHEM_BLOOD)
|
||||
message_admins("[src] injected \the [L] with [trans]u of [contained].")
|
||||
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
|
||||
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."
|
||||
flags = OPENCONTAINER
|
||||
complexity = 8
|
||||
inputs = list("source ref", "target ref", "injection amount" = 10)
|
||||
inputs = list("\<REF\> source", "\<REF\> target", "\<NUM\> injection amount" = 10)
|
||||
outputs = list()
|
||||
activators = list("transfer reagents")
|
||||
activators = list("\<PULSE IN\> transfer reagents", "\<PULSE OUT\> on transfer")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
|
||||
var/transfer_amount = 10
|
||||
@@ -103,10 +103,9 @@
|
||||
transfer_amount = amount.data
|
||||
|
||||
/obj/item/integrated_circuit/reagent/pump/do_work()
|
||||
var/datum/integrated_io/A = inputs[1]
|
||||
var/datum/integrated_io/B = inputs[2]
|
||||
var/atom/movable/source = A.data_as_type(/atom/movable)
|
||||
var/atom/movable/target = B.data_as_type(/atom/movable)
|
||||
var/atom/movable/source = get_pin_data_as_type(IC_INPUT, 1, /atom/movable)
|
||||
var/atom/movable/target = get_pin_data_as_type(IC_INPUT, 2, /atom/movable)
|
||||
|
||||
if(!istype(source) || !istype(target)) //Invalid input
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
@@ -117,10 +116,11 @@
|
||||
return
|
||||
if(!source.is_open_container() || !target.is_open_container())
|
||||
return
|
||||
if(!source.reagents.get_free_space() || !target.reagents.get_free_space())
|
||||
if(!target.reagents.get_free_space())
|
||||
return
|
||||
|
||||
source.reagents.trans_to(target, transfer_amount)
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/reagent/storage
|
||||
name = "reagent storage"
|
||||
|
||||
@@ -8,17 +8,16 @@
|
||||
cannot see the target, it will not be able to calculate the correct direction."
|
||||
icon_state = "numberpad"
|
||||
complexity = 25
|
||||
inputs = list("target ref")
|
||||
outputs = list("dir")
|
||||
activators = list("calculate dir")
|
||||
inputs = list("\<REF\> target")
|
||||
outputs = list("\<NUM\> dir")
|
||||
activators = list("\<PULSE IN\> calculate dir", "\<PULSE OUT\> on calculated")
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5)
|
||||
power_draw_per_use = 40
|
||||
|
||||
/obj/item/integrated_circuit/smart/basic_pathfinder/do_work()
|
||||
var/datum/integrated_io/I = inputs[1]
|
||||
var/datum/integrated_io/O = outputs[1]
|
||||
O.data = null
|
||||
set_pin_data(IC_OUTPUT, 1, null)
|
||||
|
||||
if(!isweakref(I.data))
|
||||
return
|
||||
@@ -28,6 +27,6 @@
|
||||
if(!(A in view(get_turf(src))))
|
||||
return // Can't see the target.
|
||||
var/desired_dir = get_dir(get_turf(src), A)
|
||||
if(desired_dir)
|
||||
O.data = desired_dir
|
||||
O.push_data()
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, desired_dir)
|
||||
push_data()
|
||||
@@ -12,16 +12,15 @@
|
||||
This circuit is set to send a pulse after a delay of two seconds."
|
||||
icon_state = "delay-20"
|
||||
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
|
||||
power_draw_per_use = 2
|
||||
|
||||
/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
|
||||
|
||||
var/datum/integrated_io/out_pulse = activators[2]
|
||||
sleep(delay)
|
||||
out_pulse.push_data()
|
||||
activate_pin(2)
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/five_sec
|
||||
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. \
|
||||
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"
|
||||
inputs = list("delay time")
|
||||
inputs = list("\<NUM\> delay time")
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/time/delay/custom/do_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.
|
||||
var/delay_input = get_pin_data(IC_INPUT, 1)
|
||||
if(delay_input && isnum(delay_input) )
|
||||
var/new_delay = between(1, delay_input, 36000) //An hour.
|
||||
delay = new_delay
|
||||
|
||||
..()
|
||||
@@ -80,8 +78,8 @@
|
||||
var/ticks_to_pulse = 4
|
||||
var/ticks_completed = 0
|
||||
var/is_running = FALSE
|
||||
inputs = list("enable ticking")
|
||||
activators = list("outgoing pulse")
|
||||
inputs = list("\<NUM\> enable ticking" = 0)
|
||||
activators = list("\<PULSE OUT\> outgoing pulse")
|
||||
spawn_flags = IC_SPAWN_RESEARCH
|
||||
power_draw_per_use = 4
|
||||
|
||||
@@ -91,8 +89,8 @@
|
||||
. = ..()
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker/on_data_written()
|
||||
var/datum/integrated_io/do_tick = inputs[1]
|
||||
if(do_tick.data && !is_running)
|
||||
var/do_tick = get_pin_data(IC_INPUT, 1)
|
||||
if(do_tick && !is_running)
|
||||
is_running = TRUE
|
||||
processing_objects |= src
|
||||
else if(is_running)
|
||||
@@ -108,8 +106,7 @@
|
||||
ticks_completed -= ticks_to_pulse
|
||||
else
|
||||
ticks_completed = 0
|
||||
var/datum/integrated_io/pulser = activators[1]
|
||||
pulser.push_data()
|
||||
activate_pin(1)
|
||||
|
||||
/obj/item/integrated_circuit/time/ticker/fast
|
||||
name = "fast ticker"
|
||||
@@ -134,20 +131,16 @@
|
||||
desc = "Tells you what the local time is, specific to your station or planet."
|
||||
icon_state = "clock"
|
||||
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
|
||||
power_draw_per_use = 4
|
||||
|
||||
/obj/item/integrated_circuit/time/clock/do_work()
|
||||
var/datum/integrated_io/time = outputs[1]
|
||||
var/datum/integrated_io/hour = outputs[2]
|
||||
var/datum/integrated_io/min = outputs[3]
|
||||
var/datum/integrated_io/sec = outputs[4]
|
||||
set_pin_data(IC_OUTPUT, 1, time2text(station_time_in_ticks, "hh:mm:ss") )
|
||||
set_pin_data(IC_OUTPUT, 2, text2num(time2text(station_time_in_ticks, "hh") ) )
|
||||
set_pin_data(IC_OUTPUT, 3, text2num(time2text(station_time_in_ticks, "mm") ) )
|
||||
set_pin_data(IC_OUTPUT, 4, text2num(time2text(station_time_in_ticks, "ss") ) )
|
||||
|
||||
time.data = time2text(station_time_in_ticks, "hh:mm:ss")
|
||||
hour.data = text2num(time2text(station_time_in_ticks, "hh"))
|
||||
min.data = text2num(time2text(station_time_in_ticks, "mm"))
|
||||
sec.data = text2num(time2text(station_time_in_ticks, "ss"))
|
||||
|
||||
for(var/datum/integrated_io/output/O in outputs)
|
||||
O.push_data()
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
@@ -1,9 +1,18 @@
|
||||
//These circuits do not-so-simple math.
|
||||
/obj/item/integrated_circuit/trig
|
||||
complexity = 1
|
||||
inputs = list("A","B","C","D","E","F","G","H")
|
||||
outputs = list("result")
|
||||
activators = list("compute")
|
||||
inputs = list(
|
||||
"\<NUM\> A",
|
||||
"\<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"
|
||||
extended_desc = "Input and output are in degrees."
|
||||
autopulse = 1
|
||||
@@ -19,19 +28,19 @@
|
||||
name = "sin circuit"
|
||||
desc = "Has nothing to do with evil, unless you consider trigonometry to be evil. Outputs the sine of A."
|
||||
icon_state = "sine"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/sine/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = sin(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = sin(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Cosine //
|
||||
|
||||
@@ -39,19 +48,19 @@
|
||||
name = "cos circuit"
|
||||
desc = "Outputs the cosine of A."
|
||||
icon_state = "cosine"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/cosine/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = cos(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = cos(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Tangent //
|
||||
|
||||
@@ -59,19 +68,19 @@
|
||||
name = "tan circuit"
|
||||
desc = "Outputs the tangent of A. Guaranteed to not go on a tangent about its existance."
|
||||
icon_state = "tangent"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/tangent/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = Tan(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = Tan(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
// Cosecant //
|
||||
|
||||
@@ -79,19 +88,19 @@
|
||||
name = "csc circuit"
|
||||
desc = "Outputs the cosecant of A."
|
||||
icon_state = "cosecant"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/cosecant/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = Csc(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = Csc(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
// Secant //
|
||||
@@ -100,19 +109,19 @@
|
||||
name = "sec circuit"
|
||||
desc = "Outputs the secant of A. Has nothing to do with the security department."
|
||||
icon_state = "secant"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/secant/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = Sec(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = Sec(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
|
||||
|
||||
// Cotangent //
|
||||
@@ -121,16 +130,16 @@
|
||||
name = "cot circuit"
|
||||
desc = "Outputs the cotangent of A."
|
||||
icon_state = "cotangent"
|
||||
inputs = list("A")
|
||||
inputs = list("\<NUM\> A")
|
||||
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
|
||||
|
||||
/obj/item/integrated_circuit/trig/cotangent/do_work()
|
||||
pull_data()
|
||||
var/result = null
|
||||
var/datum/integrated_io/input/A = inputs[1]
|
||||
A.pull_data()
|
||||
if(isnum(A.data))
|
||||
result = Cot(A.data)
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(isnum(A))
|
||||
result = Cot(A)
|
||||
|
||||
var/datum/integrated_io/output/O = outputs[1]
|
||||
O.data = result
|
||||
O.push_data()
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
activate_pin(2)
|
||||
Reference in New Issue
Block a user