diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 06c82bfc5298..a0cdd527b305 100644 --- a/code/modules/client/preferences_toggles.dm +++ b/code/modules/client/preferences_toggles.dm @@ -25,7 +25,7 @@ src << "As a ghost, you will now [(prefs.toggles & CHAT_GHOSTRADIO) ? "hear all radio chat in the world" : "only hear from nearby speakers"]." prefs.save_preferences(src) feedback_add_details("admin_verb","TGR") - + /client/proc/toggle_hear_radio() set name = "Show/Hide RadioChatter" set category = "Preferences" @@ -134,6 +134,20 @@ src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2) feedback_add_details("admin_verb","TAmbi") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/verb/Toggle_Heartbeat() //to toggle off heartbeat sounds, in case they get too annoying + set name = "Hear/Silence Heartbeat" + set category = "Preferences" + set desc = "Toggles hearing heart beating sound effects" + prefs.sound ^= SOUND_HEARTBEAT + prefs.save_preferences(src) + if(prefs.sound & SOUND_HEARTBEAT) + src << "You will now hear heartbeat sounds." + else + src << "You will no longer hear heartbeat sounds." + src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1) + src << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2) + feedback_add_details("admin_verb","Thb") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + //be special /client/verb/toggle_be_special(role in be_special_flags) set name = "Toggle Special Role Candidacy" diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 47af54c0d0ba..6ee4125aeaa5 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -35,6 +35,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc var/in_stasis = 0 var/exposedtimenow = 0 var/firstexposed = 0 + var/heartbeat = 0 /mob/living/carbon/human/Life() set invisibility = 0 @@ -110,6 +111,8 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc handle_medical_side_effects() + handle_heartbeat() + if(stat == DEAD) handle_decay() @@ -498,6 +501,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc //Body temperature is too hot. fire_alert = max(fire_alert, 1) if(status_flags & GODMODE) return 1 //godmode + if(bodytemperature >= species.heat_level_1 && bodytemperature <= species.heat_level_2) take_overall_damage(burn=HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") fire_alert = max(fire_alert, 2) @@ -515,7 +519,9 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc else if(bodytemperature < species.cold_level_1) fire_alert = max(fire_alert, 1) if(status_flags & GODMODE) return 1 //godmode + if(stat == DEAD) return 1 //ZomgPonies -- No need for cold burn damage if dead + if(!istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) if(bodytemperature >= species.cold_level_2 && bodytemperature <= species.cold_level_1) take_overall_damage(burn=COLD_DAMAGE_LEVEL_1, used_weapon = "Low Body Temperature") @@ -1646,6 +1652,46 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc H << "You smell something foul..." H.vomit() + proc/handle_heartbeat() + var/client/C = src.client + if(C && C.prefs.sound & SOUND_HEARTBEAT) //disable heartbeat by pref + var/datum/organ/internal/heart/H = internal_organs_by_name["heart"] + if(istype(H,/datum/organ/internal/heart/robotic)) //Handle robotic hearts specially with a wuuuubb. This also applies to machine-people. + if(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 - 2)/2 //machine people (main target) have no pulse, manually subtract standard human pulse (2). Mechanic-heart humans probably have a pulse, but 'advanced neural systems' keep the heart rate steady, or something + + if(heartbeat >= rate) + heartbeat = 0 + src << sound('sound/effects/electheart.ogg',0,0,0,30) //Credit to GhostHack (www.ghosthack.de) for sound. + else + heartbeat++ + return + return + + if(pulse == PULSE_NONE) + return + + if(!H) + 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 + if(istype(H,/datum/organ/internal/heart/assisted)) + src << sound('sound/effects/pacemakebeat.ogg',0,0,0,50) + else + 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. @@ -1664,6 +1710,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc hud_list[HEALTH_HUD] = holder + if(hud_updateflag & 1 << STATUS_HUD) var/foundVirus = 0 for (var/ID in virus2) @@ -1698,6 +1745,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc hud_list[STATUS_HUD] = holder hud_list[STATUS_HUD_OOC] = holder2 + if(hud_updateflag & 1 << ID_HUD) var/image/holder = hud_list[ID_HUD] if(wear_id) @@ -1712,6 +1760,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc hud_list[ID_HUD] = holder + if(hud_updateflag & 1 << WANTED_HUD) var/image/holder = hud_list[WANTED_HUD] holder.icon_state = "hudblank" @@ -1737,6 +1786,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc break hud_list[WANTED_HUD] = holder + if(hud_updateflag & 1 << IMPLOYAL_HUD || hud_updateflag & 1 << IMPCHEM_HUD || hud_updateflag & 1 << IMPTRACK_HUD) var/image/holder1 = hud_list[IMPTRACK_HUD] var/image/holder2 = hud_list[IMPLOYAL_HUD] @@ -1848,6 +1898,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc speech_problem_flag = 1 return stuttering + // Need this in species. //#undef HUMAN_MAX_OXYLOSS //#undef HUMAN_CRIT_MAX_OXYLOSS diff --git a/code/setup.dm b/code/setup.dm index 015429840283..43f1d14434f8 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -725,8 +725,9 @@ var/list/TAGGERLOCATIONS = list("Disposals", #define SOUND_AMBIENCE 4 #define SOUND_LOBBY 8 #define SOUND_STREAMING 16 +#define SOUND_HEARTBEAT 32 -#define SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_STREAMING) +#define SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_STREAMING|SOUND_HEARTBEAT) #define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC) #define BE_TRAITOR 1 diff --git a/sound/effects/electheart.ogg b/sound/effects/electheart.ogg new file mode 100644 index 000000000000..5bf86a858cb9 Binary files /dev/null and b/sound/effects/electheart.ogg differ diff --git a/sound/effects/pacemakebeat.ogg b/sound/effects/pacemakebeat.ogg new file mode 100644 index 000000000000..7a5c9ef24e34 Binary files /dev/null and b/sound/effects/pacemakebeat.ogg differ diff --git a/sound/effects/singlebeat.ogg b/sound/effects/singlebeat.ogg new file mode 100644 index 000000000000..8dd550d5d846 Binary files /dev/null and b/sound/effects/singlebeat.ogg differ