Even More Sodding Circuits

Adds new RNG circuit, to make random numbers each time.
Adds new Concatenating circuit, so you can make lots of small strings into one big one.
Adds new light and advanced light circuit.  Basic just has a normal light that can be toggled.  Advanced allows it to be any color using RGB, and a brightness between 0 and 6.
New sprites for the debugger and wirer, by Mechoid.
Hopefully finally fixes smoke generator from being unobtainable.
This commit is contained in:
Neerti
2016-09-17 12:36:46 -04:00
parent 268303257d
commit faa797b23a
7 changed files with 160 additions and 9 deletions
@@ -98,7 +98,7 @@
if(!M.canmove || M.stat || M.restrained())
return
var/input = sanitizeSafe(input("What do you want to name the circuit?", ,""), MAX_NAME_LEN)
var/input = sanitizeSafe(input("What do you want to name the circuit?", "Rename", src.name), MAX_NAME_LEN)
if(src && input)
M << "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>"
@@ -372,7 +372,7 @@
for(var/datum/integrated_io/input/I in inputs)
I.push_data()
/obj/item/integrated_circuit/proc/work()
/obj/item/integrated_circuit/proc/work(var/datum/integrated_io/io)
if(last_used + cooldown_per_use > world.time) // All intergrated circuits have an internal cooldown, to protect from spam.
return 0
last_used = world.time
@@ -154,4 +154,30 @@
if(..())
var/datum/integrated_io/output/O = outputs[1]
O.data = 3.14159
O.push_data()
O.push_data()
// Random //
/obj/item/integrated_circuit/arithmetic/random
name = "random number generator circuit"
desc = "This gives a random (integer) number between values A and B inclusive."
icon_state = "random"
number_of_inputs = 2
number_of_outputs = 1
number_of_activators = 1
input_names = list(
"L",
"H"
)
/obj/item/integrated_circuit/arithmetic/random/work()
if(..())
var/result = 0
var/datum/integrated_io/L = inputs[1]
var/datum/integrated_io/H = inputs[2]
if(isnum(L.data) && isnum(H.data))
result = rand(L.data, H.data)
for(var/datum/integrated_io/output/O in outputs)
O.data = result
O.push_data()
@@ -92,5 +92,42 @@
if(incoming.data && istext(incoming.data))
result = uppertext(incoming.data)
outgoing.data = result
outgoing.push_data()
/obj/item/integrated_circuit/converter/concatenatior
name = "concatenatior"
desc = "This joins many strings together to get one big string."
complexity = 4
number_of_inputs = 8
number_of_outputs = 1
number_of_activators = 1
input_names = list(
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H"
)
output_names = list(
"result"
)
activator_names = list(
"concatenate"
)
/obj/item/integrated_circuit/converter/concatenatior/work()
if(..())
var/result = null
for(var/datum/integrated_io/input/I in inputs)
I.pull_data()
if(istext(I.data))
result = result + I.data
var/datum/integrated_io/outgoing = outputs[1]
outgoing.data = result
outgoing.push_data()
@@ -307,4 +307,65 @@
/obj/item/integrated_circuit/output/screen/work()
var/datum/integrated_io/I = inputs[1]
stuff_to_display = I.data
stuff_to_display = I.data
/obj/item/integrated_circuit/output/light
name = "light"
desc = "This light can turn on and off on command."
icon_state = "light_adv"
// icon_state = "light"
complexity = 4
number_of_inputs = 0
number_of_outputs = 0
number_of_activators = 1
activator_names = list(
"toggle light"
)
var/light_toggled = 0
var/light_brightness = 3
var/light_rgb = "#FFFFFF"
/obj/item/integrated_circuit/output/light/work()
if(..())
light_toggled = !light_toggled
update_lighting()
/obj/item/integrated_circuit/output/light/proc/update_lighting()
if(light_toggled)
set_light(l_range = light_brightness, l_power = light_brightness, l_color = light_rgb)
else
set_light(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]
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
..()
/obj/item/integrated_circuit/output/light/advanced
name = "advanced light"
desc = "This light can turn on and off on command, in any color, and in various brightness levels."
icon_state = "light_adv"
complexity = 8
number_of_inputs = 4
number_of_outputs = 0
number_of_activators = 1
input_names = list(
"R",
"G",
"B",
"Brightness"
)
/obj/item/integrated_circuit/output/light/advanced/on_data_written()
update_lighting()
+12 -4
View File
@@ -9,8 +9,8 @@
desc = "It's a small wiring tool, with a wire roll, electric soldering iron, wire cutter, and more in one package. \
The wires used are generally useful for small electronics, such as circuitboards and breadboards, as opposed to larger wires \
used for power or data transmission."
icon = 'icons/obj/hacktool.dmi'
icon_state = "hacktool-g"
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "wirer-wire"
flags = CONDUCT
w_class = 2
var/datum/integrated_io/selected_io = null
@@ -19,11 +19,15 @@
/obj/item/device/integrated_electronics/wirer/New()
..()
/obj/item/device/integrated_electronics/wirer/update_icon()
icon_state = "wirer-[mode]"
/obj/item/device/integrated_electronics/wirer/proc/wire(var/datum/integrated_io/io, mob/user)
if(mode == WIRE)
selected_io = io
user << "<span class='notice'>You attach a data wire to \the [selected_io.holder]'s [selected_io.name] data channel.</span>"
mode = WIRING
update_icon()
else if(mode == WIRING)
if(io == selected_io)
user << "<span class='warning'>Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless.</span>"
@@ -37,6 +41,7 @@
user << "<span class='notice'>You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name].</span>"
mode = WIRE
update_icon()
//io.updateDialog()
//selected_io.updateDialog()
selected_io.holder.interact(user) // This is to update the UI.
@@ -50,6 +55,7 @@
return
user << "<span class='notice'>You prepare to detach a data wire from \the [selected_io.holder]'s [selected_io.name] data channel.</span>"
mode = UNWIRING
update_icon()
return
else if(mode == UNWIRING)
@@ -67,6 +73,7 @@
selected_io.holder.interact(user) // This is to update the UI.
selected_io = null
mode = UNWIRE
update_icon()
else
user << "<span class='warning'>\The [selected_io.holder]'s [selected_io.name] and \the [io.holder]'s \
[io.name] are not connected.</span>"
@@ -89,6 +96,7 @@
user << "<span class='notice'>You decide not to disconnect the data channel.</span>"
selected_io = null
mode = UNWIRE
update_icon()
user << "<span class='notice'>You set \the [src] to [mode].</span>"
#undef WIRE
@@ -100,8 +108,8 @@
name = "circuit debugger"
desc = "This small tool allows one working with custom machinery to directly set data to a specific pin, useful for writing \
settings to specific circuits, or for debugging purposes. It can also pulse activation pins."
icon = 'icons/obj/hacktool.dmi'
icon_state = "hacktool"
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "debugger"
flags = CONDUCT
w_class = 2
var/data_to_write = null