From d9cf82b14dd35973d7a87433d64f847f37e4aee5 Mon Sep 17 00:00:00 2001 From: tonyhawq <119907639+tonyhawq@users.noreply.github.com> Date: Mon, 11 Aug 2025 11:18:53 -0700 Subject: [PATCH] Fixes circuit gun recharging issue (#92483) ## About The Pull Request This is a pull request which fixes issue #92227. ## Why It's Good For The Game Closes #92227 which makes circuit guns more confusing than they should be ## Changelog :cl: fix: fixes circuit gun not recharging it's internal cell when an integrated circuit is inserted /:cl: --- code/modules/wiremod/shell/gun.dm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/code/modules/wiremod/shell/gun.dm b/code/modules/wiremod/shell/gun.dm index 9bfa8764f41..6e9043a146a 100644 --- a/code/modules/wiremod/shell/gun.dm +++ b/code/modules/wiremod/shell/gun.dm @@ -34,10 +34,12 @@ /obj/item/gun/energy/wiremod_gun/Initialize(mapload) . = ..() - AddComponent(/datum/component/shell, list( + var/datum/component/shell/shell = AddComponent(/datum/component/shell, list( new /obj/item/circuit_component/wiremod_gun() ), SHELL_CAPACITY_MEDIUM) + RegisterSignal(shell, COMSIG_SHELL_CIRCUIT_ATTACHED, PROC_REF(on_circuit_attached)) + /obj/item/circuit_component/wiremod_gun display_name = "Gun" desc = "Used to receive entities hit by projectiles from a gun." @@ -62,6 +64,18 @@ /obj/item/circuit_component/wiremod_gun/unregister_shell(atom/movable/shell) UnregisterSignal(shell, list(COMSIG_PROJECTILE_ON_HIT, COMSIG_GUN_CHAMBER_PROCESSED)) +/obj/item/gun/energy/wiremod_gun/proc/on_circuit_attached(datum/component/shell/source) + SIGNAL_HANDLER + + if (istype(source, /datum/component/shell)) + var/datum/component/shell/comp = source + var/obj/item/integrated_circuit/circuit = comp.attached_circuit + if (!circuit.cell) + return + var/transferred = src.cell.give(min(0.1 * STANDARD_CELL_CHARGE, circuit.cell.charge)) + if (transferred) + circuit.cell.use(transferred, force=TRUE) + /** * Called when the shell item shoots something */