diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm
index 7f66045a81..c1c755251d 100644
--- a/code/game/machinery/defibrillator_mount.dm
+++ b/code/game/machinery/defibrillator_mount.dm
@@ -11,7 +11,6 @@
use_power = IDLE_POWER_USE
idle_power_usage = 1
power_channel = EQUIP
- speed_process = TRUE //GAS GAS GAS
req_one_access = list(ACCESS_MEDICAL, ACCESS_HEADS, ACCESS_SECURITY) //used to control clamps
var/obj/item/defibrillator/defib //this mount's defibrillator
var/clamps_locked = FALSE //if true, and a defib is loaded, it can't be removed without unlocking the clamps
@@ -35,16 +34,11 @@
to_chat(user, "Its locking clamps can be [clamps_locked ? "dis" : ""]engaged by swiping an ID with access.")
/obj/machinery/defibrillator_mount/process()
- if(defib && defib.cell && defib.cell.charge < defib.cell.maxcharge)
- use_power(20)
- defib.cell.give(18) //90% efficiency, slightly better than the cell charger's 87.5%
- if(defib && defib.paddles && isliving(defib.paddles.loc))
- var/mob/living/L = defib.paddles.loc
- if(!L.Adjacent(src))
- to_chat(L, "[defib]'s paddles overextend and come out of your hands!")
- L.dropItemToGround(defib.paddles)
- update_icon()
-
+ if(defib && defib.cell && defib.cell.charge < defib.cell.maxcharge && is_operational())
+ use_power(200)
+ defib.cell.give(180) //90% efficiency, slightly better than the cell charger's 87.5%
+ update_icon()
+
/obj/machinery/defibrillator_mount/update_icon()
cut_overlays()
if(defib)
diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index d4e59c8542..b82a1b34ba 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -292,6 +292,30 @@
var/grab_ghost = FALSE
var/tlimit = DEFIB_TIME_LIMIT * 10
+ var/datum/component/mobhook
+
+/obj/item/twohanded/shockpaddles/equipped(mob/user, slot)
+ . = ..()
+ if(req_defib)
+ if (mobhook && mobhook.parent != user)
+ QDEL_NULL(mobhook)
+ if (!mobhook)
+ mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED), CALLBACK(src, .proc/check_range))
+
+/obj/item/twohanded/shockpaddles/Moved()
+ . = ..()
+ check_range()
+
+/obj/item/twohanded/shockpaddles/proc/check_range()
+ if(!in_range(src,defib))
+ var/mob/living/L = loc
+ if(istype(L))
+ to_chat(L, "[defib]'s paddles overextend and come out of your hands!")
+ L.temporarilyRemoveItemFromInventory(src,TRUE)
+ else
+ visible_message("[src] snap back into [defib].")
+ snap_back()
+
/obj/item/twohanded/shockpaddles/proc/recharge(var/time)
if(req_defib || !time)
return
@@ -331,16 +355,23 @@
/obj/item/twohanded/shockpaddles/dropped(mob/user)
if(!req_defib)
return ..()
+ if (mobhook)
+ QDEL_NULL(mobhook)
if(user)
var/obj/item/twohanded/offhand/O = user.get_inactive_held_item()
if(istype(O))
O.unwield()
to_chat(user, "The paddles snap back into the main unit.")
- defib.on = 0
- forceMove(defib)
- defib.update_icon()
+ snap_back()
return unwield(user)
+/obj/item/twohanded/shockpaddles/proc/snap_back()
+ if(!defib)
+ return
+ defib.on = FALSE
+ forceMove(defib)
+ defib.update_icon()
+
/obj/item/twohanded/shockpaddles/proc/check_defib_exists(mainunit, mob/living/carbon/M, obj/O)
if(!req_defib)
return TRUE //If it doesn't need a defib, just say it exists