From 4a30ee038c2f7c8d3b5813eeb8b14cf39ac46446 Mon Sep 17 00:00:00 2001 From: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Date: Sat, 17 Jul 2021 12:00:17 +0100 Subject: [PATCH] Allows charging batteries of integrated circuits with inducers and allows scanning ids on unregistered circuits through shells. (#60227) Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com> --- code/datums/components/shell.dm | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/code/datums/components/shell.dm b/code/datums/components/shell.dm index 9e064ef3852..9633575f583 100644 --- a/code/datums/components/shell.dm +++ b/code/datums/components/shell.dm @@ -97,17 +97,28 @@ /datum/component/shell/proc/on_attack_by(atom/source, obj/item/item, mob/living/attacker) SIGNAL_HANDLER if(istype(item, /obj/item/stock_parts/cell)) - source.balloon_alert(attacker, "can't pull cell in directly!") + source.balloon_alert(attacker, "can't put cell in directly!") return - if(attached_circuit?.owner_id && item == attached_circuit.owner_id.resolve()) - set_locked(!locked) - source.balloon_alert(attacker, "[locked? "locked" : "unlocked"] [source]") + if(istype(item, /obj/item/inducer)) + var/obj/item/inducer/inducer = item + INVOKE_ASYNC(inducer, /obj/item.proc/attack_obj, attached_circuit, attacker, list()) return COMPONENT_NO_AFTERATTACK - if(attached_circuit && istype(item, /obj/item/circuit_component)) - attached_circuit.add_component_manually(item, attacker) - return + if(attached_circuit) + if(attached_circuit.owner_id && item == attached_circuit.owner_id.resolve()) + set_locked(!locked) + source.balloon_alert(attacker, "[locked? "locked" : "unlocked"] [source]") + return COMPONENT_NO_AFTERATTACK + + if(!attached_circuit.owner_id && istype(item, /obj/item/card/id)) + source.balloon_alert(attacker, "owner id set for [item]") + attached_circuit.owner_id = WEAKREF(item) + return COMPONENT_NO_AFTERATTACK + + if(istype(item, /obj/item/circuit_component)) + attached_circuit.add_component_manually(item, attacker) + return if(!istype(item, /obj/item/integrated_circuit)) return