diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index 358ffd3e10..ec1e81f92f 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -18,11 +18,11 @@
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 50)
var/on = FALSE //if the paddles are equipped (1) or on the defib (0)
- var/safety = 1 //if you can zap people with the defibs on harm mode
- var/powered = 0 //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
+ var/safety = TRUE //if you can zap people with the defibs on harm mode
+ var/powered = FALSE //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
var/obj/item/twohanded/shockpaddles/paddles
var/obj/item/stock_parts/cell/high/cell
- var/combat = 0 //can we revive through space suits?
+ var/combat = FALSE //can we revive through space suits?
var/grab_ghost = FALSE // Do we pull the ghost back into their body?
/obj/item/defibrillator/get_cell()
@@ -49,11 +49,11 @@
/obj/item/defibrillator/proc/update_power()
if(cell)
if(cell.charge < paddles.revivecost)
- powered = 0
+ powered = FALSE
else
powered = 1
else
- powered = 0
+ powered = FALSE
/obj/item/defibrillator/proc/update_overlays()
cut_overlays()
@@ -98,8 +98,8 @@
..()
/obj/item/defibrillator/MouseDrop(obj/over_object)
- if(ismob(src.loc))
- var/mob/M = src.loc
+ if(ismob(loc))
+ var/mob/M = loc
if(!M.incapacitated() && istype(over_object, /obj/screen/inventory/hand))
var/obj/screen/inventory/hand/H = over_object
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
@@ -134,23 +134,23 @@
/obj/item/defibrillator/emag_act(mob/user)
if(safety)
- safety = 0
+ safety = FALSE
to_chat(user, "You silently disable [src]'s safety protocols with the cryptographic sequencer.")
else
- safety = 1
+ safety = TRUE
to_chat(user, "You silently enable [src]'s safety protocols with the cryptographic sequencer.")
/obj/item/defibrillator/emp_act(severity)
if(cell)
deductcharge(1000 / severity)
if(safety)
- safety = 0
- src.visible_message("[src] beeps: Safety protocols disabled!")
- playsound(get_turf(src), 'sound/machines/defib_saftyOff.ogg', 50, 0)
+ safety = FALSE
+ visible_message("[src] beeps: Safety protocols disabled!")
+ playsound(src, 'sound/machines/defib_saftyOff.ogg', 50, 0)
else
- safety = 1
- src.visible_message("[src] beeps: Safety protocols enabled!")
- playsound(get_turf(src), 'sound/machines/defib_saftyOn.ogg', 50, 0)
+ safety = TRUE
+ visible_message("[src] beeps: Safety protocols enabled!")
+ playsound(src, 'sound/machines/defib_saftyOn.ogg', 50, 0)
update_icon()
..()
@@ -167,7 +167,7 @@
to_chat(user, "You need a free hand to hold the paddles!")
update_icon()
return
- paddles.loc = user
+ paddles.forceMove(user)
else
//Remove from their hands and back onto the defib unit
paddles.unwield()
@@ -207,25 +207,25 @@
/obj/item/defibrillator/proc/deductcharge(chrgdeductamt)
if(cell)
if(cell.charge < (paddles.revivecost+chrgdeductamt))
- powered = 0
+ powered = FALSE
update_icon()
if(cell.use(chrgdeductamt))
update_icon()
- return 1
+ return TRUE
else
update_icon()
- return 0
+ return FALSE
/obj/item/defibrillator/proc/cooldowncheck(mob/user)
spawn(50)
if(cell)
if(cell.charge >= paddles.revivecost)
user.visible_message("[src] beeps: Unit ready.")
- playsound(get_turf(src), 'sound/machines/defib_ready.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_ready.ogg', 50, 0)
else
user.visible_message("[src] beeps: Charge depleted.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
- paddles.cooldown = 0
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
+ paddles.cooldown = FALSE
paddles.update_icon()
update_icon()
@@ -240,7 +240,7 @@
/obj/item/defibrillator/compact/item_action_slot_check(slot, mob/user)
if(slot == user.getBeltSlot())
- return 1
+ return TRUE
/obj/item/defibrillator/compact/loaded/Initialize()
. = ..()
@@ -251,8 +251,8 @@
/obj/item/defibrillator/compact/combat
name = "combat defibrillator"
desc = "A belt-equipped blood-red defibrillator that can be rapidly deployed. Does not have the restrictions or safeties of conventional defibrillators and can revive through space suits."
- combat = 1
- safety = 0
+ combat = TRUE
+ safety = FALSE
/obj/item/defibrillator/compact/combat/loaded/Initialize()
. = ..()
@@ -280,24 +280,24 @@
w_class = WEIGHT_CLASS_BULKY
var/revivecost = 1000
- var/cooldown = 0
+ var/cooldown = FALSE
var/busy = FALSE
var/obj/item/defibrillator/defib
- var/req_defib = 1
- var/combat = 0 //If it penetrates armor and gives additional functionality
+ var/req_defib = TRUE
+ var/combat = FALSE //If it penetrates armor and gives additional functionality
var/grab_ghost = FALSE
var/tlimit = DEFIB_TIME_LIMIT * 10
/obj/item/twohanded/shockpaddles/proc/recharge(var/time)
if(req_defib || !time)
return
- cooldown = 1
+ cooldown = TRUE
update_icon()
sleep(time)
var/turf/T = get_turf(src)
T.audible_message("[src] beeps: Unit is recharged.")
- playsound(T, 'sound/machines/defib_ready.ogg', 50, 0)
- cooldown = 0
+ playsound(src, 'sound/machines/defib_ready.ogg', 50, 0)
+ cooldown = FALSE
update_icon()
/obj/item/twohanded/shockpaddles/New(mainunit)
@@ -318,7 +318,7 @@
user.visible_message("[user] is putting the live paddles on [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!")
if(req_defib)
defib.deductcharge(revivecost)
- playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
+ playsound(src, 'sound/machines/defib_zap.ogg', 50, 1, -1)
return (OXYLOSS)
/obj/item/twohanded/shockpaddles/dropped(mob/user)
@@ -336,12 +336,12 @@
/obj/item/twohanded/shockpaddles/proc/check_defib_exists(mainunit, mob/living/carbon/human/M, obj/O)
if(!req_defib)
- return 1 //If it doesn't need a defib, just say it exists
+ return TRUE //If it doesn't need a defib, just say it exists
if (!mainunit || !istype(mainunit, /obj/item/defibrillator)) //To avoid weird issues from admin spawns
qdel(O)
- return 0
+ return FALSE
else
- return 1
+ return TRUE
/obj/item/twohanded/shockpaddles/attack(mob/M, mob/user)
@@ -349,7 +349,7 @@
return
if(req_defib && !defib.powered)
user.visible_message("[defib] beeps: Unit is unpowered.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
return
if(!wielded)
if(iscyborg(user))
@@ -397,6 +397,13 @@
var/obj/item/organ/brain/BR = H.getorgan(/obj/item/organ/brain)
return (!H.suiciding && !(H.disabilities & NOCLONE) && !H.hellbound && ((world.time - H.timeofdeath) < tlimit) && (H.getBruteLoss() < 180) && (H.getFireLoss() < 180) && H.getorgan(/obj/item/organ/heart) && BR && !BR.damaged_brain)
+/obj/item/twohanded/shockpaddles/proc/shock_touching(dmg, mob/H)
+ if(isliving(H.pulledby)) //CLEAR!
+ var/mob/living/M = H.pulledby
+ if(M.electrocute_act(30, src))
+ M.visible_message("[M] is electrocuted by their contact with [H]!")
+ M.emote("scream")
+
/obj/item/twohanded/shockpaddles/proc/do_disarm(mob/living/M, mob/living/user)
if(req_defib && defib.safety)
return
@@ -408,12 +415,12 @@
M.adjustStaminaLoss(50)
M.Knockdown(100)
M.updatehealth() //forces health update before next life tick
- playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
+ playsound(src, 'sound/machines/defib_zap.ogg', 50, 1, -1)
M.emote("gasp")
add_logs(user, M, "stunned", src)
if(req_defib)
defib.deductcharge(revivecost)
- cooldown = 1
+ cooldown = TRUE
busy = FALSE
update_icon()
if(req_defib)
@@ -434,7 +441,7 @@
user.visible_message("[user] places [src] on [H]'s chest.",
"You place [src] on [H]'s chest and begin to charge them.")
var/turf/T = get_turf(defib)
- playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_charge.ogg', 50, 0)
if(req_defib)
T.audible_message("\The [defib] lets out an urgent beep and lets out a steadily rising hum...")
else
@@ -446,14 +453,15 @@
return
if(H && H.stat == DEAD)
to_chat(user, "[H] is dead.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
busy = FALSE
update_icon()
return
user.visible_message("[user] shocks [H] with \the [src]!", "You shock [H] with \the [src]!")
- playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 100, 1, -1)
- playsound(loc, 'sound/weapons/egloves.ogg', 100, 1, -1)
+ playsound(src, 'sound/machines/defib_zap.ogg', 100, 1, -1)
+ playsound(src, 'sound/weapons/egloves.ogg', 100, 1, -1)
H.emote("scream")
+ shock_touching(45, H)
if(H.can_heartattack() && !H.undergoing_cardiac_arrest())
if(!H.stat)
H.visible_message("[H] thrashes wildly, clutching at their chest!",
@@ -465,7 +473,7 @@
H.Jitter(100)
if(req_defib)
defib.deductcharge(revivecost)
- cooldown = 1
+ cooldown = TRUE
busy = FALSE
update_icon()
if(!req_defib)
@@ -481,7 +489,7 @@
update_icon()
if(do_after(user, 30, target = H)) //beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
user.visible_message("[user] places [src] on [H]'s chest.", "You place [src] on [H]'s chest.")
- playsound(get_turf(src), 'sound/machines/defib_charge.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_charge.ogg', 75, 0)
var/tplus = world.time - H.timeofdeath
// past this much time the patient is unrecoverable
// (in deciseconds)
@@ -493,20 +501,20 @@
if(do_after(user, 20, target = H)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
for(var/obj/item/carried_item in H.contents)
if(istype(carried_item, /obj/item/clothing/suit/space))
- if((!src.combat && !req_defib) || (req_defib && !defib.combat))
+ if((!combat && !req_defib) || (req_defib && !defib.combat))
user.audible_message("[req_defib ? "[defib]" : "[src]"] buzzes: Patient's chest is obscured. Operation aborted.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
busy = FALSE
update_icon()
return
if(H.stat == DEAD)
H.visible_message("[H]'s body convulses a bit.")
- playsound(get_turf(src), "bodyfall", 50, 1)
- playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
+ playsound(src, "bodyfall", 50, 1)
+ playsound(src, 'sound/machines/defib_zap.ogg', 75, 1, -1)
total_brute = H.getBruteLoss()
total_burn = H.getFireLoss()
-
- var/failed = null
+ shock_touching(30, H)
+ var/failed
if (H.suiciding || (H.disabilities & NOCLONE))
failed = "[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed - Recovery of patient impossible. Further attempts futile."
@@ -527,7 +535,7 @@
if(failed)
user.visible_message(failed)
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
else
//If the body has been fixed so that they would not be in crit when defibbed, give them oxyloss to put them back into crit
if (H.health > HALFWAYCRITDEATH)
@@ -541,7 +549,7 @@
H.adjustBruteLoss((mobhealth - HALFWAYCRITDEATH) * (total_brute / overall_damage), 0)
H.updatehealth() // Previous "adjust" procs don't update health, so we do it manually.
user.visible_message("[req_defib ? "[defib]" : "[src]"] pings: Resuscitation successful.")
- playsound(get_turf(src), 'sound/machines/defib_success.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_success.ogg', 50, 0)
H.set_heartattack(FALSE)
H.revive()
H.emote("gasp")
@@ -559,16 +567,16 @@
recharge(60)
else if (!H.getorgan(/obj/item/organ/heart))
user.visible_message("[req_defib ? "[defib]" : "[src]"] buzzes: Patient's heart is missing. Operation aborted.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
else if(H.undergoing_cardiac_arrest())
H.set_heartattack(FALSE)
user.visible_message("[req_defib ? "[defib]" : "[src]"] pings: Patient's heart is now beating again.")
- playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1)
+ playsound(src, 'sound/machines/defib_zap.ogg', 50, 1, -1)
else
user.visible_message("[req_defib ? "[defib]" : "[src]"] buzzes: Patient is not in a valid state. Operation aborted.")
- playsound(get_turf(src), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
busy = FALSE
update_icon()