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

🆑
fix: fixes circuit gun not recharging it's internal cell when an
integrated circuit is inserted
/🆑
This commit is contained in:
tonyhawq
2025-08-11 11:18:53 -07:00
committed by nevimer
parent 156b6e762c
commit d9cf82b14d
+15 -1
View File
@@ -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
*/