mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-15 18:14:22 +01:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user