Adds sounds and some small QoL improvements to the circuit imprinter, and allows them to recycle empty assemblies (#35131)

🆑 Xhuis
tweak: Removing and printing integrated circuits will now attempt to place them into a free hand.
tweak: You can now hit an integrated circuit printer with an unsecured electronic assembly to recycle all of the parts in the assembly en masse.
tweak: You can now recycle empty electronic assemblies in an integrated circuit printer!
soundadd: Integrated circuit printers now have sounds for printing circuits and assemblies.
/🆑

Some low-hanging fruit for circuits. I was trying them earlier, and these were the main things that I was surprised didn't exist, so I added them. I'm not sure about the assembly manipulation yet (may have been intentional?) but it feels a lot smoother to use, especially since misprints can be emptied out and then recycled instead of awkwardly removing each component and then disposing of the case.
This commit is contained in:
Ashe Higgs
2018-02-15 15:45:40 -05:00
committed by CitadelStationBot
parent 1cda9ef2b4
commit dc100371f3
4 changed files with 59 additions and 11 deletions
@@ -250,19 +250,23 @@
assembly_components |= component
/obj/item/device/electronic_assembly/proc/try_remove_component(obj/item/integrated_circuit/IC, mob/user)
/obj/item/device/electronic_assembly/proc/try_remove_component(obj/item/integrated_circuit/IC, mob/user, silent)
if(!opened)
to_chat(user, "<span class='warning'>[src]'s hatch is closed, so you can't fiddle with the internal components.</span>")
if(!silent)
to_chat(user, "<span class='warning'>[src]'s hatch is closed, so you can't fiddle with the internal components.</span>")
return FALSE
if(!IC.removable)
to_chat(user, "<span class='warning'>[src] is permanently attached to the case.</span>")
if(!silent)
to_chat(user, "<span class='warning'>[src] is permanently attached to the case.</span>")
return FALSE
to_chat(user, "<span class='notice'>You pop \the [src] out of the case, and slide it out.</span>")
playsound(src, 'sound/items/Crowbar.ogg', 50, 1)
remove_component(IC)
if(!silent)
to_chat(user, "<span class='notice'>You pop \the [IC] out of the case, and slide it out.</span>")
playsound(src, 'sound/items/crowbar.ogg', 50, 1)
user.put_in_hands(IC)
return TRUE
// Actually removes the component, doesn't perform any checks.
@@ -7,6 +7,7 @@
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/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
/obj/item/device/integrated_circuit_printer/proc/check_interactivity(mob/user)
@@ -18,9 +19,9 @@
/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))
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))
/obj/item/device/integrated_circuit_printer/attackby(var/obj/item/O, var/mob/user)
/obj/item/device/integrated_circuit_printer/attackby(obj/item/O, mob/user)
if(istype(O, /obj/item/disk/integrated_circuit/upgrade/advanced))
if(upgraded)
to_chat(user, "<span class='warning'>\The [src] already has this upgrade. </span>")
@@ -41,9 +42,47 @@
interact(user)
return TRUE
if(istype(O, /obj/item/device/electronic_assembly))
var/obj/item/device/electronic_assembly/EA = O //microtransactions not included
if(EA.assembly_components.len)
if(recycling)
return
if(!EA.opened)
to_chat(user, "<span class='warning'>You can't reach [EA]'s components to remove them!</span>")
return
if(EA.battery)
to_chat(user, "<span class='warning'>Remove [EA]'s power cell first!</span>")
return
for(var/V in EA.assembly_components)
var/obj/item/integrated_circuit/IC = V
if(!IC.removable)
to_chat(user, "<span class='warning'>[EA] has irremovable components in the casing, preventing you from emptying it.</span>")
return
to_chat(user, "<span class='notice'>You begin recycling [EA]'s components...</span>")
playsound(src, 'sound/items/electronic_assembly_emptying.ogg', 50, TRUE)
if(!do_after(user, 30, target = src)) //short channel so you don't accidentally start emptying out a complex assembly
return
recycling = TRUE
var/datum/component/material_container/mats = GetComponent(/datum/component/material_container)
for(var/V in EA.assembly_components)
var/obj/item/integrated_circuit/IC = V
if(!mats.has_space(mats.get_item_material_amount(IC)))
to_chat(user, "<span class='notice'>[src] can't hold any more materials!</span>")
break
if(!do_after(user, 5, target = user))
recycling = FALSE
return
playsound(src, 'sound/items/crowbar.ogg', 50, TRUE)
if(EA.try_remove_component(IC, user, TRUE))
mats.user_insert(IC, user)
to_chat(user, "<span class='notice'>You recycle all the components[EA.assembly_components.len ? " you could " : " "]from [EA]!</span>")
playsound(src, 'sound/items/electronic_assembly_empty.ogg', 50, TRUE)
recycling = FALSE
return TRUE
return ..()
/obj/item/device/integrated_circuit_printer/attack_self(var/mob/user)
/obj/item/device/integrated_circuit_printer/attack_self(mob/user)
interact(user)
/obj/item/device/integrated_circuit_printer/interact(mob/user)
@@ -126,12 +165,16 @@
return TRUE
var/obj/item/built = new build_type(drop_location())
usr.put_in_hands(built)
if(istype(built, /obj/item/device/electronic_assembly))
var/obj/item/device/electronic_assembly/E = built
E.opened = TRUE
E.update_icon()
to_chat(usr, "<span class='notice'>[capitalize(built.name)] printed.</span>")
playsound(src, 'sound/items/jaws_pry.ogg', 50, TRUE)
if(href_list["print"])
if(!CONFIG_GET(flag/ic_printing))
to_chat(usr, "<span class='warning'>CentCom has disabled printing of custom circuitry due to recent allegations of copyright infringement.</span>")
@@ -175,8 +218,9 @@
else
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(materials.use_amount_type(program["metal_cost"], MAT_METAL))
SScircuit.load_electronic_assembly(get_turf(src), program)
to_chat(usr, "<span class='notice'>Assembly has been printed.</span>")
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)
else
to_chat(usr, "<span class='warning'>You need [program["metal_cost"]] metal to build that!</span>")