diff --git a/code/game/objects/items/devices/handheld_defib.dm b/code/game/objects/items/devices/handheld_defib.dm
index a2d23f6f8a9..29e349b34b0 100644
--- a/code/game/objects/items/devices/handheld_defib.dm
+++ b/code/game/objects/items/devices/handheld_defib.dm
@@ -9,8 +9,14 @@
belt_icon = "defib"
var/icon_base = "defib"
+ ///Can the defib shock yet?
var/cooldown = FALSE
- var/charge_time = 100
+ ///How long will it take to recharge after a shock?
+ var/charge_time = 10 SECONDS
+ ///How long until we can attack the same person with any emagged handheld defib or baton again?
+ var/attack_cooldown = 3.5 SECONDS
+ ///How long does this knock the target down for?
+ var/knockdown_duration = 10 SECONDS
/obj/item/handheld_defibrillator/emag_act(mob/user)
if(!emagged)
@@ -32,7 +38,26 @@
to_chat(user, "[src] is still charging!")
return
- if(emagged || (H.health <= HEALTH_THRESHOLD_CRIT) || (H.undergoing_cardiac_arrest()))
+ if(emagged)
+ var/user_UID = user.UID()
+ if(HAS_TRAIT_FROM(H, TRAIT_WAS_BATONNED, user_UID)) // no following up with baton or dual wielding defibs for stunlock cheese purposes
+ return
+
+ user.visible_message("[user] violently shocks [H] with [src]!", "You violently shock [H] with [src]!")
+ add_attack_logs(user, H, "emag-defibbed with [src]")
+ playsound(user.loc, "sound/weapons/Egloves.ogg", 75, 1)
+ H.KnockDown(knockdown_duration)
+ H.adjustStaminaLoss(60)
+ SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
+ ADD_TRAIT(H, TRAIT_WAS_BATONNED, user_UID)
+ cooldown = TRUE
+ icon_state = "[icon_base]-shock"
+ addtimer(CALLBACK(src, .proc/allowhit, H, user_UID), attack_cooldown)
+ addtimer(CALLBACK(src, .proc/short_charge), 1 SECONDS)
+ addtimer(CALLBACK(src, .proc/recharge), charge_time)
+ return
+
+ if((H.health <= HEALTH_THRESHOLD_CRIT) || (H.undergoing_cardiac_arrest()))
user.visible_message("[user] shocks [H] with [src].", "You shock [H] with [src].")
add_attack_logs(user, H, "defibrillated with [src]")
playsound(user.loc, "sound/weapons/Egloves.ogg", 75, 1)
@@ -57,18 +82,17 @@
to_chat(H, "You feel a powerful jolt!")
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
- if(emagged && prob(10))
- to_chat(user, "[src]'s on board scanner indicates that the target is undergoing a cardiac arrest!")
- H.set_heartattack(TRUE)
-
cooldown = TRUE
icon_state = "[icon_base]-shock"
- addtimer(CALLBACK(src, .proc/short_charge), 10)
+ addtimer(CALLBACK(src, .proc/short_charge), 1 SECONDS)
addtimer(CALLBACK(src, .proc/recharge), charge_time)
else
to_chat(user, "[src]'s on board medical scanner indicates that no shock is required.")
+/obj/item/handheld_defibrillator/proc/allowhit(mob/living/target, user_UID)
+ REMOVE_TRAIT(target, TRAIT_WAS_BATONNED, user_UID)
+
/obj/item/handheld_defibrillator/proc/short_charge()
icon_state = "[icon_base]-off"
diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm
index 9e8ac3f1f38..f581cd50ecd 100644
--- a/code/game/objects/items/weapons/defib.dm
+++ b/code/game/objects/items/weapons/defib.dm
@@ -373,11 +373,11 @@
busy = TRUE
H.visible_message("[user] has touched [H.name] with [src]!", \
"[user] has touched [H.name] with [src]!")
- H.adjustStaminaLoss(50)
- H.Weaken(10 SECONDS)
+ H.adjustStaminaLoss(60)
+ H.KnockDown(10 SECONDS)
playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
H.emote("gasp")
- if(!H.undergoing_cardiac_arrest() && (prob(10) || (defib.combat && defib.heart_attack) || prob(10) && (defib.combat))) // If the victim is not having a heart attack, and a 10% chance passes, or the defib has heart attack variable to TRUE while being a combat defib, or if another 10% chance passes with combat being TRUE
+ if((defib.combat && defib.heart_attack) || prob(10) && (defib.combat)) // If the victim is not having a heart attack, and a 10% chance passes, or the defib has heart attack variable to TRUE while being a combat defib, or if another 10% chance passes with combat being TRUE
H.set_heartattack(TRUE)
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK, 100)
add_attack_logs(user, M, "Stunned with [src]")