See changelog.

This commit is contained in:
LorenLuke
2017-07-16 02:47:09 -07:00
parent e751cae6e0
commit 14ad0d70e3
37 changed files with 1604 additions and 1049 deletions

View File

@@ -31,9 +31,10 @@ var/list/all_integrated_circuits = list()
var/extended_desc = null
var/list/inputs = list()
var/list/outputs = list()
var/list/activators = list()
var/list/activators = list() //associated_list, = 1 for inbound, = 0 for outbound
var/next_use = 0 //Uses world.time
var/complexity = 1 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
var/size = null //This acts as a limitation on building machines, bigger components cost more 'space'. -1 for size 0
var/cooldown_per_use = 1 SECOND // Circuits are limited in how many times they can be work()'d by this variable.
var/power_draw_per_use = 0 // How much power is drawn when work()'d.
var/power_draw_idle = 0 // How much power is drawn when doing nothing.
@@ -41,5 +42,6 @@ var/list/all_integrated_circuits = list()
var/category_text = "NO CATEGORY THIS IS A BUG" // 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.
var/removable = TRUE // Determines if a circuit is removable from the assembly.
var/displayed_name = ""
var/allow_multitool = 1 // Allows additional multitool functionality
// Used as a global var, (Do not set manually in children).

View File

@@ -1,5 +1,5 @@
#define IC_COMPONENTS_BASE 20
#define IC_COMPLEXITY_BASE 80
#define IC_COMPLEXITY_BASE 60
/obj/item/device/electronic_assembly
name = "electronic assembly"
@@ -13,6 +13,7 @@
var/opened = 0
var/obj/item/weapon/cell/device/battery = null // Internal cell which most circuits need to work.
/obj/item/device/electronic_assembly/medium
name = "electronic mechanism"
icon_state = "setup_medium"
@@ -38,8 +39,8 @@
name = "electronic implant"
icon_state = "setup_implant"
w_class = ITEMSIZE_TINY
max_components = IC_COMPONENTS_BASE / 2
max_complexity = IC_COMPLEXITY_BASE / 2
max_components = IC_COMPONENTS_BASE / 4
max_complexity = IC_COMPLEXITY_BASE / 4
var/obj/item/weapon/implant/integrated_circuit/implant = null
/obj/item/device/electronic_assembly/New()
@@ -82,14 +83,19 @@
/obj/item/device/electronic_assembly/implant/resolve_nano_host()
return implant
/obj/item/device/electronic_assembly/interact(mob/user)
/obj/item/device/electronic_assembly/proc/check_interactivity(mob/user)
if(!CanInteract(user, physical_state))
return 0
return 1
/obj/item/device/electronic_assembly/interact(mob/user)
if(!check_interactivity(user))
return
var/total_parts = 0
var/total_complexity = 0
for(var/obj/item/integrated_circuit/part in contents)
total_parts++
total_parts += part.size
total_complexity = total_complexity + part.complexity
var/HTML = list()
@@ -103,14 +109,30 @@
else
HTML += "<span class='danger'>No powercell detected!</span>"
HTML += "<br><br>"
HTML += "Components;<br>"
HTML += "Components:<hr>"
HTML += "Built in:<br>"
//Put removable circuits in separate categories from non-removable
for(var/obj/item/integrated_circuit/circuit in contents)
if(!circuit.removable)
HTML += "<a href=?src=\ref[circuit];examine=1;from_assembly=1>[circuit.displayed_name]</a> | "
HTML += "<a href=?src=\ref[circuit];rename=1;from_assembly=1>\[Rename\]</a> | "
HTML += "<a href=?src=\ref[circuit];scan=1;from_assembly=1>\[Scan with Debugger\]</a> | "
HTML += "<a href=?src=\ref[circuit];bottom=\ref[circuit];from_assembly=1>\[Move to Bottom\]</a>"
HTML += "<br>"
HTML += "<hr>"
HTML += "Removable:<br>"
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>"
HTML += "<a href=?src=\ref[circuit];examine=1;from_assembly=1>[circuit.displayed_name]</a> | "
HTML += "<a href=?src=\ref[circuit];rename=1;from_assembly=1>\[Rename\]</a> | "
HTML += "<a href=?src=\ref[circuit];scan=1;from_assembly=1>\[Scan with Debugger\]</a> | "
HTML += "<a href=?src=\ref[circuit];remove=1;from_assembly=1>\[Remove\]</a> | "
HTML += "<a href=?src=\ref[circuit];bottom=\ref[circuit];from_assembly=1>\[Move to Bottom\]</a>"
HTML += "<br>"
HTML += "</body></html>"
user << browse(jointext(HTML,null), "window=assembly-\ref[src];size=600x350;border=1;can_resize=1;can_close=1;can_minimize=1")
@@ -140,11 +162,11 @@
set desc = "Rename your circuit, useful to stay organized."
var/mob/M = usr
if(!CanInteract(M, physical_state))
if(!check_interactivity(M))
return
var/input = sanitizeSafe(input("What do you want to name this?", "Rename", src.name) as null|text, MAX_NAME_LEN)
if(src && input && CanInteract(M, physical_state))
if(src && input)
to_chat(M, "<span class='notice'>The machine now has a label reading '[input]'.</span>")
name = input
@@ -191,7 +213,7 @@
/obj/item/device/electronic_assembly/proc/get_part_size()
. = 0
for(var/obj/item/integrated_circuit/part in contents)
. += part.w_class
. += part.size
// Returns true if the circuit made it inside.
/obj/item/device/electronic_assembly/proc/add_circuit(var/obj/item/integrated_circuit/IC, var/mob/user)
@@ -206,7 +228,7 @@
var/total_part_size = get_part_size()
var/total_complexity = get_part_complexity()
if((total_part_size + IC.w_class) > max_components)
if((total_part_size + IC.size) > max_components)
to_chat(user, "<span class='warning'>You can't seem to add the '[IC.name]', as there's insufficient space.</span>")
return FALSE
if((total_complexity + IC.complexity) > max_complexity)
@@ -234,16 +256,18 @@
/obj/item/device/electronic_assembly/attackby(var/obj/item/I, var/mob/user)
if(istype(I, /obj/item/integrated_circuit))
if(!user.unEquip(I))
return 0
return FALSE
if(add_circuit(I, user))
to_chat(user, "<span class='notice'>You slide \the [I] inside \the [src].</span>")
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
interact(user)
return TRUE
else if(istype(I, /obj/item/weapon/crowbar))
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
opened = !opened
to_chat(user, "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>")
update_icon()
return TRUE
else if(istype(I, /obj/item/device/integrated_electronics/wirer) || istype(I, /obj/item/device/integrated_electronics/debugger) || istype(I, /obj/item/weapon/screwdriver))
if(opened)
interact(user)
@@ -264,20 +288,38 @@
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
to_chat(user, "<span class='notice'>You slot \the [cell] inside \the [src]'s power supplier.</span>")
interact(user)
return TRUE
else
return ..()
/obj/item/device/electronic_assembly/attack_self(mob/user)
if(!check_interactivity(user))
return
if(opened)
interact(user)
var/list/input_selection = list()
var/list/available_inputs = list()
for(var/obj/item/integrated_circuit/input/input in contents)
if(input.can_be_asked_input)
available_inputs.Add(input)
var/obj/item/integrated_circuit/input/choice = input(user, "What do you want to interact with?", "Interaction") as null|anything in available_inputs
if(choice && CanInteract(user, physical_state))
var/i = 0
for(var/obj/item/integrated_circuit/s in available_inputs)
if(s.name == input.name && s.displayed_name == input.displayed_name && s != input)
i++
var/disp_name= "[input.displayed_name] \[[input.name]\]"
if(i)
disp_name += " ([i+1])"
input_selection.Add(disp_name)
var/obj/item/integrated_circuit/input/choice
if(available_inputs)
var/selection = input(user, "What do you want to interact with?", "Interaction") as null|anything in input_selection
if(selection)
var/index = input_selection.Find(selection)
choice = available_inputs[index]
if(choice)
choice.ask_for_input(user)
/obj/item/device/electronic_assembly/emp_act(severity)
@@ -295,4 +337,5 @@
/obj/item/device/electronic_assembly/proc/give_power(amount)
if(battery && battery.give(amount * CELLRATE))
return TRUE
return FALSE
return FALSE

View File

@@ -0,0 +1,84 @@
/obj/item/device/assembly/electronic_assembly
name = "electronic device"
desc = "It's a case for building electronics with. It can be attached to other small devices."
icon_state = "setup_device"
var/opened = 0
var/obj/item/device/electronic_assembly/device/EA
/obj/item/device/assembly/electronic_assembly/New()
EA = new(src)
EA.holder = src
..()
/obj/item/device/assembly/electronic_assembly/attackby(obj/item/I as obj, mob/user as mob)
if (iscrowbar(I) )
toggle_open(user)
else if (opened)
EA.attackby(I, user)
else
..()
/obj/item/device/assembly/electronic_assembly/proc/toggle_open(mob/user)
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
opened = !opened
EA.opened = opened
to_chat(user, "<span class='notice'>You [opened ? "opened" : "closed"] \the [src].</span>")
secured = 1
update_icon()
/obj/item/device/assembly/electronic_assembly/update_icon()
if(EA)
icon_state = initial(icon_state)
else
icon_state = initial(icon_state)+"0"
if(opened)
icon_state = icon_state + "-open"
/obj/item/device/assembly/electronic_assembly/attack_self(mob/user as mob)
if(EA)
EA.attack_self(user)
/obj/item/device/assembly/electronic_assembly/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
if(EA)
for(var/obj/item/integrated_circuit/built_in/device_input/I in EA.contents)
I.do_work()
return
/obj/item/device/assembly/electronic_assembly/examine(mob/user)
.=..(user, 1)
if(EA)
for(var/obj/item/integrated_circuit/IC in EA.contents)
IC.external_examine(user)
/obj/item/device/assembly/electronic_assembly/verb/toggle()
set src in usr
set category = "Object"
set name = "Open/Close Device Assembly"
set desc = "Open or close device assembly!"
toggle_open(usr)
/obj/item/device/electronic_assembly/device
name = "electronic device"
icon_state = "setup_device"
desc = "It's a tiny electronic device with specific use for attaching to other devices."
var/obj/item/device/assembly/electronic_assembly/holder
w_class = ITEMSIZE_TINY
max_components = IC_COMPONENTS_BASE * 3/4
max_complexity = IC_COMPLEXITY_BASE * 3/4
/obj/item/device/electronic_assembly/device/New()
..()
var/obj/item/integrated_circuit/built_in/device_input/input = new(src)
var/obj/item/integrated_circuit/built_in/device_output/output = new(src)
input.assembly = src
output.assembly = src
/obj/item/device/electronic_assembly/device/check_interactivity(mob/user)
if(!CanInteract(user, state = deep_inventory_state))
return 0
return 1

View File

@@ -42,3 +42,17 @@
return null
return activators[pin_number]
return null
/obj/item/integrated_circuit/proc/handle_wire(var/datum/integrated_io/pin, var/obj/item/device/integrated_electronics/tool)
if(istype(tool, /obj/item/device/integrated_electronics/wirer))
var/obj/item/device/integrated_electronics/wirer/wirer = tool
if(pin)
wirer.wire(pin, usr)
return 1
else if(istype(tool, /obj/item/device/integrated_electronics/debugger))
var/obj/item/device/integrated_electronics/debugger/debugger = tool
if(pin)
debugger.write_data(pin, usr)
return 1
return 0

View File

@@ -4,9 +4,9 @@ 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)
external_examine(user)
. = ..()
// This should be used when someone is examining while the case is opened.
/obj/item/integrated_circuit/proc/internal_examine(mob/user)
@@ -31,6 +31,9 @@ a creative player the means to solve many problems. Circuits are held inside an
return
/obj/item/integrated_circuit/New()
displayed_name = name
if(!size) size = w_class
if(size == -1) size = 0
setup_io(inputs, /datum/integrated_io/input)
setup_io(outputs, /datum/integrated_io/output)
setup_io(activators, /datum/integrated_io/activate)
@@ -58,22 +61,31 @@ a creative player the means to solve many problems. Circuits are held inside an
for(var/datum/integrated_io/io in inputs + outputs + activators)
io.scramble()
/obj/item/integrated_circuit/proc/check_interactivity(mob/user)
if(assembly)
return assembly.check_interactivity(user)
else if(!CanInteract(user, physical_state))
return 0
return 1
/obj/item/integrated_circuit/verb/rename_component()
set name = "Rename Circuit"
set category = "Object"
set desc = "Rename your circuit, useful to stay organized."
var/mob/M = usr
if(!CanInteract(M, physical_state))
if(!check_interactivity(M))
return
var/input = sanitizeSafe(input("What do you want to name the circuit?", "Rename", src.name) as null|text, MAX_NAME_LEN)
if(src && input && CanInteract(M, physical_state))
if(src && input && assembly.check_interactivity(M))
to_chat(M, "<span class='notice'>The circuit '[src.name]' is now labeled '[input]'.</span>")
name = input
displayed_name = input
/obj/item/integrated_circuit/interact(mob/user)
if(!CanInteract(user, physical_state))
if(!check_interactivity(user))
return
if(!assembly)
return
var/window_height = 350
@@ -85,14 +97,17 @@ a creative player the means to solve many problems. Circuits are held inside an
var/table_middle_width = "40%"
var/HTML = list()
HTML += "<html><head><title>[src.name]</title></head><body>"
HTML += "<html><head><title>[src.displayed_name]</title></head><body>"
HTML += "<div align='center'>"
HTML += "<table border='1' style='undefined;table-layout: fixed; width: 80%'>"
HTML += "<br><a href='?src=\ref[src];return=1'>\[Return to Assembly\]</a>"
HTML += "<br><a href='?src=\ref[src];'>\[Refresh\]</a> | "
HTML += "<a href='?src=\ref[src];rename=1'>\[Rename\]</a> | "
HTML += "<a href='?src=\ref[src];scan=1'>\[Scan with Debugger\]</a> | "
HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>"
HTML += "<a href='?src=\ref[src];scan=1'>\[Scan with Device\]</a> | "
if(src.removable)
HTML += "<a href='?src=\ref[src];remove=1'>\[Remove\]</a><br>"
HTML += "<colgroup>"
HTML += "<col style='width: [table_edge_width]'>"
@@ -113,37 +128,31 @@ a creative player the means to solve many problems. Circuits are held inside an
if(1)
io = get_pin_ref(IC_INPUT, i)
if(io)
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
if(io.linked.len)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><b>[io.name] [io.display_data()]</b></a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
else
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>[io.name] [io.display_data()]</a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]>[linked.name]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder.displayed_name]</a><br>"
if(outputs.len > inputs.len)
height = 1
if(2)
if(i == 1)
words += "[src.name]<br><br>[src.desc]"
words += "[src.displayed_name]<br>([src.name])<hr>[src.desc]"
height = row_height
else
continue
if(3)
io = get_pin_ref(IC_OUTPUT, i)
if(io)
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]>[io.name]</a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]>[io.display_data()]</a></b><br>"
if(io.linked.len)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><b>[io.name] [io.display_data()]</b></a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;user=\ref[user]>[linked.holder]</a><br>"
else
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>[io.name] [io.display_data()]</a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]>[linked.name]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder.displayed_name]</a><br>"
if(inputs.len > outputs.len)
height = 1
HTML += "<td align='center' rowspan='[height]'>[jointext(words, null)]</td>"
@@ -152,16 +161,14 @@ a creative player the means to solve many problems. Circuits are held inside an
for(var/activator in activators)
var/datum/integrated_io/io = activator
var/words = list()
words += "<b><a href=?src=\ref[src];pin_name=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a> <a href=?src=\ref[src];pin_data=1;pin=\ref[io]><font color='FF0000'>[io.data?"\<PULSE IN\>":"\<PULSE OUT\>"]</font></a></b><br>"
if(io.linked.len)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><font color='FF0000'><b>[io.name]</b></font></a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src[src];examine=1;user=\ref[user]>[linked.holder]</a><br>"
else
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]><font color='FF0000'>[io.name]</font></a><br>"
for(var/datum/integrated_io/linked in io.linked)
words += "<a href=?src=\ref[src];wire=1;pin=\ref[io]>\[[linked.name]\]</a> \
@ <a href=?src=\ref[linked.holder];examine=1;>[linked.holder]</a><br>"
// words += "<a href=?src=\ref[linked.holder];pin_name=1;pin=\ref[linked];link=\ref[io]>\[[linked.name]\]</a>
words += "<a href=?src=\ref[src];pin_unwire=1;pin=\ref[io];link=\ref[linked]><font color='FF0000'>[linked.name]</font></a> \
@ <a href=?src=\ref[linked.holder];examine=1;><font color='FF0000'>[linked.holder.displayed_name]</font></a><br>"
HTML += "<tr>"
HTML += "<td colspan='3' align='center'>[jointext(words, null)]</td>"
HTML += "</tr>"
@@ -182,20 +189,92 @@ a creative player the means to solve many problems. Circuits are held inside an
HTML += "<br><font color='0000AA'>[extended_desc]</font>"
HTML += "</body></html>"
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")
if(src.assembly)
user << browse(jointext(HTML, null), "window=assembly-\ref[src.assembly];size=[window_width]x[window_height];border=1;can_resize=1;can_close=1;can_minimize=1")
else
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]")
onclose(user, "assembly-\ref[src.assembly]")
/obj/item/integrated_circuit/Topic(href, href_list, state = physical_state)
/obj/item/integrated_circuit/Topic(href, href_list, state = interactive_state)
if(!check_interactivity(usr))
return
if(..())
return 1
var/pin = locate(href_list["pin"]) in inputs + outputs + activators
var/update = 1
var/obj/item/device/electronic_assembly/A = src.assembly
var/update_to_assembly = 0
var/datum/integrated_io/pin = locate(href_list["pin"]) in inputs + outputs + activators
var/datum/integrated_io/linked = null
if(href_list["link"])
linked = locate(href_list["link"]) in pin.linked
var/obj/held_item = usr.get_active_hand()
if(href_list["rename"])
rename_component(usr)
if(href_list["from_assembly"])
update = 0
var/obj/item/device/electronic_assembly/ea = loc
if(istype(ea))
ea.interact(usr)
if(href_list["pin_name"])
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
href_list["wire"] = 1
else
var/obj/item/device/multitool/M = held_item
M.wire(pin,usr)
if(href_list["pin_data"])
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
href_list["wire"] = 1
else
var/datum/integrated_io/io = pin
if(io.io_type == DATA_CHANNEL)
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number", "null")
if(!check_interactivity(usr))
return
var/new_data = null
switch(type_to_use)
if("string")
new_data = input("Now type in a string.","[src] string writing") as null|text
to_chat(usr, "<span class='notice'>You input [new_data] into the pin.</span>")
//to_chat(user, "<span class='notice'>You write '[new_data]' to the '[io]' pin of \the [io.holder].</span>")
if("number")
new_data = input("Now type in a number.","[src] number writing") as null|num
if(isnum(new_data) && check_interactivity(usr) )
to_chat(usr, "<span class='notice'>You input [new_data] into the pin.</span>")
if("null")
if(check_interactivity(usr))
to_chat(usr, "<span class='notice'>You clear the pin's memory.</span>")
io.write_data_to_pin(new_data)
else if(io.io_type == PULSE_CHANNEL)
io.holder.check_then_do_work(ignore_power = TRUE)
to_chat(usr, "<span class='notice'>You pulse \the [io.holder]'s [io] pin.</span>")
if(href_list["pin_unwire"])
if (!istype(held_item, /obj/item/device/multitool) || !allow_multitool)
href_list["wire"] = 1
else
var/obj/item/device/multitool/M = held_item
M.unwire(pin, linked, usr)
if(href_list["wire"])
if(istype(held_item, /obj/item/device/integrated_electronics/wirer))
var/obj/item/device/integrated_electronics/wirer/wirer = held_item
if(pin)
if(linked)
wirer.wire(linked, usr)
else if(pin)
wirer.wire(pin, usr)
else if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
@@ -206,10 +285,23 @@ a creative player the means to solve many problems. Circuits are held inside an
to_chat(usr, "<span class='warning'>You can't do a whole lot without the proper tools.</span>")
if(href_list["examine"])
examine(usr)
var/obj/item/integrated_circuit/examined
if(href_list["examined"])
examined = href_list["examined"]
else
examined = src
examined.interact(usr)
update = 0
if(href_list["rename"])
rename_component(usr)
if(href_list["bottom"])
var/obj/item/integrated_circuit/circuit = locate(href_list["bottom"]) in src.assembly.contents
var/assy = circuit.assembly
if(!circuit)
return
circuit.loc = null
circuit.loc = assy
. = 1
update_to_assembly = 1
if(href_list["scan"])
if(istype(held_item, /obj/item/device/integrated_electronics/debugger))
@@ -219,31 +311,47 @@ a creative player the means to solve many problems. Circuits are held inside an
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>")
to_chat(usr, "<span class='warning'>You need a multitool/debugger set to 'ref' mode to do that.</span>")
if(href_list["autopulse"])
if(autopulse != -1)
autopulse = !autopulse
if(href_list["remove"])
if(istype(held_item, /obj/item/weapon/screwdriver))
if(!removable)
to_chat(usr, "<span class='warning'>\The [src] seems to be permanently attached to the case.</span>")
return
disconnect_all()
var/turf/T = get_turf(src)
forceMove(T)
assembly = null
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
to_chat(usr, "<span class='notice'>You pop \the [src] out of the case, and slide it out.</span>")
if(href_list["return"])
if(A)
update_to_assembly = 1
usr << browse(null, "window=circuit-\ref[src];border=1;can_resize=1;can_close=1;can_minimize=1")
else
to_chat(usr, "<span class='warning'>You need a screwdriver to remove components.</span>")
to_chat(usr, "<span class='warning'>This circuit is not in an assembly!</span>")
if(href_list["remove"])
if(!A)
to_chat(usr, "<span class='warning'>This circuit is not in an assembly!</span>")
return
if(!removable)
to_chat(usr, "<span class='warning'>\The [src] seems to be permanently attached to the case.</span>")
return
var/obj/item/device/electronic_assembly/ea = loc
disconnect_all()
var/turf/T = get_turf(src)
forceMove(T)
assembly = null
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
to_chat(usr, "<span class='notice'>You pop \the [src] out of the case, and slide it out.</span>")
if(istype(ea))
ea.interact(usr)
update = 0
return
interact(usr) // To refresh the UI.
if(update)
if(A && istype(A) && update_to_assembly)
A.interact(usr)
else
interact(usr) // To refresh the UI.
/obj/item/integrated_circuit/proc/push_data()
for(var/datum/integrated_io/output/O in outputs)

View File

@@ -165,6 +165,89 @@
io.holder.interact(user) // This is to update the UI.
/obj/item/device/multitool
var/datum/integrated_io/selected_io = null
var/mode = 0
/obj/item/device/multitool/attack_self(mob/user)
if(selected_io)
selected_io = null
to_chat(user, "<span class='notice'>You clear the wired connection from the multitool.</span>")
else
..()
update_icon()
/obj/item/device/multitool/update_icon()
if(selected_io)
if(buffer || connecting || connectable)
icon_state = "multitool_tracking"
else
icon_state = "multitool_red"
else
if(buffer || connecting || connectable)
icon_state = "multitool_tracking_fail"
else
icon_state = "multitool"
/obj/item/device/multitool/proc/wire(var/datum/integrated_io/io, mob/user)
if(!io.holder.assembly)
to_chat(user, "<span class='warning'>\The [io.holder] needs to be secured inside an assembly first.</span>")
return
if(selected_io)
if(io == selected_io)
to_chat(user, "<span class='warning'>Wiring \the [selected_io.holder]'s [selected_io.name] into itself is rather pointless.</span>")
return
if(io.io_type != selected_io.io_type)
to_chat(user, "<span class='warning'>Those two types of channels are incompatable. The first is a [selected_io.io_type], \
while the second is a [io.io_type].</span>")
return
if(io.holder.assembly && io.holder.assembly != selected_io.holder.assembly)
to_chat(user, "<span class='warning'>Both \the [io.holder] and \the [selected_io.holder] need to be inside the same assembly.</span>")
return
selected_io.linked |= io
io.linked |= selected_io
to_chat(user, "<span class='notice'>You connect \the [selected_io.holder]'s [selected_io.name] to \the [io.holder]'s [io.name].</span>")
selected_io.holder.interact(user) // This is to update the UI.
selected_io = null
else
selected_io = io
to_chat(user, "<span class='notice'>You link \the multitool to \the [selected_io.holder]'s [selected_io.name] data channel.</span>")
update_icon()
/obj/item/device/multitool/proc/unwire(var/datum/integrated_io/io1, var/datum/integrated_io/io2, mob/user)
if(!io1.linked.len || !io2.linked.len)
to_chat(user, "<span class='warning'>There is nothing connected to the data channel.</span>")
return
if(!(io1 in io2.linked) || !(io2 in io1.linked) )
to_chat(user, "<span class='warning'>These data pins aren't connected!</span>")
return
else
io1.linked.Remove(io2)
io2.linked.Remove(io1)
to_chat(user, "<span class='notice'>You clip the data connection between the [io1.holder.displayed_name]'s \
[io1.name] and the [io2.holder.displayed_name]'s [io2.name].</span>")
io1.holder.interact(user) // This is to update the UI.
update_icon()
/obj/item/weapon/storage/bag/circuits
name = "circuit kit"
desc = "This kit's essential for any circuitry projects."
@@ -178,7 +261,8 @@
/obj/item/device/electronic_assembly,
/obj/item/device/integrated_electronics,
/obj/item/weapon/crowbar,
/obj/item/weapon/screwdriver
/obj/item/weapon/screwdriver,
/obj/item/device/multitool
)
/obj/item/weapon/storage/bag/circuits/basic/New()
@@ -186,7 +270,7 @@
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)
// for(var/i = 1 to 4)
// new IC.type(src)
new /obj/item/weapon/storage/bag/circuits/mini/arithmetic(src)
new /obj/item/weapon/storage/bag/circuits/mini/trig(src)
@@ -201,10 +285,11 @@
new /obj/item/weapon/storage/bag/circuits/mini/power(src)
new /obj/item/device/electronic_assembly(src)
new /obj/item/device/integrated_electronics/wirer(src)
new /obj/item/device/integrated_electronics/debugger(src)
new /obj/item/weapon/crowbar(src)
new /obj/item/device/assembly/electronic_assembly(src)
new /obj/item/device/assembly/electronic_assembly(src)
new /obj/item/device/multitool(src)
new /obj/item/weapon/screwdriver(src)
new /obj/item/weapon/crowbar(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/all/New()
@@ -231,7 +316,6 @@
new /obj/item/device/integrated_electronics/wirer(src)
new /obj/item/device/integrated_electronics/debugger(src)
new /obj/item/weapon/crowbar(src)
new /obj/item/weapon/screwdriver(src)
make_exact_fit()
/obj/item/weapon/storage/bag/circuits/mini/
@@ -254,7 +338,7 @@
..()
for(var/obj/item/integrated_circuit/arithmetic/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -271,7 +355,7 @@
..()
for(var/obj/item/integrated_circuit/trig/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -288,7 +372,7 @@
..()
for(var/obj/item/integrated_circuit/input/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -305,7 +389,7 @@
..()
for(var/obj/item/integrated_circuit/output/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -322,7 +406,7 @@
..()
for(var/obj/item/integrated_circuit/memory/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -339,7 +423,7 @@
..()
for(var/obj/item/integrated_circuit/logic/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -356,7 +440,7 @@
..()
for(var/obj/item/integrated_circuit/time/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -373,7 +457,7 @@
..()
for(var/obj/item/integrated_circuit/reagent/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -390,7 +474,7 @@
..()
for(var/obj/item/integrated_circuit/transfer/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -407,7 +491,7 @@
..()
for(var/obj/item/integrated_circuit/converter/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -423,7 +507,7 @@
..()
for(var/obj/item/integrated_circuit/smart/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -439,7 +523,7 @@
..()
for(var/obj/item/integrated_circuit/manipulation/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()
@@ -456,10 +540,10 @@
..()
for(var/obj/item/integrated_circuit/passive/power/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
for(var/obj/item/integrated_circuit/power/IC in all_integrated_circuits)
if(IC.spawn_flags & spawn_flags_to_use)
for(var/i = 1 to 3)
for(var/i = 1 to 4)
new IC.type(src)
make_exact_fit()

View File

@@ -12,7 +12,7 @@
"\<NUM\> H"
)
outputs = list("\<NUM\> result")
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
activators = list("compute" = 1, "on computed" = 0)
category_text = "Arithmetic"
autopulse = 1
power_draw_per_use = 5 // Math is pretty cheap.

View File

@@ -0,0 +1,28 @@
/obj/item/integrated_circuit/built_in
name = "integrated circuit"
desc = "It's a tiny chip! This one doesn't seem to do much, however."
icon = 'icons/obj/electronic_assemblies.dmi'
icon_state = "template"
size = -1
w_class = ITEMSIZE_TINY
removable = FALSE // Determines if a circuit is removable from the assembly.
/obj/item/integrated_circuit/built_in/device_input
name = "assembly input"
desc = "A built in chip for handling pulses from attached assembly items."
complexity = 0 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
activators = list("on pulsed" = 0)
/obj/item/integrated_circuit/built_in/device_input/do_work()
activate_pin(1)
/obj/item/integrated_circuit/built_in/device_output
name = "assembly out"
desc = "A built in chip for pulsing attached assembly items."
complexity = 0 //This acts as a limitation on building machines, more resource-intensive components cost more 'space'.
activators = list("pulse attached" = 1)
/obj/item/integrated_circuit/built_in/device_output/do_work()
if(istype(assembly, /obj/item/device/electronic_assembly/device))
var/obj/item/device/electronic_assembly/device/device = assembly
device.holder.pulse()

View File

@@ -3,7 +3,7 @@
complexity = 2
inputs = list("input")
outputs = list("output")
activators = list("\<PULSE IN\> convert", "\<PULSE OUT\> on convert")
activators = list("convert" = 1, "on convert" = 0)
category_text = "Converter"
autopulse = 1
power_draw_per_use = 10
@@ -15,6 +15,7 @@
/obj/item/integrated_circuit/converter/num2text
name = "number to string"
desc = "This circuit can convert a number variable into a string."
extended_desc = "Because of game limitations null/false variables will output a '0' string."
icon_state = "num-string"
inputs = list("\<NUM\> input")
outputs = list("\<TEXT\> output")
@@ -26,6 +27,8 @@
var/incoming = get_pin_data(IC_INPUT, 1)
if(incoming && isnum(incoming))
result = num2text(incoming)
else if(!incoming)
result = "0"
set_pin_data(IC_OUTPUT, 1, result)
push_data()
@@ -107,8 +110,8 @@
push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/concatenatior
name = "concatenatior"
/obj/item/integrated_circuit/converter/concatenator
name = "concatenator"
desc = "This joins many strings or numbers together to get one big string."
complexity = 4
inputs = list(
@@ -122,10 +125,10 @@
"\<TEXT/NUM\> H"
)
outputs = list("\<TEXT\> result")
activators = list("\<PULSE IN\> concatenate", "\<PULSE OUT\> on concatenated")
activators = list("concatenate" = 1, "on concatenated" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/concatenatior/do_work()
/obj/item/integrated_circuit/converter/concatenator/do_work()
var/result = null
for(var/datum/integrated_io/input/I in inputs)
I.pull_data()
@@ -139,6 +142,44 @@
outgoing.push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/separator
name = "separator"
desc = "This splits as single string into two at the relative split point."
extended_desc = "This circuits splits a given string into two, based on the string, and the index value. \
The index splits the string <b>after</b> the given index, including spaces. So 'a person' with an index of '3' \
will split into 'a p' and 'erson'."
complexity = 4
inputs = list(
"\<TEXT\> string",
"\<NUM\> index",
)
outputs = list(
"\<TEXT\> before split",
"\<TEXT\> after split"
)
activators = list("separate" = 1, "on separated" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/separator/do_work()
var/text = get_pin_data(IC_INPUT, 1)
var/index = get_pin_data(IC_INPUT, 2)
var/split = min(index+1, length(text))
var/before_text = copytext(text, 1, split)
var/after_text = copytext(text, split, 0)
var/datum/integrated_io/outgoing1 = outputs[1]
var/datum/integrated_io/outgoing2 = outputs[2]
outgoing1.data = before_text
outgoing2.data = after_text
outgoing1.push_data()
outgoing2.push_data()
activate_pin(2)
/obj/item/integrated_circuit/converter/radians2degrees
name = "radians to degrees converter"
desc = "Converts radians to degrees."
@@ -182,7 +223,7 @@
complexity = 4
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")
activators = list("compute rel coordinates" = 1, "on convert" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/converter/abs_to_rel_coords/do_work()

View File

@@ -44,9 +44,9 @@
icon_state = "splitter"
complexity = 3
activators = list(
"incoming pulse",
"outgoing pulse A",
"outgoing pulse B"
"pulse" = 1,
"pulse A" = 0,
"pulse B" = 0
)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 2
@@ -64,11 +64,11 @@
icon_state = "splitter4"
complexity = 5
activators = list(
"incoming pulse",
"outgoing pulse A",
"outgoing pulse B",
"outgoing pulse C",
"outgoing pulse D"
"pulse" = 1,
"pulse A" = 0,
"pulse B" = 0,
"pulse C" = 0,
"pulse D" = 0
)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4
@@ -79,15 +79,15 @@
w_class = ITEMSIZE_SMALL
complexity = 9
activators = list(
"incoming pulse",
"outgoing pulse A",
"outgoing pulse B",
"outgoing pulse C",
"outgoing pulse D",
"outgoing pulse E",
"outgoing pulse F",
"outgoing pulse G",
"outgoing pulse H"
"incoming pulse" = 1,
"outgoing pulse A" = 0,
"outgoing pulse B" = 0,
"outgoing pulse C" = 0,
"outgoing pulse D" = 0,
"outgoing pulse E" = 0,
"outgoing pulse F" = 0,
"outgoing pulse G" = 0,
"outgoing pulse H" = 0
)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 8
@@ -101,7 +101,7 @@
icon_state = "mux2"
inputs = list("input selection")
outputs = list("output")
activators = list("select")
activators = list("select" = 1, "on select" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4
var/number_of_inputs = 2
@@ -120,7 +120,10 @@
if(isnum(input_index) && (input_index >= 1 && input_index < inputs.len))
output = get_pin_data(IC_INPUT, input_index + 1)
set_pin_data(IC_OUTPUT, 1, output)
push_data()
activate_pin(2)
/obj/item/integrated_circuit/transfer/multiplexer/medium
name = "four multiplexer"
@@ -147,7 +150,7 @@
icon_state = "dmux2"
inputs = list("output selection","input")
outputs = list()
activators = list("select")
activators = list("select" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4
var/number_of_outputs = 2

View File

@@ -14,7 +14,7 @@
can_be_asked_input = 1
inputs = list()
outputs = list()
activators = list("\<PULSE OUT\> on pressed")
activators = list("on pressed" = 0)
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.
@@ -29,7 +29,7 @@
can_be_asked_input = 1
inputs = list()
outputs = list("\<NUM\> on" = 0)
activators = list("\<PULSE OUT\> on toggle")
activators = list("on toggle" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
/obj/item/integrated_circuit/input/toggle_button/ask_for_input(mob/user) // Ditto.
@@ -46,7 +46,7 @@
can_be_asked_input = 1
inputs = list()
outputs = list("\<NUM\> number entered")
activators = list("\<PULSE OUT\> on entered")
activators = list("on entered" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4
@@ -65,7 +65,7 @@
can_be_asked_input = 1
inputs = list()
outputs = list("\<TEXT\> string entered")
activators = list("\<PULSE OUT\> on entered")
activators = list("on entered" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4
@@ -83,7 +83,7 @@
complexity = 4
inputs = list("\<REF\> target")
outputs = list("\<NUM\> total health %", "\<NUM\> total missing health")
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
activators = list("scan" = 1, "on scanned" = 0)
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
@@ -118,7 +118,7 @@
"\<NUM\> oxy damage",
"\<NUM\> clone damage"
)
activators = list("\<PULSE IN\> scan", "\<PULSE OUT\> on scanned")
activators = list("scan" = 1, "on scanned" = 0)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4)
power_draw_per_use = 80
@@ -148,7 +148,7 @@
that is holding the machine containing it."
inputs = list()
outputs = list("located ref")
activators = list("locate")
activators = list("locate" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 20
@@ -170,7 +170,7 @@
random."
inputs = list("desired type ref")
outputs = list("located ref")
activators = list("locate")
activators = list("locate" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 30
@@ -206,7 +206,7 @@
complexity = 4
inputs = list("\<NUM\> frequency","\<NUM\> code")
outputs = list()
activators = list("\<PULSE IN\> send signal","\<PULSE OUT\> on signal sent", "\<PULSE OUT\> on signal received")
activators = list("send signal" = 1,"on signal sent" = 0, "on signal received" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_MAGNET = 2)
power_draw_idle = 5
@@ -288,7 +288,7 @@
complexity = 4
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")
activators = list("send data" = 1, "on data received" = 0)
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
@@ -332,7 +332,7 @@
complexity = 4
inputs = list()
outputs = list("\<NUM\> X", "\<NUM\> Y")
activators = list("\<PULSE IN\> get coordinates", "\<PULSE OUT\> on get coordinates")
activators = list("get coordinates" = 1, "on get coordinates" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 30
@@ -361,7 +361,7 @@
complexity = 8
inputs = list()
outputs = list("\<TEXT\> speaker", "\<TEXT\> message")
activators = list("\<PULSE OUT\> on message received", "\<PULSE OUT\> on translation")
activators = list("on message received" = 1, "on translation" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 15
@@ -399,7 +399,7 @@
complexity = 12
inputs = list("\<NUM\> ignore storage" = 1)
outputs = list("\<REF\> scanned")
activators = list("\<PULSE OUT\> on scanned")
activators = list("on scanned" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 120
@@ -423,7 +423,7 @@
icon_state = "screen"
inputs = list("\<TEXT/NUM\> displayed data")
outputs = list()
activators = list("\<PULSE IN\> load data")
activators = list("load data" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 10
autopulse = 1
@@ -477,7 +477,7 @@
complexity = 4
inputs = list()
outputs = list()
activators = list("\<PULSE IN\> toggle light")
activators = list("toggle light" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
var/light_toggled = 0
var/light_brightness = 3
@@ -545,7 +545,7 @@
"\<NUM\> frequency"
)
outputs = list()
activators = list("play sound")
activators = list("play sound" = 1)
power_draw_per_use = 20
var/list/sounds = list()
@@ -558,7 +558,7 @@
cooldown_per_use = 4 SECONDS
inputs = list("text")
outputs = list()
activators = list("to speech")
activators = list("to speech" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 60

View File

@@ -4,7 +4,7 @@
extended_desc = "Logic circuits will treat a null, 0, and a \"\" string value as FALSE and anything else as TRUE."
complexity = 3
outputs = list("result")
activators = list("\<PULSE IN\> compare")
activators = list("compare" = 1)
category_text = "Logic"
autopulse = 1
power_draw_per_use = 1
@@ -18,7 +18,7 @@
/obj/item/integrated_circuit/logic/binary
inputs = list("\<ANY\> A","\<ANY\> B")
activators = list("\<PULSE IN\> compare", "\<PULSE OUT\> on true result", "\<PULSE OUT\> on false result")
activators = list("compare" = 1, "on true result" = 0, "on false result" = 0)
/obj/item/integrated_circuit/logic/binary/do_work()
pull_data()
@@ -38,7 +38,7 @@
/obj/item/integrated_circuit/logic/unary
inputs = list("\<ANY\> A")
activators = list("\<PULSE IN\> compare", "\<PULSE OUT\> on compare")
activators = list("compare" = 1, "on compare" = 0)
/obj/item/integrated_circuit/logic/unary/do_work()
pull_data()
@@ -128,7 +128,7 @@
desc = "This gate inverts what's fed into it."
icon_state = "not"
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
activators = list("\<PULSE IN\> invert", "\<PULSE OUT\> on inverted")
activators = list("invert" = 1, "on inverted" = 0)
/obj/item/integrated_circuit/logic/unary/not/do_check(var/datum/integrated_io/A)
return !A.data

View File

@@ -10,13 +10,14 @@
normal limitations to firearms, such as ammunition requirements and firing delays, still hold true if fired by the mechanism."
complexity = 20
w_class = ITEMSIZE_NORMAL
size = 3
inputs = list(
"\<NUM\> target X rel",
"\<NUM\> target Y rel"
)
outputs = list()
activators = list(
"\<PULSE IN\> fire"
"fire" = 1
)
var/obj/item/weapon/gun/installed_gun = null
spawn_flags = IC_SPAWN_RESEARCH
@@ -35,6 +36,7 @@
return
user.drop_from_inventory(gun)
installed_gun = gun
size += gun.w_class
gun.forceMove(src)
user << "<span class='notice'>You slide \the [gun] into the firing mechanism.</span>"
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
@@ -45,52 +47,58 @@
if(installed_gun)
installed_gun.forceMove(get_turf(src))
user << "<span class='notice'>You slide \the [installed_gun] out of the firing mechanism.</span>"
size = initial(size)
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
installed_gun = null
else
user << "<span class='notice'>There's no weapon to remove from the mechanism.</span>"
/obj/item/integrated_circuit/manipulation/weapon_firing/do_work()
if(..())
if(!installed_gun)
if(!installed_gun)
return
var/datum/integrated_io/target_x = inputs[1]
var/datum/integrated_io/target_y = inputs[2]
if(src.assembly)
if(isnum(target_x.data))
target_x.data = round(target_x.data)
if(isnum(target_y.data))
target_y.data = round(target_y.data)
var/turf/T = get_turf(src.assembly)
if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves.
return
var/datum/integrated_io/target_x = inputs[1]
var/datum/integrated_io/target_y = inputs[2]
// We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates.
var/i
if(target_x.data > 0)
i = abs(target_x.data)
while(i > 0)
T = get_step(T, EAST)
i--
else
i = abs(target_x.data)
while(i > 0)
T = get_step(T, WEST)
i--
if(target_x.data && target_y.data && isnum(target_x.data) && isnum(target_y.data))
var/turf/T = get_turf(src)
i = 0
if(target_y.data > 0)
i = abs(target_y.data)
while(i > 0)
T = get_step(T, NORTH)
i--
else if(target_y.data < 0)
i = abs(target_y.data)
while(i > 0)
T = get_step(T, SOUTH)
i--
if(target_x.data == 0 && target_y.data == 0) // Don't shoot ourselves.
return
// We need to do this in order to enable relative coordinates, as locate() only works for absolute coordinates.
var/i
if(target_x.data > 0)
i = abs(target_x.data)
while(i)
T = get_step(T, EAST)
i--
else if(target_x.data < 0)
i = abs(target_x.data)
while(i)
T = get_step(T, WEST)
i--
if(target_y.data > 0)
i = abs(target_y.data)
while(i)
T = get_step(T, NORTH)
i--
else if(target_y.data < 0)
i = abs(target_y.data)
while(i)
T = get_step(T, SOUTH)
i--
if(!T)
return
installed_gun.Fire_userless(T)
if(!T)
return
installed_gun.Fire_userless(T)
/obj/item/integrated_circuit/manipulation/locomotion
name = "locomotion circuit"
@@ -110,9 +118,10 @@
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."
w_class = ITEMSIZE_NORMAL
complexity = 20
// size = 5
inputs = list("dir num")
outputs = list()
activators = list("step towards dir")
activators = list("step towards dir" = 1)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 100
@@ -125,4 +134,82 @@
if(assembly.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]
if(isnum(wanted_dir.data))
step(assembly, wanted_dir.data)
step(assembly, wanted_dir.data)
/obj/item/integrated_circuit/manipulation/grenade
name = "grenade primer"
desc = "This circuit comes with the ability to attach most types of grenades at prime them at will."
extended_desc = "Time between priming and detonation is limited to between 1 to 12 seconds but is optional. \
If unset, not a number, or a number less than 1 then the grenade's built-in timing will be used. \
Beware: Once primed there is no aborting the process!"
icon_state = "grenade"
complexity = 30
size = 2
inputs = list("\<NUM\> detonation time")
outputs = list()
activators = list("prime grenade" = 1)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_COMBAT = 4)
var/obj/item/weapon/grenade/attached_grenade
var/pre_attached_grenade_type
/obj/item/integrated_circuit/manipulation/grenade/New()
..()
if(pre_attached_grenade_type)
var/grenade = new pre_attached_grenade_type(src)
attach_grenade(grenade)
/obj/item/integrated_circuit/manipulation/grenade/Destroy()
if(attached_grenade && !attached_grenade.active)
attached_grenade.dropInto(loc)
detach_grenade()
. =..()
/obj/item/integrated_circuit/manipulation/grenade/attackby(var/obj/item/weapon/grenade/G, var/mob/user)
if(istype(G))
if(attached_grenade)
to_chat(user, "<span class='warning'>There is already a grenade attached!</span>")
else if(user.unEquip(G, force=1))
user.visible_message("<span class='warning'>\The [user] attaches \a [G] to \the [src]!</span>", "<span class='notice'>You attach \the [G] to \the [src].</span>")
attach_grenade(G)
G.forceMove(src)
else
..()
/obj/item/integrated_circuit/manipulation/grenade/attack_self(var/mob/user)
if(attached_grenade)
user.visible_message("<span class='warning'>\The [user] removes \an [attached_grenade] from \the [src]!</span>", "<span class='notice'>You remove \the [attached_grenade] from \the [src].</span>")
user.put_in_any_hand_if_possible(attached_grenade) || attached_grenade.dropInto(loc)
detach_grenade()
else
..()
/obj/item/integrated_circuit/manipulation/grenade/do_work()
if(attached_grenade && !attached_grenade.active)
var/datum/integrated_io/detonation_time = inputs[1]
if(isnum(detonation_time.data) && detonation_time.data > 0)
attached_grenade.det_time = between(1, detonation_time.data, 12) SECONDS
attached_grenade.activate()
var/atom/holder = loc
log_and_message_admins("activated a grenade assembly. Last touches: Assembly: [holder.fingerprintslast] Circuit: [fingerprintslast] Grenade: [attached_grenade.fingerprintslast]")
// These procs do not relocate the grenade, that's the callers responsibility
/obj/item/integrated_circuit/manipulation/grenade/proc/attach_grenade(var/obj/item/weapon/grenade/G)
attached_grenade = G
destroyed_event.register(attached_grenade, src, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
size += G.w_class
desc += " \An [attached_grenade] is attached to it!"
/obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade()
if(!attached_grenade)
return
destroyed_event.unregister(attached_grenade, src, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
attached_grenade = null
size = initial(size)
desc = initial(desc)
/obj/item/integrated_circuit/manipulation/grenade/frag
pre_attached_grenade_type = /obj/item/weapon/grenade/explosive
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_COMBAT = 10)
spawn_flags = null // Used for world initializing, see the #defines above.

View File

@@ -5,7 +5,7 @@
complexity = 1
inputs = list("input pin 1")
outputs = list("output pin 1")
activators = list("set")
activators = list("set" = 1, "on set")
category_text = "Memory"
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 1
@@ -29,12 +29,13 @@
var/datum/integrated_io/I = inputs[i]
var/datum/integrated_io/O = outputs[i]
O.data = I.data
O.push_data()
activate_pin(2)
/obj/item/integrated_circuit/memory/medium
name = "memory circuit"
desc = "This circuit can store four pieces of data."
icon_state = "memory4"
w_class = ITEMSIZE_SMALL
complexity = 4
inputs = list("input pin 1","input pin 2","input pin 3","input pin 4")
outputs = list("output pin 1","output pin 2","output pin 3","output pin 4")
@@ -45,7 +46,6 @@
name = "large memory circuit"
desc = "This big circuit can hold eight pieces of data."
icon_state = "memory8"
w_class = ITEMSIZE_SMALL
complexity = 8
inputs = list(
"input pin 1",
@@ -121,7 +121,7 @@
complexity = 1
inputs = list()
outputs = list("output pin")
activators = list("push data")
activators = list("push data" = 0)
var/accepting_refs = 0
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH

View File

@@ -13,7 +13,7 @@
complexity = 16
inputs = list("\<REF\> target")
outputs = list("\<NUM\> target cell charge", "\<NUM\> target cell max charge", "\<NUM\> target cell percentage")
activators = list("\<PULSE IN\> transmit")
activators = list("transmit" = 1)
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.

View File

@@ -19,7 +19,7 @@
cooldown_per_use = 30 SECONDS
inputs = list()
outputs = list()
activators = list("create smoke")
activators = list("create smoke" = 1)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 3)
volume = 100
@@ -45,7 +45,7 @@
cooldown_per_use = 6 SECONDS
inputs = list("\<REF\> target", "\<NUM\> injection amount" = 5)
outputs = list()
activators = list("\<PULSE IN\> inject")
activators = list("inject" = 1)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
volume = 30
power_draw_per_use = 15
@@ -90,7 +90,7 @@
complexity = 8
inputs = list("\<REF\> source", "\<REF\> target", "\<NUM\> injection amount" = 10)
outputs = list()
activators = list("\<PULSE IN\> transfer reagents", "\<PULSE OUT\> on transfer")
activators = list("transfer reagents" = 1, "on transfer" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 2)
var/transfer_amount = 10

View File

@@ -10,7 +10,7 @@
complexity = 25
inputs = list("\<REF\> target")
outputs = list("\<NUM\> dir")
activators = list("\<PULSE IN\> calculate dir", "\<PULSE OUT\> on calculated")
activators = list("calculate dir" = 1, "on calculated" = 0)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 4, TECH_DATA = 5)
power_draw_per_use = 40

View File

@@ -12,7 +12,7 @@
This circuit is set to send a pulse after a delay of two seconds."
icon_state = "delay-20"
var/delay = 2 SECONDS
activators = list("\<PULSE IN\> incoming","\<PULSE OUT\> outgoing")
activators = list("incoming"= 1,"outgoing" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 2
@@ -79,7 +79,7 @@
var/ticks_completed = 0
var/is_running = FALSE
inputs = list("\<NUM\> enable ticking" = 0)
activators = list("\<PULSE OUT\> outgoing pulse")
activators = list("outgoing pulse" = 0)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 4
@@ -132,7 +132,7 @@
icon_state = "clock"
inputs = list()
outputs = list("\<TEXT\> time", "\<NUM\> hours", "\<NUM\> minutes", "\<NUM\> seconds")
activators = list("\<PULSE IN\> get time","\<PULSE OUT\> on time got")
activators = list("get time" = 1,"on time got" = 0)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 4

View File

@@ -12,7 +12,7 @@
"\<NUM\> H"
)
outputs = list("\<NUM\> result")
activators = list("\<PULSE IN\> compute", "\<PULSE OUT\> on computed")
activators = list("compute" = 1, "on computed" = 0)
category_text = "Trig"
extended_desc = "Input and output are in degrees."
autopulse = 1