module things, jfc
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
|
||||
/obj/item/integrated_electronics/analyzer/afterattack(var/atom/A, var/mob/living/user)
|
||||
. = ..()
|
||||
if(istype(A, /obj/item/electronic_assembly))
|
||||
var/saved = "[A.name] analyzed! On circuit printers with cloning enabled, you may use the code below to clone the circuit:<br><br><code>[SScircuit.save_electronic_assembly(A)]</code>"
|
||||
if(saved)
|
||||
@@ -14,5 +15,3 @@
|
||||
user << browse(saved, "window=circuit_scan;size=500x600;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[A] is not complete enough to be encoded!</span>")
|
||||
else
|
||||
..()
|
||||
|
||||
@@ -59,6 +59,11 @@
|
||||
COLOR_ASSEMBLY_PURPLE
|
||||
)
|
||||
|
||||
/obj/item/electronic_assembly/New()
|
||||
..()
|
||||
src.max_components = round(max_components)
|
||||
src.max_complexity = round(max_complexity)
|
||||
|
||||
/obj/item/electronic_assembly/GenerateTag()
|
||||
tag = "assembly_[next_assembly_id++]"
|
||||
|
||||
@@ -70,12 +75,18 @@
|
||||
to_chat(user, "<span class='notice'>The maintenance panel [opened ? "can be" : "is"] <b>screwed</b> in place.</span>")
|
||||
|
||||
if((isobserver(user) && ckeys_allowed_to_scan[user.ckey]) || IsAdminGhost(user))
|
||||
to_chat(user, "You can <a href='?src=[REF(src)];ghostscan=1'>scan</a> this circuit.");
|
||||
to_chat(user, "You can <a href='?src=[REF(src)];ghostscan=1'>scan</a> this circuit.")
|
||||
|
||||
for(var/I in assembly_components)
|
||||
var/obj/item/integrated_circuit/IC = I
|
||||
IC.external_examine(user)
|
||||
if(opened)
|
||||
interact(user)
|
||||
|
||||
/obj/item/electronic_assembly/proc/check_interactivity(mob/user)
|
||||
return user.canUseTopic(src, BE_CLOSE)
|
||||
|
||||
/obj/item/electronic_assembly/Collide(atom/AM)
|
||||
/obj/item/electronic_assembly/Bump(atom/AM)
|
||||
collw = AM
|
||||
.=..()
|
||||
if((istype(collw, /obj/machinery/door/airlock) || istype(collw, /obj/machinery/door/window)) && (!isnull(access_card)))
|
||||
@@ -306,14 +317,6 @@
|
||||
detail_overlay.color = detail_color
|
||||
add_overlay(detail_overlay)
|
||||
|
||||
/obj/item/electronic_assembly/examine(mob/user)
|
||||
..()
|
||||
for(var/I in assembly_components)
|
||||
var/obj/item/integrated_circuit/IC = I
|
||||
IC.external_examine(user)
|
||||
if(opened)
|
||||
interact(user)
|
||||
|
||||
/obj/item/electronic_assembly/proc/return_total_complexity()
|
||||
. = 0
|
||||
var/obj/item/integrated_circuit/part
|
||||
@@ -420,12 +423,15 @@
|
||||
|
||||
|
||||
/obj/item/electronic_assembly/afterattack(atom/target, mob/user, proximity)
|
||||
. = ..()
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
if(S.sense(target,user,proximity))
|
||||
visible_message("<span class='notice'> [user] waves [src] around [target].</span>")
|
||||
|
||||
|
||||
/obj/item/electronic_assembly/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(..())
|
||||
return TRUE
|
||||
I.play_tool_sound(src)
|
||||
opened = !opened
|
||||
to_chat(user, "<span class='notice'>You [opened ? "open" : "close"] the maintenance hatch of [src].</span>")
|
||||
@@ -439,7 +445,6 @@
|
||||
if(!user.canUnEquip(I))
|
||||
return FALSE
|
||||
if(try_add_component(I, user))
|
||||
interact(user)
|
||||
return TRUE
|
||||
else
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
@@ -465,24 +470,50 @@
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
S.attackby_react(I,user,user.a_intent)
|
||||
return ..()
|
||||
var/obj/item/stock_parts/cell = I
|
||||
user.transferItemToLoc(I, loc)
|
||||
cell.forceMove(src)
|
||||
battery = cell
|
||||
I.forceMove(src)
|
||||
battery = I
|
||||
diag_hud_set_circuitstat() //update diagnostic hud
|
||||
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)
|
||||
to_chat(user, "<span class='notice'>You slot the [I] inside \the [src]'s power supplier.</span>")
|
||||
return TRUE
|
||||
else if(istype(I, /obj/item/integrated_electronics/detailer))
|
||||
var/obj/item/integrated_electronics/detailer/D = I
|
||||
detail_color = D.detail_color
|
||||
update_icon()
|
||||
else
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
S.attackby_react(I,user,user.a_intent)
|
||||
if(user.a_intent != INTENT_HELP)
|
||||
return ..()
|
||||
var/list/input_selection = list()
|
||||
//Check all the components asking for an input
|
||||
for(var/obj/item/integrated_circuit/input in assembly_components)
|
||||
if((input.demands_object_input && opened) || (input.demands_object_input && input.can_input_object_when_closed))
|
||||
var/i = 0
|
||||
//Check if there is another component with the same name and append a number for identification
|
||||
for(var/s in input_selection)
|
||||
var/obj/item/integrated_circuit/s_circuit = input_selection[s]
|
||||
if(s_circuit.name == input.name && s_circuit.displayed_name == input.displayed_name && s_circuit != input)
|
||||
i++
|
||||
var/disp_name= "[input.displayed_name] \[[input]\]"
|
||||
if(i)
|
||||
disp_name += " ([i+1])"
|
||||
//Associative lists prevent me from needing another list and using a Find proc
|
||||
input_selection[disp_name] = input
|
||||
|
||||
var/obj/item/integrated_circuit/choice
|
||||
if(input_selection)
|
||||
if(input_selection.len == 1)
|
||||
choice = input_selection[input_selection[1]]
|
||||
else
|
||||
var/selection = input(user, "Where do you want to insert that item?", "Interaction") as null|anything in input_selection
|
||||
if(!check_interactivity(user))
|
||||
return ..()
|
||||
if(selection)
|
||||
choice = input_selection[selection]
|
||||
if(choice)
|
||||
choice.additem(I, user)
|
||||
for(var/obj/item/integrated_circuit/input/S in assembly_components)
|
||||
S.attackby_react(I,user,user.a_intent)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/electronic_assembly/attack_self(mob/user)
|
||||
@@ -492,30 +523,33 @@
|
||||
interact(user)
|
||||
|
||||
var/list/input_selection = list()
|
||||
var/list/available_inputs = list()
|
||||
//Check all the components asking for an input
|
||||
for(var/obj/item/integrated_circuit/input/input in assembly_components)
|
||||
if(input.can_be_asked_input)
|
||||
available_inputs.Add(input)
|
||||
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)
|
||||
//Check if there is another component with the same name and append a number for identification
|
||||
for(var/s in input_selection)
|
||||
var/obj/item/integrated_circuit/s_circuit = input_selection[s]
|
||||
if(s_circuit.name == input.name && s_circuit.displayed_name == input.displayed_name && s_circuit != input)
|
||||
i++
|
||||
var/disp_name= "[input.displayed_name] \[[input]\]"
|
||||
if(i)
|
||||
disp_name += " ([i+1])"
|
||||
input_selection.Add(disp_name)
|
||||
//Associative lists prevent me from needing another list and using a Find proc
|
||||
input_selection[disp_name] = input
|
||||
|
||||
var/obj/item/integrated_circuit/input/choice
|
||||
if(available_inputs)
|
||||
if(available_inputs.len ==1)
|
||||
choice = available_inputs[1]
|
||||
|
||||
|
||||
if(input_selection)
|
||||
if(input_selection.len ==1)
|
||||
choice = input_selection[input_selection[1]]
|
||||
else
|
||||
var/selection = input(user, "What do you want to interact with?", "Interaction") as null|anything in input_selection
|
||||
if(!check_interactivity(user))
|
||||
return
|
||||
if(selection)
|
||||
var/index = input_selection.Find(selection)
|
||||
choice = available_inputs[index]
|
||||
choice = input_selection[selection]
|
||||
|
||||
if(choice)
|
||||
choice.ask_for_input(user)
|
||||
@@ -609,6 +643,37 @@
|
||||
icon_state = "setup_small_pda"
|
||||
desc = "It's a case, for building small electronics with. This one resembles a PDA."
|
||||
|
||||
/obj/item/electronic_assembly/small
|
||||
name = "electronic device"
|
||||
icon_state = "setup_device"
|
||||
desc = "It's a case, for building tiny-sized electronics with."
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
max_components = IC_MAX_SIZE_BASE / 2
|
||||
max_complexity = IC_COMPLEXITY_BASE / 2
|
||||
|
||||
/obj/item/electronic_assembly/small/default
|
||||
name = "type-a electronic device"
|
||||
|
||||
/obj/item/electronic_assembly/small/cylinder
|
||||
name = "type-b electronic device"
|
||||
icon_state = "setup_device_cylinder"
|
||||
desc = "It's a case, for building tiny-sized electronics with. This one has a cylindrical design."
|
||||
|
||||
/obj/item/electronic_assembly/small/scanner
|
||||
name = "type-c electronic device"
|
||||
icon_state = "setup_device_scanner"
|
||||
desc = "It's a case, for building tiny-sized electronics with. This one has a scanner-like design."
|
||||
|
||||
/obj/item/electronic_assembly/small/hook
|
||||
name = "type-d electronic device"
|
||||
icon_state = "setup_device_hook"
|
||||
desc = "It's a case, for building tiny-sized electronics with. This one looks like it has a belt clip, but it's purely decorative."
|
||||
|
||||
/obj/item/electronic_assembly/small/box
|
||||
name = "type-e electronic device"
|
||||
icon_state = "setup_device_box"
|
||||
desc = "It's a case, for building tiny-sized electronics with. This one has a boxy design."
|
||||
|
||||
/obj/item/electronic_assembly/medium
|
||||
name = "electronic mechanism"
|
||||
icon_state = "setup_medium"
|
||||
@@ -750,6 +815,14 @@
|
||||
max_components = IC_MAX_SIZE_BASE
|
||||
max_complexity = IC_COMPLEXITY_BASE
|
||||
|
||||
/obj/item/electronic_assembly/wallmount/tiny
|
||||
name = "tiny wall-mounted electronic assembly"
|
||||
icon_state = "setup_wallmount_tiny"
|
||||
desc = "It's a case, for building tiny electronics with. It has a magnetized backing to allow it to stick to walls, but you'll still need to wrench the anchoring bolts in place to keep it on."
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
max_components = IC_MAX_SIZE_BASE / 2
|
||||
max_complexity = IC_COMPLEXITY_BASE / 2
|
||||
|
||||
/obj/item/electronic_assembly/wallmount/proc/mount_assembly(turf/on_wall, mob/user) //Yeah, this is admittedly just an abridged and kitbashed version of the wallframe attach procs.
|
||||
if(get_dist(on_wall,user)>1)
|
||||
return
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
var/data_to_write = null
|
||||
var/accepting_refs = FALSE
|
||||
var/copy_values = FALSE
|
||||
|
||||
/obj/item/integrated_electronics/debugger/attack_self(mob/user)
|
||||
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref", "null")
|
||||
var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref","copy","null")
|
||||
if(!user.IsAdvancedToolUser())
|
||||
return
|
||||
|
||||
@@ -19,43 +20,63 @@
|
||||
switch(type_to_use)
|
||||
if("string")
|
||||
accepting_refs = FALSE
|
||||
copy_values = FALSE
|
||||
new_data = stripped_input(user, "Now type in a string.","[src] string writing", no_trim = TRUE)
|
||||
if(istext(new_data) && user.IsAdvancedToolUser())
|
||||
data_to_write = new_data
|
||||
to_chat(user, "<span class='notice'>You set \the [src]'s memory to \"[new_data]\".</span>")
|
||||
if("number")
|
||||
accepting_refs = FALSE
|
||||
copy_values = FALSE
|
||||
new_data = input(user, "Now type in a number.","[src] number writing") as null|num
|
||||
if(isnum(new_data) && user.IsAdvancedToolUser())
|
||||
data_to_write = new_data
|
||||
to_chat(user, "<span class='notice'>You set \the [src]'s memory to [new_data].</span>")
|
||||
if("ref")
|
||||
accepting_refs = TRUE
|
||||
copy_values = FALSE
|
||||
to_chat(user, "<span class='notice'>You turn \the [src]'s ref scanner on. Slide it across \
|
||||
an object for a ref of that object to save it in memory.</span>")
|
||||
if("copy")
|
||||
accepting_refs = FALSE
|
||||
copy_values = TRUE
|
||||
to_chat(user, "<span class='notice'>You turn \the [src]'s value copier on. Use it on a pin \
|
||||
to save its current value in memory.</span>")
|
||||
if("null")
|
||||
data_to_write = null
|
||||
copy_values = FALSE
|
||||
to_chat(user, "<span class='notice'>You set \the [src]'s memory to absolutely nothing.</span>")
|
||||
|
||||
/obj/item/integrated_electronics/debugger/afterattack(atom/target, mob/living/user, proximity)
|
||||
. = ..()
|
||||
if(accepting_refs && proximity)
|
||||
data_to_write = WEAKREF(target)
|
||||
visible_message("<span class='notice'>[user] slides \a [src]'s over \the [target].</span>")
|
||||
to_chat(user, "<span class='notice'>You set \the [src]'s memory to a reference to [target.name] \[Ref\]. The ref scanner is \
|
||||
now off.</span>")
|
||||
accepting_refs = FALSE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/integrated_electronics/debugger/proc/write_data(var/datum/integrated_io/io, mob/user)
|
||||
//If the pin can take data:
|
||||
if(io.io_type == DATA_CHANNEL)
|
||||
//If the debugger is set to copy, copy the data in the pin onto it
|
||||
if(copy_values)
|
||||
data_to_write = io.data
|
||||
to_chat(user, "<span class='notice'>You let the debugger copy the data.</span>")
|
||||
copy_values = FALSE
|
||||
return
|
||||
|
||||
//Else, write the data to the pin
|
||||
io.write_data_to_pin(data_to_write)
|
||||
var/data_to_show = data_to_write
|
||||
//This is only to convert a weakref into a name for better output
|
||||
if(isweakref(data_to_write))
|
||||
var/datum/weakref/w = data_to_write
|
||||
var/atom/A = w.resolve()
|
||||
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>")
|
||||
|
||||
//If the pin can only be pulsed
|
||||
else if(io.io_type == PULSE_CHANNEL)
|
||||
io.holder.check_then_do_work(io.ord,ignore_power = TRUE)
|
||||
to_chat(user, "<span class='notice'>You pulse \the [io.holder]'s [io].</span>")
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
var/category_text = "NO CATEGORY THIS IS A BUG" // To show up on circuit printer, and perhaps other places.
|
||||
var/removable = TRUE // Determines if a circuit is removable from the assembly.
|
||||
var/displayed_name = ""
|
||||
var/demands_object_input = FALSE
|
||||
var/can_input_object_when_closed = FALSE
|
||||
|
||||
|
||||
/*
|
||||
Integrated circuits are essentially modular machines. Each circuit has a specific function, and combining them inside Electronic Assemblies allows
|
||||
@@ -35,6 +38,10 @@ a creative player the means to solve many problems. Circuits are held inside an
|
||||
external_examine(user)
|
||||
. = ..()
|
||||
|
||||
// Can be called via electronic_assembly/attackby()
|
||||
/obj/item/integrated_circuit/proc/additem(var/obj/item/I, var/mob/living/user)
|
||||
attackby(I, user)
|
||||
|
||||
// This should be used when someone is examining while the case is opened.
|
||||
/obj/item/integrated_circuit/proc/internal_examine(mob/user)
|
||||
to_chat(user, "This board has [inputs.len] input pin\s, [outputs.len] output pin\s and [activators.len] activation pin\s.")
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
/obj/item/integrated_circuit_printer/proc/print_program(mob/user)
|
||||
if(!cloning)
|
||||
return
|
||||
|
||||
visible_message("<span class='notice'>[src] has finished printing its assembly!</span>")
|
||||
playsound(src, 'sound/items/poster_being_created.ogg', 50, TRUE)
|
||||
var/obj/item/electronic_assembly/assembly = SScircuit.load_electronic_assembly(get_turf(src), program)
|
||||
@@ -52,7 +53,6 @@
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You install [O] into [src]. </span>")
|
||||
upgraded = TRUE
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
if(istype(O, /obj/item/disk/integrated_circuit/upgrade/clone))
|
||||
@@ -61,7 +61,6 @@
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You install [O] into [src]. Circuit cloning will now be instant. </span>")
|
||||
fast_clone = TRUE
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
if(istype(O, /obj/item/electronic_assembly))
|
||||
@@ -108,11 +107,17 @@
|
||||
interact(user)
|
||||
|
||||
/obj/item/integrated_circuit_printer/interact(mob/user)
|
||||
if(!(in_range(src, user) || issilicon(user)))
|
||||
return
|
||||
|
||||
if(isnull(current_category))
|
||||
current_category = SScircuit.circuit_fabricator_recipe_list[1]
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
|
||||
//Preparing the browser
|
||||
var/datum/browser/popup = new(user, "printernew", "Integrated Circuit Printer", 800, 630) // Set up the popup browser window
|
||||
|
||||
var/HTML = "<center><h2>Integrated Circuit Printer</h2></center><br>"
|
||||
if(debug)
|
||||
HTML += "<center><h3>DEBUG PRINTER -- Infinite materials. Cloning available.</h3></center>"
|
||||
@@ -132,13 +137,13 @@
|
||||
if(!cloning)
|
||||
HTML += " <A href='?src=[REF(src)];print=load'>{Load Program}</a> "
|
||||
else
|
||||
HTML += " {Load Program}"
|
||||
HTML += " Load Program"
|
||||
if(!program)
|
||||
HTML += " {[fast_clone ? "Print" : "Begin Printing"] Assembly}"
|
||||
HTML += " [fast_clone ? "Print" : "Begin Printing"] Assembly"
|
||||
else if(cloning)
|
||||
HTML += " <A href='?src=[REF(src)];print=cancel'>{Cancel Print}</a>"
|
||||
HTML += " <A href='?src=[REF(src)];print=cancel'>Cancel Print</a>"
|
||||
else
|
||||
HTML += " <A href='?src=[REF(src)];print=print'>{[fast_clone ? "Print" : "Begin Printing"] Assembly}</a>"
|
||||
HTML += " <A href='?src=[REF(src)];print=print'>[fast_clone ? "Print" : "Begin Printing"] Assembly</a>"
|
||||
|
||||
HTML += "<br><hr>"
|
||||
HTML += "Categories:"
|
||||
@@ -159,11 +164,12 @@
|
||||
if((initial(IC.spawn_flags) & IC_SPAWN_RESEARCH) && (!(initial(IC.spawn_flags) & IC_SPAWN_DEFAULT)) && !upgraded)
|
||||
can_build = FALSE
|
||||
if(can_build)
|
||||
HTML += "<A href='?src=[REF(src)];build=[path]'>\[[initial(O.name)]\]</A>: [initial(O.desc)]<br>"
|
||||
HTML += "<a href='?src=[REF(src)];build=[path]'>[initial(O.name)]</a>: [initial(O.desc)]<br>"
|
||||
else
|
||||
HTML += "<s>\[[initial(O.name)]\]</s>: [initial(O.desc)]<br>"
|
||||
HTML += "<s>[initial(O.name)]</s>: [initial(O.desc)]<br>"
|
||||
|
||||
user << browse(HTML, "window=integrated_printer;size=600x500;border=1;can_resize=1;can_close=1;can_minimize=1")
|
||||
popup.set_content(HTML)
|
||||
popup.open()
|
||||
|
||||
/obj/item/integrated_circuit_printer/Topic(href, href_list)
|
||||
if(!check_interactivity(usr))
|
||||
|
||||
@@ -11,4 +11,14 @@
|
||||
holder.on_data_written()
|
||||
|
||||
/datum/integrated_io/ref/display_pin_type()
|
||||
return IC_FORMAT_REF
|
||||
return IC_FORMAT_REF
|
||||
|
||||
/datum/integrated_io/ref/connect_pin(datum/integrated_io/pin)
|
||||
..(pin)
|
||||
if(istype(pin,/datum/integrated_io/selfref))
|
||||
write_data_to_pin(pin.data)
|
||||
|
||||
/datum/integrated_io/ref/disconnect_pin(datum/integrated_io/pin)
|
||||
..(pin)
|
||||
if(istype(pin,/datum/integrated_io/selfref))
|
||||
write_data_to_pin(null)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// This pin only contains its own weakref and can't be changed
|
||||
/datum/integrated_io/selfref
|
||||
name = "selfref pin"
|
||||
|
||||
/datum/integrated_io/selfref/New()
|
||||
..()
|
||||
write_data_to_pin(src)
|
||||
|
||||
/datum/integrated_io/selfref/ask_for_pin_data(mob/user) // You can't clear it, it's self reference.
|
||||
|
||||
|
||||
/datum/integrated_io/selfref/write_data_to_pin(var/new_data) // You can't write anything else but itself onto it
|
||||
if(data)
|
||||
return
|
||||
data = WEAKREF(holder)
|
||||
holder.on_data_written()
|
||||
|
||||
/datum/integrated_io/selfref/display_pin_type()
|
||||
return IC_FORMAT_REF
|
||||
|
||||
/datum/integrated_io/selfref/connect_pin(datum/integrated_io/pin)
|
||||
pin.write_data_to_pin(data)
|
||||
..(pin)
|
||||
|
||||
/datum/integrated_io/selfref/disconnect_pin(datum/integrated_io/pin)
|
||||
..(pin)
|
||||
pin.write_data_to_pin(null)
|
||||
Reference in New Issue
Block a user