Skip to content

Commit

Permalink
EKG sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
thgvr committed Feb 20, 2024
1 parent 3339d51 commit cc62937
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 35 deletions.
3 changes: 1 addition & 2 deletions code/datums/looping_sounds/item_sounds.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds
#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds
#define RAD_GEIGER_MEDIUM 500
#define RAD_GEIGER_HIGH 1000

Expand Down Expand Up @@ -41,7 +41,6 @@
mid_length = 3.5
volume = 25


/datum/looping_sound/reverse_bear_trap_beep
mid_sounds = list('sound/machines/beep.ogg')
mid_length = 60
Expand Down
16 changes: 0 additions & 16 deletions code/datums/looping_sounds/machinery_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
end_sound = 'sound/machines/shower/shower_end.ogg'
volume = 20

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/supermatter
mid_sounds = list('sound/machines/sm/loops/calm.ogg' = 1)
mid_length = 60
Expand All @@ -17,17 +15,13 @@
falloff_distance = 5
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/destabilized_crystal
mid_sounds = list('sound/machines/sm/loops/delamming.ogg' = 1)
mid_length = 60
volume = 55
extra_range = 15
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/generator
start_sound = 'sound/machines/generator/generator_start.ogg'
start_length = 4
Expand All @@ -36,9 +30,6 @@
end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 40

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/datum/looping_sound/deep_fryer
start_sound = 'sound/machines/fryer/deep_fryer_immerse.ogg' //my immersions
start_length = 10
Expand All @@ -47,15 +38,11 @@
end_sound = 'sound/machines/fryer/deep_fryer_emerge.ogg'
volume = 15

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/grill
mid_length = 2
mid_sounds = list('sound/machines/fryer/deep_fryer_1.ogg' = 1, 'sound/machines/fryer/deep_fryer_2.ogg' = 1)
volume = 30

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/microwave
start_sound = 'sound/machines/microwave/microwave-start.ogg'
start_length = 10
Expand All @@ -64,11 +51,8 @@
end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 90

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/jackpot
mid_length = 11
mid_sounds = list('sound/machines/roulettejackpot.ogg')
volume = 85
vary = TRUE

21 changes: 21 additions & 0 deletions code/datums/looping_sounds/medical_sounds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/datum/looping_sound/ekg
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 8
volume = 35

/datum/looping_sound/ekg_fast
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 5
volume = 35

/datum/looping_sound/ekg_slow
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 15
volume = 35

/datum/looping_sound/flatline
start_length = 7
start_sound = 'sound/machines/medical/flatline_start.ogg'
mid_sounds = list('sound/machines/medical/flatline_mid.ogg')
mid_length = 10
volume = 35
11 changes: 8 additions & 3 deletions code/game/machinery/medical/_medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
. = ..()
START_PROCESSING(SSmachines, src)

/obj/machinery/medical/Destroy()
STOP_PROCESSING(SSmachines, src)
return ..()

/obj/machinery/medical/wrench_act(mob/living/user, obj/item/I)
. = ..()
anchored = !anchored
Expand All @@ -28,7 +32,7 @@
return

if(attached)
usr.visible_message("<span class='warning'>[usr] deattaches [src] from [target].</span>", "<span class='notice'>You deattach [src] from [target].</span>")
usr.visible_message("<span class='warning'>[usr] detaches [src] from [target].</span>", "<span class='notice'>You detach [src] from [target].</span>")
clear_status()
attached = null
return
Expand All @@ -39,7 +43,7 @@

if(Adjacent(target) && usr.Adjacent(target))
usr.visible_message(span_warning("[usr] attaches [src] to [target]."), span_notice("You attach [src] to [target]."))
attached_beam = src.Beam(target, icon_state = "blood", maxdistance = 1)
attached_beam = src.Beam(target, icon_state = "1-full", maxdistance = 3)
add_fingerprint(usr)
attached = target
update_overlays()
Expand All @@ -56,7 +60,7 @@
clear_status()
return

if(!(get_dist(src, attached) <= 1 && isturf(attached.loc))) //you will most likely have multiple machines hooked up to you. Running away from them is a bad idea.
if(!(get_dist(src, attached) <= 2 && isturf(attached.loc))) //you will most likely have multiple machines hooked up to you. Running away from them is a bad idea.
to_chat(attached, "<span class='userdanger'>The [name] lines are ripped out of you!</span>")
attached.apply_damage(20, BRUTE, BODY_ZONE_CHEST)
attached.apply_damage(15, BRUTE, pick(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM))
Expand All @@ -76,5 +80,6 @@
*/
/obj/machinery/medical/proc/clear_status()
update_overlays()
qdel(attached_beam)
use_power = IDLE_POWER_USE
return
61 changes: 52 additions & 9 deletions code/game/machinery/medical/life_support.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/obj/machinery/medical/life_support
name = "Basic Life Support Unit"
name = "life support unit"
desc = "A bulky table with a lot of blinking lights installed and a small monitor that checks the users health."
icon = 'icons/obj/machines/medical/life_support.dmi'
icon_state = "basic"
Expand All @@ -10,6 +10,28 @@
var/health_treshold = -200
///Determines if this is active or not.
var/active = TRUE
///Sound that plays at stable health levels
var/datum/looping_sound/ekg/soundloop_ekg
///Sound that plays at dangerous health levels
var/datum/looping_sound/ekg_fast/soundloop_ekg_fast
///Sound that plays at lethal health levels
var/datum/looping_sound/ekg_slow/soundloop_ekg_slow
///Sound that plays when the user is dead
var/datum/looping_sound/flatline/soundloop_flatline

/obj/machinery/medical/life_support/Initialize()
. = ..()
soundloop_ekg = new(list(src), FALSE)
soundloop_ekg_slow = new(list(src), FALSE)
soundloop_ekg_fast = new(list(src), FALSE)
soundloop_flatline = new(list(src), FALSE)

/obj/machinery/medical/life_support/Destroy()
QDEL_NULL(soundloop_ekg)
QDEL_NULL(soundloop_ekg_fast)
QDEL_NULL(soundloop_ekg_slow)
QDEL_NULL(soundloop_flatline)
return ..()

/obj/machinery/medical/life_support/update_overlays()
. = ..()
Expand All @@ -26,13 +48,13 @@

switch(attached.health)
if(-INFINITY to HEALTH_THRESHOLD_DEAD)
monitor_overlay= mutable_appearance(icon,"death")
monitor_overlay = mutable_appearance(icon,"death")
if(HEALTH_THRESHOLD_DEAD+1 to HEALTH_THRESHOLD_FULLCRIT)
monitor_overlay= mutable_appearance(icon,"hardcrit")
monitor_overlay = mutable_appearance(icon,"hardcrit")
if(HEALTH_THRESHOLD_FULLCRIT+1 to HEALTH_THRESHOLD_CRIT)
monitor_overlay= mutable_appearance(icon,"softcrit")
monitor_overlay = mutable_appearance(icon,"softcrit")
if(1 to INFINITY)
monitor_overlay= mutable_appearance(icon,"alive")
monitor_overlay = mutable_appearance(icon,"alive")
. += monitor_overlay

/obj/machinery/medical/life_support/wrench_act(mob/living/user, obj/item/I)
Expand All @@ -47,6 +69,7 @@

/obj/machinery/medical/life_support/process()
. = ..()
update_sound()
if(!active || !attached)
return

Expand All @@ -60,18 +83,38 @@
attached.update_stat()
return

/obj/machinery/medical/life_support/proc/update_sound()
if(!active || !attached)
soundloop_ekg.stop()
soundloop_ekg_slow.stop()
soundloop_ekg_fast.stop()
soundloop_flatline.stop()

switch(attached.health)
if(-INFINITY to HEALTH_THRESHOLD_DEAD)
soundloop_flatline.start()
soundloop_ekg_slow.stop()
if(HEALTH_THRESHOLD_DEAD+1 to HEALTH_THRESHOLD_FULLCRIT)
soundloop_ekg_slow.start()
soundloop_ekg_fast.stop()
if(HEALTH_THRESHOLD_FULLCRIT+1 to HEALTH_THRESHOLD_CRIT)
soundloop_ekg_fast.start()
soundloop_ekg.stop()
if(1 to INFINITY)
soundloop_ekg.start()

/obj/machinery/medical/life_support/advanced
name = "Advanced Life Support Unit"
desc = "A miracle of space engineering, this machine allows you to indefinitely suspend someone in a stasis like state, but uses up massive amounts of electricity to do so."
name = "advanced life support unit"
desc = "A miracle of modern engineering, this machine allows you to indefinitely suspend someone in a stasis like state, but uses up massive amounts of electricity to do so."
icon_state = "advanced"
circuit = /obj/item/circuitboard/machine/life_support/advanced
idle_power_usage = 250
active_power_usage = 1000
health_treshold = -1000

/obj/machinery/medical/life_support/mobile
name = "Mobile Life Support Unit"
desc = "A miracle of space engineering, allows you to suspend someone in a coma-like state, wherever you go!"
name = "portable life support unit"
desc = "A miracle of modern engineering, allows you to suspend someone in a coma-like state, wherever you go!"
icon_state = "mobile"
circuit = /obj/item/circuitboard/machine/life_support/mobile
idle_power_usage = 50
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/medical/organ_substitutes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
active_power_usage /= C.rating

/obj/machinery/medical/simple/liver
name = "Automated Liver Support System"
name = "liver support system"
desc = "Stabilizes the liver at the cost of a lot of electricity. Better parts lessen the strain on the power network."
icon_state = "mechanical_liver"
status = TRAIT_STABLELIVER

/obj/machinery/medical/simple/lung
name = "Automatic Breath Rejuvanator"
name = "ventilator"
desc = "Stabilizes the lungs at the cost of a lot of electricity. Better parts lessen the strain on the power network."
icon_state = "mechanical_lungs"
status = TRAIT_STABLELUNG

/obj/machinery/medical/simple/heart
name = "Emergency Heart Stabilizer"
name = "heart stabilizer"
desc = "Stabilizes the heart at the cost of a lot of electricity. Better parts lessen the strain on the power network."
icon_state = "mechanical_heart"
idle_power_usage = 150
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/medical/plasmic_stabilizer.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/obj/machinery/medical/plasmic_stabilizer
name = "Automated Inorganic Lifeform Stabilizer"
name = "plasmic stabilizer"
desc = "Stabilizes free plasma particles in inorganic bodies, causing them to not burn. Uses massive amounts of electricity."
icon_state = "plasmic_stabilizer"
active_power_usage = 1500
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/medical/thermal_stabilizer.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/medical/thermal
name = "Thermal Stabilizer"
desc = "Stabilizes free plasma particles in inorganic bodies, causing them to not burn. Uses massive amounts of electricity.This model seems to be very old."
desc = "Stabilizes the body temperature of a connected patient."
icon_state = "thermal_stabilizer"
var/stabilization_rate = 10

Expand Down
1 change: 1 addition & 0 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@
#include "code\datums\looping_sounds\_looping_sound.dm"
#include "code\datums\looping_sounds\item_sounds.dm"
#include "code\datums\looping_sounds\machinery_sounds.dm"
#include "code\datums\looping_sounds\medical_sounds.dm"
#include "code\datums\looping_sounds\weather.dm"
#include "code\datums\mapgen\_biome.dm"
#include "code\datums\mapgen\_MapGenerator.dm"
Expand Down
Binary file added sound/machines/medical/ekgbeep.ogg
Binary file not shown.
Binary file added sound/machines/medical/flatline.ogg
Binary file not shown.
Binary file added sound/machines/medical/flatline_mid.ogg
Binary file not shown.
Binary file added sound/machines/medical/flatline_start.ogg
Binary file not shown.

0 comments on commit cc62937

Please sign in to comment.