[MIRROR] Circuit components can now be recycles in circuit printers, and automatically do so upon being removed if a circuit has a linked printer (#29316)

* Circuit components can now be recycles in circuit printers, and automatically do so upon being removed if a circuit has a linked printer (#85648)

## About The Pull Request

Added support for remote material insertion type whitelists and utilized
it to allow circuit printers to recycle components. Removing a component
from UI while the circuit has a linked printer will automatically
recycle it.

Also fixed a rogue space appearing when recycling a single item

## Why It's Good For The Game

You literally cannot do anything with components you remove/do not need
anymore so usually they end up littering circuit lab's floors. This
should make developing circuits slightly less annoying.

## Changelog
🆑
qol: Circuit components can now be recycles in circuit printers, and
automatically do so upon being removed if a circuit has a linked printer
spellcheck: Recycling a single item no longer outputs a line with a
rogue space infront of it
/🆑

* Circuit components can now be recycles in circuit printers, and automatically do so upon being removed if a circuit has a linked printer

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-08-15 17:26:22 +02:00
committed by GitHub
parent 25f58899d7
commit 45d85d569d
6 changed files with 19 additions and 8 deletions
+1
View File
@@ -14,6 +14,7 @@
inhand_icon_state = "electronic"
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
custom_materials = list(/datum/material/glass = HALF_SHEET_MATERIAL_AMOUNT)
/// The name of the component shown on the UI
var/display_name = "Generic"
@@ -22,7 +22,7 @@
/obj/machinery/component_printer/Initialize(mapload)
. = ..()
materials = AddComponent(/datum/component/remote_materials, mapload)
materials = AddComponent(/datum/component/remote_materials, mapload, whitelist_typecache = typecacheof(/obj/item/circuit_component))
/obj/machinery/component_printer/post_machine_initialize()
. = ..()
@@ -509,6 +509,9 @@ GLOBAL_LIST_EMPTY_TYPED(integrated_circuits, /obj/item/integrated_circuit)
remove_component(component)
if(component.loc == src)
usr.put_in_hands(component)
var/obj/machinery/component_printer/printer = linked_component_printer?.resolve()
if (!isnull(printer))
printer.attackby(component, usr)
. = TRUE
if("set_component_coordinates")
var/component_id = text2num(params["component_id"])