From cf2a4380f6bc9ec252784e3c5448ca81053e23fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ev=D0=B0n=20Summers?= Date: Sun, 13 Aug 2023 03:51:22 +1000 Subject: [PATCH] Fix: stop magic staff recharging while already at max charge (#21692) * Fix for staffs recharging while at max charge * Update code/modules/projectiles/guns/magic.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> * Update code/modules/projectiles/guns/magic.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> * Update code/modules/projectiles/guns/magic.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> * Update code/modules/projectiles/guns/magic.dm Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> --------- Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com> --- code/modules/projectiles/guns/magic.dm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/code/modules/projectiles/guns/magic.dm b/code/modules/projectiles/guns/magic.dm index b4f9fa404e3..63dbcf271c8 100644 --- a/code/modules/projectiles/guns/magic.dm +++ b/code/modules/projectiles/guns/magic.dm @@ -65,12 +65,18 @@ /obj/item/gun/magic/process() + // Don't start recharging until we lose a charge + if(charges >= max_charges) + charge_tick = 0 + return FALSE + charge_tick++ - if(charge_tick < recharge_rate || charges >= max_charges) - return 0 - charge_tick = 0 - charges++ - return 1 + if(charge_tick >= recharge_rate) + charge_tick = 0 + charges++ + return TRUE + else + return FALSE /obj/item/gun/magic/update_icon_state() return