diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index a411a53e979..dc792fbd441 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -31,6 +31,7 @@ var/pressure_alert = 0 var/temperature_alert = 0 var/in_stasis = 0 + var/heartbeat = 0 /mob/living/carbon/human/Life() @@ -102,6 +103,8 @@ handle_medical_side_effects() + handle_heartbeat() + handle_stasis_bag() if(life_tick > 5 && timeofdeath && (timeofdeath < 5 || world.time - timeofdeath > 6000)) //We are long dead, or we're junk mobs spawned like the clowns on the clown shuttle @@ -1562,6 +1565,27 @@ return temp + proc/handle_heartbeat() + if(pulse == PULSE_NONE || !species.has_organ["heart"]) + return + + var/datum/organ/internal/heart/H = internal_organs_by_name["heart"] + + if(!H || H.robotic >=2 ) + return + + if(pulse >= PULSE_2FAST || shock_stage >= 10 || istype(get_turf(src), /turf/space)) + //PULSE_THREADY - maximum value for pulse, currently it 5. + //High pulse value corresponds to a fast rate of heartbeat. + //Divided by 2, otherwise it is too slow. + var/rate = (PULSE_THREADY - pulse)/2 + + if(heartbeat >= rate) + heartbeat = 0 + src << sound('sound/effects/singlebeat.ogg',0,0,0,50) + else + heartbeat++ + /* Called by life(), instead of having the individual hud items update icons each tick and check for status changes we only set those statuses and icons upon changes. Then those HUD items will simply add those pre-made images. diff --git a/sound/effects/singlebeat.ogg b/sound/effects/singlebeat.ogg new file mode 100644 index 00000000000..8dd550d5d84 Binary files /dev/null and b/sound/effects/singlebeat.ogg differ