Integrated circuits can be recycled and charged in rechargers (#23004)

Also generalizes autolathe recycling so that other containers can alt
click it to be recycled. Currently its still only circuits and the part
exchanger.

changes:
- qol: "Integrated circuit assemblies can now be recycled in autolathes.
They can't be recycled in the printer, because clicking the printer with
the circuit is required to scan it for cloning."
  - qol: "Integrated circuits can now be charged in rechargers."



https://github.com/user-attachments/assets/1b8325a8-aca0-4df0-a2a3-763eb8cec989
This commit is contained in:
FenodyreeAv
2026-08-13 16:25:05 +00:00
committed by GitHub
parent f604244197
commit 038abdc905
7 changed files with 43 additions and 10 deletions
@@ -11,6 +11,8 @@
icon_state = "setup_small"
item_flags = ITEM_FLAG_NO_BLUDGEON
light_system = MOVABLE_LIGHT
recyclable = FALSE
charge_failure_message = " is missing a powercell."
var/max_components = IC_COMPONENTS_BASE
var/max_complexity = IC_COMPLEXITY_BASE
@@ -42,6 +44,8 @@
battery = new /obj/item/cell/device(src)
START_PROCESSING(SSelectronics, src)
access_card = new /obj/item/card/id(src)
if (!matter) //Matter amounts might be set during the cloning process.
matter = list(MATERIAL_STEEL = (round((max_complexity + max_components) / 4)) * 200)
/obj/item/electronic_assembly/Destroy()
QDEL_NULL(battery)
@@ -100,6 +104,10 @@
var/list/HTML = list()
var/effective_component_limit = get_effective_component_limit(total_complexity)
var/effective_complexity_limit = get_effective_complexity_limit(total_parts)
if (!total_parts && !total_complexity)
recyclable = TRUE
else
recyclable = FALSE
HTML += "<br><a href='byond://?src=[REF(src)]'>Refresh</a> | "
HTML += "<a href='byond://?src=[REF(src)];rename=1'>Rename</a><br>"
@@ -256,7 +264,7 @@
return FALSE
IC.assembly = src
recyclable = FALSE
return TRUE
// Non-interactive version of above that always succeeds, intended for build-in circuits that get added on assembly initialization.
@@ -374,6 +382,11 @@
for(var/atom/movable/AM in contents)
AM.emp_act(severity)
/obj/item/electronic_assembly/get_cell()
if(battery)
return battery
return DEVICE_NO_CELL
// Returns true if power was successfully drawn.
/obj/item/electronic_assembly/proc/draw_power(amount)
if(battery && battery.checked_use(amount * CELLRATE))
@@ -24,6 +24,11 @@ a creative player the means to solve many problems. Circuits are held inside an
setup_io(inputs, /datum/integrated_io, inputs_default)
setup_io(outputs, /datum/integrated_io, outputs_default)
setup_io(activators, /datum/integrated_io/activate)
var/phoron_matter = initial(phoron_cost) * 2000
var/steel_matter = max(1, w_class) * 200
if(phoron_matter || steel_matter)
matter = list(MATERIAL_STEEL = steel_matter, MATERIAL_PHORON = phoron_matter)
recyclable = TRUE
. = ..()
/obj/item/integrated_circuit/proc/on_data_written() //Override this for special behaviour when new data gets pushed to the circuit.
@@ -618,6 +618,7 @@
to_chat(user, SPAN_WARNING("\The [src] fails to finish the cloned assembly."))
return
new_clone.recyclable = FALSE //A cloned circuit will have components in it.
if(user)
to_chat(user, SPAN_NOTICE("\The [src] finishes printing \the [new_clone]."))
@@ -629,7 +630,6 @@
var/obj/item/integrated_circuit/IC = circuit_type
return max(0, initial(IC.phoron_cost) * phoron_per_sheet)
/obj/item/integrated_circuit_printer/proc/get_clone_metal_cost(obj/item/electronic_assembly/source)
if(!source)
return 0