diff --git a/code/datums/components/defibrillator.dm b/code/datums/components/defibrillator.dm
index be017d71dd2..e1c8011fe17 100644
--- a/code/datums/components/defibrillator.dm
+++ b/code/datums/components/defibrillator.dm
@@ -1,6 +1,9 @@
/**
* A component for an item that attempts to defibrillate a mob when activated.
*/
+
+#define DEFIB_TIME 5 SECONDS
+
/datum/component/defib
/// If this is being used by a borg or not, with necessary safeties applied if so.
var/robotic
@@ -24,6 +27,18 @@
var/emag_proof
/// uid to an item that should be making noise and handling things that our direct parent shouldn't be concerned with.
var/actual_unit_uid
+ /// Sound for defib windup.
+ var/charge_sound = 'sound/machines/defib_charge.ogg'
+ /// Sound when the defib is successful.
+ var/success_sound = 'sound/machines/defib_success.ogg'
+ /// Sound when the defib fails.
+ var/fail_sound = 'sound/machines/defib_failed.ogg'
+ /// Sound when the defib shocks the patient.
+ var/zap_sound = 'sound/machines/defib_zap.ogg'
+ /// Sound when the defib's safety is enabled.
+ var/safety_on_sound = 'sound/machines/defib_saftyon.ogg'
+ /// Sound when the defib's safety is disabled.
+ var/safety_off_sound = 'sound/machines/defib_saftyoff.ogg'
/**
* Create a new defibrillation component.
@@ -78,11 +93,11 @@
if(safety)
safety = FALSE
unit.visible_message("[unit] beeps: Safety protocols disabled!")
- playsound(get_turf(unit), 'sound/machines/defib_saftyoff.ogg', 50, 0)
+ playsound(get_turf(unit), safety_off_sound, 50, FALSE)
else
safety = TRUE
unit.visible_message("[unit] beeps: Safety protocols enabled!")
- playsound(get_turf(unit), 'sound/machines/defib_saftyon.ogg', 50, 0)
+ playsound(get_turf(unit), safety_on_sound, 50, FALSE)
/datum/component/defib/proc/on_emag(obj/item/unit, mob/user)
SIGNAL_HANDLER // COMSIG_ATOM_EMAG_ACT
@@ -134,7 +149,7 @@
if(application_result & COMPONENT_BLOCK_DEFIB_DEAD)
user.visible_message("[defib_ref] beeps: Unit is unpowered.")
- playsound(get_turf(defib_ref), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(get_turf(defib_ref), fail_sound, 50, FALSE)
return
if(on_cooldown)
@@ -179,12 +194,8 @@
SEND_SOUND(target, sound('sound/effects/genetics.ogg'))
target.throw_alert("cling_defib", /atom/movable/screen/alert/changeling_defib_revive, alert_args = list(parent, target))
- if(!do_after(user, 3 SECONDS * speed_multiplier, target = target)) // Beginning to place the paddles on patient's chest to allow some time for people to move away to stop the process
- busy = FALSE
- return
-
user.visible_message("[user] places [parent] on [target]'s chest.", "You place [parent] on [target]'s chest.")
- playsound(get_turf(defib_ref), 'sound/machines/defib_charge.ogg', 50, 0)
+ playsound(get_turf(defib_ref), charge_sound, 50, FALSE)
if(ghost && !ghost.client && !QDELETED(ghost))
log_debug("Ghost of name [ghost.name] is bound to [target.real_name], but lacks a client. Deleting ghost.")
@@ -192,13 +203,13 @@
var/signal_result = SEND_SIGNAL(target, COMSIG_LIVING_PRE_DEFIB, user, parent, ghost)
- if(!do_after(user, 2 SECONDS * speed_multiplier, target = target)) // Placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
+ if(!do_after(user, DEFIB_TIME * speed_multiplier, target = target)) // Placed on chest and short delay to shock for dramatic effect, revive time is 5sec total
busy = FALSE
return
if(istype(target.wear_suit, /obj/item/clothing/suit/space) && !combat)
user.visible_message("[defib_ref] buzzes: Patient's chest is obscured. Operation aborted.")
- playsound(get_turf(defib_ref), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(get_turf(defib_ref), fail_sound, 50, FALSE)
busy = FALSE
return
@@ -216,7 +227,7 @@
else if(heart.linked_organ.status & ORGAN_DEAD)
user.visible_message("[defib_ref] buzzes: Resuscitation failed - Heart necrosis detected.")
if(!heart || (heart.linked_organ.status & ORGAN_DEAD))
- playsound(get_turf(defib_ref), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(get_turf(defib_ref), fail_sound, 50, FALSE)
busy = FALSE
return
@@ -226,21 +237,21 @@
set_cooldown(cooldown)
user.visible_message("[defib_ref] pings: Cardiac arrhythmia corrected.")
target.visible_message("[target]'s body convulses a bit.", "You feel a jolt, and your heartbeat seems to steady.")
- playsound(get_turf(defib_ref), 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
- playsound(get_turf(defib_ref), "bodyfall", 50, 1)
- playsound(get_turf(defib_ref), 'sound/machines/defib_success.ogg', 50, 0)
+ playsound(get_turf(defib_ref), zap_sound, 50, TRUE, -1)
+ playsound(get_turf(defib_ref), "bodyfall", 50, TRUE)
+ playsound(get_turf(defib_ref), success_sound, 50, FALSE)
busy = FALSE
return
if(target.stat != DEAD && !HAS_TRAIT(target, TRAIT_FAKEDEATH))
user.visible_message("[defib_ref] buzzes: Patient is not in a valid state. Operation aborted.")
- playsound(get_turf(defib_ref), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(get_turf(defib_ref), fail_sound, 50, FALSE)
busy = FALSE
return
target.visible_message("[target]'s body convulses a bit.")
- playsound(get_turf(defib_ref), "bodyfall", 50, 1)
- playsound(get_turf(defib_ref), 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
+ playsound(get_turf(defib_ref), "bodyfall", 50, TRUE)
+ playsound(get_turf(defib_ref), zap_sound, 50, TRUE, -1)
ghost = target.get_ghost(TRUE) // We have to double check whether the dead guy has entered their body during the above
// Run through some quick failure states after shocking.
@@ -276,7 +287,7 @@
if(failure_message)
user.visible_message(failure_message)
- playsound(get_turf(defib_ref), 'sound/machines/defib_failed.ogg', 50, 0)
+ playsound(get_turf(defib_ref), fail_sound, 50, FALSE)
else
// Heal each basic damage type by as much as we're under -100 health
var/damage_above_threshold = -(min(target.health, HEALTH_THRESHOLD_DEAD) - HEALTH_THRESHOLD_DEAD)
@@ -299,10 +310,10 @@
if(target.getBrainLoss() >= 100)
// If you want to treat this with mannitol, it'll have to metabolize while the patient is alive, so it's alright to bring them back up for a minute
- playsound(get_turf(defib_ref), 'sound/machines/defib_saftyoff.ogg', 50, 0)
+ playsound(get_turf(defib_ref), safety_off_sound, 50, FALSE)
user.visible_message("[defib_ref] chimes: Minimal brain activity detected, brain treatment recommended for full resuscitation.")
else
- playsound(get_turf(defib_ref), 'sound/machines/defib_success.ogg', 50, 0)
+ playsound(get_turf(defib_ref), success_sound, 50, FALSE)
user.visible_message("[defib_ref] pings: Resuscitation successful.")
@@ -340,7 +351,7 @@
"[user] touches you with [parent], and you feel a strong jolt!")
target.apply_damage(60, STAMINA)
target.KnockDown(10 SECONDS)
- playsound(get_turf(parent), 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
+ playsound(get_turf(parent), zap_sound, 50, TRUE, -1)
target.emote("gasp")
if(combat && prob(heart_attack_chance))
target.set_heartattack(TRUE)
@@ -362,7 +373,7 @@
target.set_heartattack(TRUE)
target.visible_message("[user] has touched [target] with [parent]!", \
"[user] touches you with [parent], and you feel a strong jolt!")
- playsound(get_turf(parent), 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
+ playsound(get_turf(parent), zap_sound, 50, TRUE, -1)
SEND_SIGNAL(target, COMSIG_LIVING_MINOR_SHOCK, 100)
set_cooldown(cooldown)
return
@@ -398,5 +409,4 @@
"You feel a powerful shock travel up your [affecting.hand ? affecting.get_organ("l_arm") : affecting.get_organ("r_arm")] and back down your [affecting.hand ? affecting.get_organ("r_arm") : affecting.get_organ("l_arm")]!")
affecting.set_heartattack(TRUE)
-
-
+#undef DEFIB_TIME
diff --git a/sound/machines/defib_charge.ogg b/sound/machines/defib_charge.ogg
index 3e2be160fd1..9f963b05e75 100644
Binary files a/sound/machines/defib_charge.ogg and b/sound/machines/defib_charge.ogg differ