diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 50b6de2988..5ad254b172 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 @@ -617,7 +620,7 @@ else apply_damage(HEAT_GAS_DAMAGE_LEVEL_3, BURN, "head", used_weapon = "Excessive Heat") fire_alert = max(fire_alert, 2) - + else if(breath.temperature <= species.cold_level_1) if(breath.temperature > species.cold_level_2) apply_damage(COLD_GAS_DAMAGE_LEVEL_1, BURN, "head", used_weapon = "Excessive Cold") @@ -705,7 +708,7 @@ //Body temperature is too hot. fire_alert = max(fire_alert, 1) if(status_flags & GODMODE) return 1 //godmode - + if(bodytemperature < species.heat_level_2) take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") fire_alert = max(fire_alert, 2) @@ -719,7 +722,7 @@ else if(bodytemperature <= species.cold_level_1) fire_alert = max(fire_alert, 1) if(status_flags & GODMODE) return 1 //godmode - + if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) if(bodytemperature > species.cold_level_2) take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") @@ -1558,6 +1561,22 @@ return temp + proc/handle_heartbeat() + if(pulse == PULSE_NONE) + 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,60) + 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. @@ -1574,14 +1593,14 @@ var/percentage_health = RoundHealth((health-config.health_threshold_crit)/(maxHealth-config.health_threshold_crit)*100) holder.icon_state = "hud[percentage_health]" hud_list[HEALTH_HUD] = holder - + if (BITTEST(hud_updateflag, LIFE_HUD)) var/image/holder = hud_list[STATUS_HUD] if(stat == DEAD) holder.icon_state = "huddead" else holder.icon_state = "hudhealthy" - + if (BITTEST(hud_updateflag, STATUS_HUD)) var/foundVirus = 0 for(var/datum/disease/D in viruses) @@ -1618,7 +1637,7 @@ hud_list[STATUS_HUD] = holder hud_list[STATUS_HUD_OOC] = holder2 - + if (BITTEST(hud_updateflag, ID_HUD)) var/image/holder = hud_list[ID_HUD] if(wear_id) @@ -1632,7 +1651,7 @@ hud_list[ID_HUD] = holder - + if (BITTEST(hud_updateflag, WANTED_HUD)) var/image/holder = hud_list[WANTED_HUD] holder.icon_state = "hudblank" @@ -1658,11 +1677,11 @@ holder.icon_state = "hudreleased" break hud_list[WANTED_HUD] = holder - + if ( BITTEST(hud_updateflag, IMPLOYAL_HUD) \ || BITTEST(hud_updateflag, IMPCHEM_HUD) \ || BITTEST(hud_updateflag, IMPTRACK_HUD)) - + var/image/holder1 = hud_list[IMPTRACK_HUD] var/image/holder2 = hud_list[IMPLOYAL_HUD] var/image/holder3 = hud_list[IMPCHEM_HUD] @@ -1683,7 +1702,7 @@ hud_list[IMPTRACK_HUD] = holder1 hud_list[IMPLOYAL_HUD] = holder2 hud_list[IMPCHEM_HUD] = holder3 - + if (BITTEST(hud_updateflag, SPECIALROLE_HUD)) var/image/holder = hud_list[SPECIALROLE_HUD] holder.icon_state = "hudblank" @@ -1744,10 +1763,10 @@ /mob/living/carbon/human/handle_fire() if(..()) return - + var/burn_temperature = fire_burn_temperature() var/thermal_protection = get_heat_protection(burn_temperature) - + if (thermal_protection < 1 && bodytemperature < burn_temperature) bodytemperature += round(BODYTEMP_HEATING_MAX*(1-thermal_protection), 1) diff --git a/sound/effects/singlebeat.ogg b/sound/effects/singlebeat.ogg new file mode 100644 index 0000000000..8dd550d5d8 Binary files /dev/null and b/sound/effects/singlebeat.ogg differ