Permanent Revolution Update

This commit is contained in:
Neerti
2017-01-04 04:41:30 -05:00
parent dc89eb5700
commit 97ebf0924d
28 changed files with 1296 additions and 93 deletions
@@ -29,6 +29,7 @@ var/list/all_integrated_circuits = list()
var/cooldown_per_use = 1 SECOND
var/spawn_flags = null // Used for world initializing, see the #defines above.
var/category_text = "NO CATEGORY" // To show up on circuit printer, and perhaps other places.
var/autopulse = -1 // When input is received, the circuit will pulse itself if set to 1. 0 means it won't. -1 means it is permanently off.
/obj/item/integrated_circuit/examine(mob/user)
..()
@@ -71,7 +72,8 @@ var/list/all_integrated_circuits = list()
/obj/item/integrated_circuit/nano_host()
if(istype(src.loc, /obj/item/device/electronic_assembly))
return loc
var/obj/item/device/electronic_assembly/assembly = loc
return assembly.resolve_nano_host()
return ..()
/obj/item/integrated_circuit/emp_act(severity)
@@ -112,6 +114,14 @@ var/list/all_integrated_circuits = list()
if(!CanInteract(user, physical_state))
return
var/window_height = 350
var/window_width = 600
//var/table_edge_width = "[(window_width - window_width * 0.1) / 4]px"
//var/table_middle_width = "[(window_width - window_width * 0.1) - (table_edge_width * 2)]px"
var/table_edge_width = "30%"
var/table_middle_width = "40%"
var/HTML = list()
HTML += "<html><head><title>[src.name]</title></head><body>"
HTML += "<div align='center'>"
@@ -122,9 +132,12 @@ var/list/all_integrated_circuits = list()
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: 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]'>"
HTML += "</colgroup>"
var/column_width = 3
@@ -196,11 +209,16 @@ var/list/all_integrated_circuits = list()
HTML += "</table>"
HTML += "</div>"
HTML += "<br><font color='0000FF'>Complexity: [complexity]</font>"
HTML += "<br><font color='0000FF'>[extended_desc]</font>"
if(autopulse != -1)
HTML += "<br><font color='33CC33'>Meta Variables;</font>"
HTML += "<br><font color='33CC33'><a href='?src=\ref[src];autopulse=1'>\[Autopulse\]</a> = <b>[autopulse ? "ON" : "OFF"]</b></font>"
HTML += "<br>"
HTML += "<br><font color='0000AA'>Complexity: [complexity]</font>"
HTML += "<br><font color='0000AA'>[extended_desc]</font>"
HTML += "</body></html>"
user << browse(jointext(HTML, null), "window=circuit-\ref[src];size=600x350;border=1;can_resize=1;can_close=1;can_minimize=1")
user << browse(jointext(HTML, null), "window=circuit-\ref[src];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
onclose(user, "circuit-\ref[src]")
@@ -229,6 +247,10 @@ var/list/all_integrated_circuits = list()
if(href_list["rename"])
rename_component(usr)
if(href_list["autopulse"])
if(autopulse != -1)
autopulse = !autopulse
if(href_list["remove"])
if(istype(held_item, /obj/item/weapon/screwdriver))
disconnect_all()
@@ -267,7 +289,7 @@ var/list/all_integrated_circuits = list()
. = ..()
/datum/integrated_io/nano_host()
return holder
return holder.nano_host()
/datum/integrated_io/proc/data_as_type(var/as_type)
@@ -285,7 +307,8 @@ var/list/all_integrated_circuits = list()
if(isweakref(data))
var/weakref/w = data
var/atom/A = w.resolve()
return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
//return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
return A ? "(\ref[A] \[Ref\])" : "(null)"
return "([data])" // Nothing special needed for numbers or other stuff.
/datum/integrated_io/activate/display_data()
@@ -5,6 +5,11 @@
outputs = list("result")
activators = list("compute")
category_text = "Arithmetic"
autopulse = 1
/obj/item/integrated_circuit/arithmetic/on_data_written()
if(autopulse == 1)
check_then_do_work()
// +Adding+ //
@@ -195,8 +200,8 @@
var/result = 0
for(var/datum/integrated_io/input/I in inputs)
I.pull_data()
if(isnum(I.data) && I.data != 0)
result = abs(result)
if(isnum(I.data))
result = abs(I.data)
for(var/datum/integrated_io/output/O in outputs)
O.data = result
@@ -260,4 +265,45 @@
for(var/datum/integrated_io/output/O in outputs)
O.data = result
O.push_data()
O.push_data()
// Square Root //
/obj/item/integrated_circuit/arithmetic/square_root
name = "square root circuit"
desc = "This outputs the square root of a number you put in."
icon_state = "square_root"
inputs = list("A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/arithmetic/square_root/do_work()
var/result = 0
for(var/datum/integrated_io/input/I in inputs)
I.pull_data()
if(isnum(I.data))
result = sqrt(I.data)
for(var/datum/integrated_io/output/O in outputs)
O.data = result
O.push_data()
// % Modulo % //
/obj/item/integrated_circuit/arithmetic/modulo
name = "modulo circuit"
desc = "Gets the remainder of A / B."
icon_state = "modulo"
inputs = list("A", "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
for(var/datum/integrated_io/output/O in outputs)
O.data = result
O.push_data()
@@ -1,33 +1,59 @@
#define IC_COMPONENTS_BASE 20
#define IC_COMPLEXITY_BASE 80
/obj/item/device/electronic_assembly
name = "electronic assembly"
desc = "It's a case, for building electronics with."
w_class = 2
w_class = ITEMSIZE_SMALL
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "setup_small"
var/max_components = 10
var/max_complexity = 40
show_messages = TRUE
var/max_components = IC_COMPONENTS_BASE
var/max_complexity = IC_COMPLEXITY_BASE
var/opened = 0
/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
icon_state = "setup_medium"
w_class = 3
max_components = 20
max_complexity = 80
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 2
max_complexity = IC_COMPLEXITY_BASE * 2
/obj/item/device/electronic_assembly/large
name = "electronic machine"
icon_state = "setup_large"
w_class = 4
max_components = 30
max_complexity = 120
w_class = ITEMSIZE_LARGE
max_components = IC_COMPONENTS_BASE * 3
max_complexity = IC_COMPLEXITY_BASE * 3
/obj/item/device/electronic_assembly/drone
name = "electronic drone"
icon_state = "setup_drone"
w_class = 3
max_components = 25
max_complexity = 100
w_class = ITEMSIZE_NORMAL
max_components = IC_COMPONENTS_BASE * 1.5
max_complexity = IC_COMPLEXITY_BASE * 1.5
/obj/item/device/electronic_assembly/implant
name = "electronic implant"
icon_state = "setup_implant"
w_class = ITEMSIZE_TINY
max_components = IC_COMPONENTS_BASE / 2
max_complexity = IC_COMPLEXITY_BASE / 2
var/obj/item/weapon/implant/integrated_circuit/implant = null
/obj/item/device/electronic_assembly/implant/update_icon()
..()
implant.icon_state = icon_state
/obj/item/device/electronic_assembly/implant/nano_host()
return implant
/obj/item/device/electronic_assembly/proc/resolve_nano_host()
return src
/obj/item/device/electronic_assembly/implant/resolve_nano_host()
return implant
/obj/item/device/electronic_assembly/interact(mob/user)
if(!CanInteract(user, physical_state))
@@ -79,6 +105,12 @@
to_chat(M, "<span class='notice'>The machine now has a label reading '[input]'.</span>")
name = input
/obj/item/device/electronic_assembly/proc/can_move()
return FALSE
/obj/item/device/electronic_assembly/drone/can_move()
return TRUE
/obj/item/device/electronic_assembly/update_icon()
if(opened)
icon_state = initial(icon_state) + "-open"
@@ -5,6 +5,11 @@
outputs = list("output")
activators = list("convert")
category_text = "Converter"
autopulse = 1
/obj/item/integrated_circuit/converter/on_data_written()
if(autopulse == 1)
check_then_do_work()
/obj/item/integrated_circuit/converter/num2text
name = "number to string"
@@ -104,4 +109,67 @@
var/datum/integrated_io/outgoing = outputs[1]
outgoing.data = result
outgoing.push_data()
outgoing.push_data()
/obj/item/integrated_circuit/converter/radians2degrees
name = "radians to degrees converter"
desc = "Converts radians to degrees."
inputs = list("radian")
outputs = list("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)
outgoing.data = result
outgoing.push_data()
/obj/item/integrated_circuit/converter/degrees2radians
name = "degrees to radians converter"
desc = "Converts degrees to radians."
inputs = list("degrees")
outputs = list("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)
outgoing.data = result
outgoing.push_data()
/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")
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/datum/integrated_io/x2 = inputs[3]
var/datum/integrated_io/y2 = inputs[4]
var/datum/integrated_io/result_x = outputs[1]
var/datum/integrated_io/result_y = outputs[2]
if(x1.data && y1.data && x2.data && y2.data)
result_x.data = x1.data - x2.data
result_y.data = y1.data - y2.data
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
@@ -1,54 +0,0 @@
//This circuit gives information on where the machine is.
/obj/item/integrated_circuit/gps
name = "global positioning system"
desc = "This allows you to easily know the position of a machine containing this device."
icon_state = "gps"
complexity = 4
inputs = list()
outputs = list("X (abs)", "Y (abs)")
activators = list("get coordinates")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
category_text = "Coords"
/obj/item/integrated_circuit/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
if(!T)
return
result_x.data = T.x
result_y.data = T.y
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
/obj/item/integrated_circuit/abs_to_rel_coords
name = "abs to rel coordinate converter"
desc = "Easily convert absolute coordinates to relative coordinates with this."
complexity = 4
inputs = list("X1 (abs)", "Y1 (abs)", "X2 (abs)", "Y2 (abs)")
outputs = list("X (rel)", "Y (rel)")
activators = list("compute rel coordinates")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
category_text = "Coords"
/obj/item/integrated_circuit/abs_to_rel_coords/do_work()
var/datum/integrated_io/x1 = inputs[1]
var/datum/integrated_io/y1 = inputs[2]
var/datum/integrated_io/x2 = inputs[3]
var/datum/integrated_io/y2 = inputs[4]
var/datum/integrated_io/result_x = outputs[1]
var/datum/integrated_io/result_y = outputs[2]
if(x1.data && y1.data && x2.data && y2.data)
result_x.data = x1.data - x2.data
result_y.data = y1.data - y2.data
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
@@ -1,5 +1,10 @@
/obj/item/integrated_circuit/transfer
category_text = "Data Transfer"
autopulse = 1
/obj/item/integrated_circuit/transfer/on_data_written()
if(autopulse == 1)
check_then_do_work()
/obj/item/integrated_circuit/transfer/splitter
name = "splitter"
@@ -321,11 +321,74 @@
data_received.write_data_to_pin(message)
text_received.write_data_to_pin(text)
//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."
icon_state = "gps"
complexity = 4
inputs = list()
outputs = list("X (abs)", "Y (abs)")
activators = list("get coordinates")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/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
if(!T)
return
result_x.data = T.x
result_y.data = T.y
for(var/datum/integrated_io/output/O in outputs)
O.push_data()
/obj/item/integrated_circuit/input/microphone
name = "microphone"
desc = "Useful for spying on people or for voice activated machines."
icon_state = "recorder"
complexity = 8
inputs = list()
outputs = list("speaker \<String\>", "message \<String\>")
activators = list("on message received")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/input/microphone/New()
..()
listening_objects |= src
/obj/item/integrated_circuit/input/microphone/Destroy()
listening_objects -= src
..()
/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]
if(M && msg)
if(speaking)
if(!speaking.machine_understands)
msg = speaking.scramble(msg)
V.data = M.GetVoice()
O.data = msg
A.push_data()
/obj/item/integrated_circuit/output
category_text = "Output"
/obj/item/integrated_circuit/output/screen
name = "screen"
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")
@@ -343,6 +406,28 @@
else
stuff_to_display = I.data
/obj/item/integrated_circuit/output/screen/medium
name = "screen"
desc = "This screen allows for people holding the device to see a piece of data."
icon_state = "screen_medium"
/obj/item/integrated_circuit/output/screen/medium/do_work()
..()
var/list/nearby_things = range(0, get_turf(src))
for(var/mob/M in nearby_things)
var/obj/O = istype(loc, /obj/item/device/electronic_assembly) ? loc : src
visible_message("<span class='notice'>\icon[O] [stuff_to_display]</span>")
/obj/item/integrated_circuit/output/screen/large
name = "large screen"
desc = "This screen allows for people able to see the device to see a piece of data."
icon_state = "screen_large"
/obj/item/integrated_circuit/output/screen/large/do_work()
..()
var/obj/O = istype(loc, /obj/item/device/electronic_assembly) ? loc : src
O.visible_message("<span class='notice'>\icon[O] [stuff_to_display]</span>")
/obj/item/integrated_circuit/output/light
name = "light"
desc = "This light can turn on and off on command."
@@ -415,6 +500,24 @@
activators = list("play sound")
var/list/sounds = list()
/obj/item/integrated_circuit/output/text_to_speech
name = "text-to-speech circuit"
desc = "A miniature speaker is attached to this component."
extended_desc = "This unit is more advanced than the plain speaker circuit, able to transpose any valid text to speech."
icon_state = "speaker"
complexity = 12
cooldown_per_use = 4 SECONDS
inputs = list("text")
outputs = list()
activators = list("to speech")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/output/text_to_speech/do_work()
var/datum/integrated_io/text = inputs[1]
if(istext(text.data))
var/obj/O = istype(loc, /obj/item/device/electronic_assembly) ? loc : src
audible_message("\icon[O] \The [O.name] states, \"[text.data]\"")
/obj/item/integrated_circuit/output/sound/New()
..()
extended_desc = list()
@@ -6,6 +6,11 @@
outputs = list("result")
activators = list("compare", "on true result")
category_text = "Logic"
autopulse = 1
/obj/item/integrated_circuit/logic/on_data_written()
if(autopulse == 1)
check_then_do_work()
/obj/item/integrated_circuit/logic/do_work()
var/datum/integrated_io/O = outputs[1]
@@ -105,7 +105,7 @@
Southwest = 10<br>\
<br>\
Pulsing the 'step towards dir' activator pin will cause the machine to move a meter in that direction, assuming it is not \
being held, or anchored in some way. It should be noted that heavy machines will be unable to move."
being held, or anchored in some way. It should be noted that the ability to move is dependant on the type of assembly that this circuit inhabits."
complexity = 20
inputs = list("dir num")
outputs = list()
@@ -117,7 +117,7 @@
var/turf/T = get_turf(src)
if(T && istype(loc, /obj/item/device/electronic_assembly))
var/obj/item/device/electronic_assembly/machine = loc
if(machine.anchored || machine.w_class >= ITEMSIZE_LARGE)
if(machine.anchored || !machine.can_move())
return
if(machine.loc == T) // Check if we're held by someone. If the loc is the floor, we're not held.
var/datum/integrated_io/wanted_dir = inputs[1]
@@ -61,7 +61,7 @@
"output pin 6",
"output pin 7",
"output pin 8")
spawn_flags = IC_SPAWN_RESEARCH
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3)
/obj/item/integrated_circuit/memory/huge
+2 -2
View File
@@ -44,7 +44,7 @@
This circuit is set to send a pulse after a delay of half a second."
icon_state = "delay-5"
delay = 5
spawn_flags = IC_SPAWN_RESEARCH
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/time/delay/tenth_sec
name = "tenth-sec delay circuit"
@@ -52,7 +52,7 @@
This circuit is set to send a pulse after a delay of 1/10th of a second."
icon_state = "delay-1"
delay = 1
spawn_flags = IC_SPAWN_RESEARCH
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/time/delay/custom
name = "custom delay circuit"
+171 -6
View File
@@ -164,15 +164,33 @@
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "circuit_kit"
w_class = 3
display_contents_with_number = 1
display_contents_with_number = 0
can_hold = list(
/obj/item/integrated_circuit,
/obj/item/weapon/storage/bag/circuits/mini,
/obj/item/device/electronic_assembly,
/obj/item/device/integrated_electronics,
/obj/item/weapon/crowbar,
/obj/item/weapon/screwdriver
)
/obj/item/weapon/storage/bag/circuits/basic/New()
..()
spawn(2 SECONDS) // So the list has time to initialize.
for(var/obj/item/integrated_circuit/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
// for(var/obj/item/integrated_circuit/IC in all_integrated_circuits)
// if(IC.spawn_flags & IC_SPAWN_DEFAULT)
// for(var/i = 1 to 3)
// new IC.type(src)
new /obj/item/weapon/storage/bag/circuits/mini/arithmetic(src)
new /obj/item/weapon/storage/bag/circuits/mini/trig(src)
new /obj/item/weapon/storage/bag/circuits/mini/input(src)
new /obj/item/weapon/storage/bag/circuits/mini/output(src)
new /obj/item/weapon/storage/bag/circuits/mini/memory(src)
new /obj/item/weapon/storage/bag/circuits/mini/logic(src)
new /obj/item/weapon/storage/bag/circuits/mini/time(src)
new /obj/item/weapon/storage/bag/circuits/mini/reagents(src)
new /obj/item/weapon/storage/bag/circuits/mini/transfer(src)
new /obj/item/weapon/storage/bag/circuits/mini/converter(src)
new /obj/item/device/electronic_assembly(src)
new /obj/item/device/integrated_electronics/wirer(src)
@@ -193,4 +211,151 @@
new /obj/item/device/integrated_electronics/debugger(src)
new /obj/item/weapon/crowbar(src)
new /obj/item/weapon/screwdriver(src)
make_exact_fit()
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/
name = "circuit box"
desc = "Used to partition categories of circuits, for a neater workspace."
w_class = 2
display_contents_with_number = 1
can_hold = list(/obj/item/integrated_circuit)
/obj/item/weapon/storage/bag/circuits/mini/arithmetic
name = "arithmetic circuit box"
desc = "Warning: Contains math."
icon_state = "box_arithmetic"
/obj/item/weapon/storage/bag/circuits/mini/arithmetic/New()
..()
for(var/obj/item/integrated_circuit/arithmetic/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/trig
name = "trig circuit box"
desc = "Danger: Contains more math."
icon_state = "box_trig"
/obj/item/weapon/storage/bag/circuits/mini/trig/New()
..()
for(var/obj/item/integrated_circuit/trig/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/input
name = "input circuit box"
desc = "Tell these circuits everything you know."
icon_state = "box_input"
/obj/item/weapon/storage/bag/circuits/mini/input/New()
..()
for(var/obj/item/integrated_circuit/input/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/output
name = "output circuit box"
desc = "Circuits to interface with the world beyond itself."
icon_state = "box_output"
/obj/item/weapon/storage/bag/circuits/mini/output/New()
..()
for(var/obj/item/integrated_circuit/output/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/memory
name = "memory circuit box"
desc = "Machines can be quite forgetful without these."
icon_state = "box_memory"
/obj/item/weapon/storage/bag/circuits/mini/memory/New()
..()
for(var/obj/item/integrated_circuit/memory/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/logic
name = "logic circuit box"
desc = "May or may not be Turing complete."
icon_state = "box_logic"
/obj/item/weapon/storage/bag/circuits/mini/logic/New()
..()
for(var/obj/item/integrated_circuit/logic/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/time
name = "time circuit box"
desc = "No time machine parts, sadly."
icon_state = "box_time"
/obj/item/weapon/storage/bag/circuits/mini/time/New()
..()
for(var/obj/item/integrated_circuit/time/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/reagents
name = "reagent circuit box"
desc = "Unlike most electronics, these circuits are supposed to come in contact with liquids."
icon_state = "box_reagents"
/obj/item/weapon/storage/bag/circuits/mini/reagents/New()
..()
for(var/obj/item/integrated_circuit/reagent/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/transfer
name = "transfer circuit box"
desc = "Useful for moving data representing something arbitrary to another arbitrary virtual place."
icon_state = "box_transfer"
/obj/item/weapon/storage/bag/circuits/mini/transfer/New()
..()
for(var/obj/item/integrated_circuit/transfer/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/converter
name = "converter circuit box"
desc = "Transform one piece of data to another type of data with these."
icon_state = "box_converter"
/obj/item/weapon/storage/bag/circuits/mini/converter/New()
..()
for(var/obj/item/integrated_circuit/converter/IC in all_integrated_circuits)
if(IC.spawn_flags & IC_SPAWN_DEFAULT)
for(var/i = 1 to 3)
new IC.type(src)
make_exact_fit()
+135
View File
@@ -0,0 +1,135 @@
//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")
category_text = "Trig"
extended_desc = "Input and output are in degrees."
autopulse = 1
/obj/item/integrated_circuit/trig/on_data_written()
if(autopulse == 1)
check_then_do_work()
// Sine //
/obj/item/integrated_circuit/trig/sine
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")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/sine/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = sin(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()
// Cosine //
/obj/item/integrated_circuit/trig/cosine
name = "cos circuit"
desc = "Outputs the cosine of A."
icon_state = "cosine"
inputs = list("A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cosine/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = cos(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()
// Tangent //
/obj/item/integrated_circuit/trig/tangent
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")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/tangent/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = Tan(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()
// Cosecant //
/obj/item/integrated_circuit/trig/cosecant
name = "csc circuit"
desc = "Outputs the cosecant of A."
icon_state = "cosecant"
inputs = list("A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cosecant/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = Csc(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()
// Secant //
/obj/item/integrated_circuit/trig/secant
name = "sec circuit"
desc = "Outputs the secant of A. Has nothing to do with the security department."
icon_state = "secant"
inputs = list("A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/secant/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = Sec(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()
// Cotangent //
/obj/item/integrated_circuit/trig/cotangent
name = "cot circuit"
desc = "Outputs the cotangent of A. Has nothing to do with the security department."
icon_state = "cotangent"
inputs = list("A")
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/trig/cotangent/do_work()
var/result = null
var/datum/integrated_io/input/A = inputs[1]
A.pull_data()
if(isnum(A.data))
result = Cot(A.data)
var/datum/integrated_io/output/O = outputs[1]
O.data = result
O.push_data()