Merge pull request #5607 from Citadel-Station-13/upstream-merge-35578

[MIRROR] Adds a debug circuitry printer, along with some assorted circuit fixes and tweaks
This commit is contained in:
deathride58
2018-02-20 15:24:26 +00:00
committed by GitHub
5 changed files with 36 additions and 25 deletions

View File

@@ -8,7 +8,7 @@
/obj/item/device/integrated_electronics/analyzer/afterattack(var/atom/A, var/mob/living/user)
if(istype(A, /obj/item/device/electronic_assembly))
var/saved = SScircuit.save_electronic_assembly(A)
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)
to_chat(user, "<span class='notice'>You scan [A].</span>")
user << browse(saved, "window=circuit_scan;size=500x600;border=1;can_resize=1;can_close=1;can_minimize=1")

View File

@@ -6,6 +6,7 @@
w_class = WEIGHT_CLASS_BULKY
var/upgraded = FALSE // When hit with an upgrade disk, will turn true, allowing it to print the higher tier circuits.
var/can_clone = FALSE // Same for above, but will allow the printer to duplicate a specific assembly.
var/debug = FALSE // If it's upgraded and can clone, even without config settings.
var/current_category = null
var/recycling = FALSE // If an assembly is being emptied into this printer
var/list/program // Currently loaded save, in form of list
@@ -17,6 +18,11 @@
upgraded = TRUE
can_clone = TRUE
/obj/item/device/integrated_circuit_printer/debug //translation: "integrated_circuit_printer/local_server"
name = "debug circuit printer"
debug = TRUE
w_class = WEIGHT_CLASS_TINY
/obj/item/device/integrated_circuit_printer/Initialize()
. = ..()
AddComponent(/datum/component/material_container, list(MAT_METAL), MINERAL_MATERIAL_AMOUNT * 25, TRUE, list(/obj/item/stack, /obj/item/integrated_circuit, /obj/item/device/electronic_assembly))
@@ -92,17 +98,20 @@
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/HTML = "<center><h2>Integrated Circuit Printer</h2></center><br>"
HTML += "Metal: [materials.total_amount]/[materials.max_amount].<br><br>"
if(debug)
HTML += "<center><h3>DEBUG PRINTER -- Infinite materials. Cloning available.</h3></center>"
else
HTML += "Metal: [materials.total_amount]/[materials.max_amount].<br><br>"
if(CONFIG_GET(flag/ic_printing))
if(CONFIG_GET(flag/ic_printing) && !debug)
HTML += "Assembly cloning: [can_clone ? "Available": "Unavailable"].<br>"
HTML += "Circuits available: [upgraded ? "Advanced":"Regular"]."
HTML += "Circuits available: [upgraded || debug ? "Advanced":"Regular"]."
if(!upgraded)
HTML += "<br>Crossed out circuits mean that the printer is not sufficiently upgraded to create that circuit."
HTML += "<hr>"
if(can_clone && CONFIG_GET(flag/ic_printing))
if((can_clone && CONFIG_GET(flag/ic_printing)) || debug)
HTML += "Here you can load script for your assembly.<br>"
HTML += " <A href='?src=[REF(src)];print=load'>{Load Program}</a> "
if(!program)
@@ -160,7 +169,7 @@
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(!materials.use_amount_type(cost, MAT_METAL))
if(!debug && !materials.use_amount_type(cost, MAT_METAL))
to_chat(usr, "<span class='warning'>You need [cost] metal to build that!</span>")
return TRUE
@@ -181,7 +190,7 @@
playsound(src, 'sound/items/jaws_pry.ogg', 50, TRUE)
if(href_list["print"])
if(!CONFIG_GET(flag/ic_printing))
if(!CONFIG_GET(flag/ic_printing) && !debug)
to_chat(usr, "<span class='warning'>CentCom has disabled printing of custom circuitry due to recent allegations of copyright infringement.</span>")
return
if(!can_clone) // Copying and printing ICs is cloning
@@ -226,7 +235,7 @@
to_chat(usr, "<span class='warning'>This program uses components not supported by the specified assembly. Please change the assembly type in the save file to a supported one.</span>")
else
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(materials.use_amount_type(program["metal_cost"], MAT_METAL))
if(debug || materials.use_amount_type(program["metal_cost"], MAT_METAL))
var/obj/item/assembly = SScircuit.load_electronic_assembly(get_turf(src), program)
to_chat(usr, "<span class='notice'>[assembly] has been printed from the provided template!</span>")
playsound(src, 'sound/items/poster_being_created.ogg', 50, TRUE)

View File

@@ -18,7 +18,7 @@
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.
to_chat(user, "<span class='notice'>You press the button labeled '[src]'.</span>")
to_chat(user, "<span class='notice'>You press the button labeled '[displayed_name]'.</span>")
activate_pin(1)
/obj/item/integrated_circuit/input/toggle_button
@@ -36,7 +36,7 @@
set_pin_data(IC_OUTPUT, 1, !get_pin_data(IC_OUTPUT, 1))
push_data()
activate_pin(1)
to_chat(user, "<span class='notice'>You toggle the button labeled '[src]' [get_pin_data(IC_OUTPUT, 1) ? "on" : "off"].</span>")
to_chat(user, "<span class='notice'>You toggle the button labeled '[displayed_name]' [get_pin_data(IC_OUTPUT, 1) ? "on" : "off"].</span>")
/obj/item/integrated_circuit/input/numberpad
name = "number pad"
@@ -51,7 +51,7 @@
power_draw_per_use = 4
/obj/item/integrated_circuit/input/numberpad/ask_for_input(mob/user)
var/new_input = input(user, "Enter a number, please.","Number pad") as null|num
var/new_input = input(user, "Enter a number, please.",displayed_name) as null|num
if(isnum(new_input) && user.IsAdvancedToolUser())
set_pin_data(IC_OUTPUT, 1, new_input)
push_data()
@@ -70,7 +70,7 @@
power_draw_per_use = 4
/obj/item/integrated_circuit/input/textpad/ask_for_input(mob/user)
var/new_input = stripped_input(user, "Enter some words, please.","Text pad")
var/new_input = stripped_input(user, "Enter some words, please.",displayed_name)
if(istext(new_input) && user.IsAdvancedToolUser())
set_pin_data(IC_OUTPUT, 1, new_input)
push_data()

View File

@@ -83,17 +83,6 @@
assembly.set_light(0)
power_draw_idle = light_toggled ? light_brightness * 2 : 0
/obj/item/integrated_circuit/output/light/advanced/update_lighting()
var/new_color = get_pin_data(IC_INPUT, 1)
var/brightness = get_pin_data(IC_INPUT, 2)
if(new_color && isnum(brightness))
brightness = CLAMP(brightness, 0, 6)
light_rgb = new_color
light_brightness = brightness
..()
/obj/item/integrated_circuit/output/light/power_fail() // Turns off the flashlight if there's no power left.
light_toggled = FALSE
update_lighting()
@@ -113,6 +102,17 @@
/obj/item/integrated_circuit/output/light/advanced/on_data_written()
update_lighting()
/obj/item/integrated_circuit/output/light/advanced/update_lighting()
var/new_color = get_pin_data(IC_INPUT, 1)
var/brightness = get_pin_data(IC_INPUT, 2)
if(new_color && isnum(brightness))
brightness = CLAMP(brightness, 0, 6)
light_rgb = new_color
light_brightness = brightness
..()
/obj/item/integrated_circuit/output/sound
name = "speaker circuit"
desc = "A miniature speaker is attached to this component."

View File

@@ -193,7 +193,7 @@
activate_pin(3)
return
var/tramount = CLAMP(transfer_amount, 0, AM.reagents.total_volume)
var/tramount = abs(transfer_amount)
if(isliving(AM))
var/mob/living/L = AM
@@ -202,13 +202,15 @@
busy = TRUE
if(do_atom(src, L, extra_checks=CALLBACK(L, /mob/living/proc/can_inject,null,0)))
if(L.transfer_blood_to(src, tramount))
L.visible_message("[acting_object] takes a blood sample from [L].")
L.visible_message("<span class='danger'>[acting_object] takes a blood sample from [L]!</span>", \
"<span class='userdanger'>[acting_object] takes a blood sample from you!</span>")
else
busy = FALSE
activate_pin(3)
return
busy = FALSE
else
tramount = min(tramount, AM.reagents.total_volume)
if(!AM.reagents.total_volume)
activate_pin(3)
return