From 008cf4d365c6df12794a13ebb83efd3988a4ceb5 Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Tue, 17 Mar 2015 17:30:28 +0100 Subject: [PATCH] Adds pref SOUND_HEARTBEAT --- code/modules/client/preferences_toggles.dm | 16 +++++++++- code/modules/mob/living/carbon/human/life.dm | 32 +++++++++++--------- code/setup.dm | 3 +- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm index 06c82bfc529..a0cdd527b30 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 b7cd21c3040..620385eccb0 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1653,25 +1653,27 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc H.vomit() proc/handle_heartbeat() - if(pulse == PULSE_NONE) - return + var/client/C = src.client + if(C.prefs.sound & SOUND_HEARTBEAT) //disable heartbeat by pref + if(pulse == PULSE_NONE) + return - var/datum/organ/internal/heart/H = internal_organs_by_name["heart"] + var/datum/organ/internal/heart/H = internal_organs_by_name["heart"] - if(!H || istype(H,/datum/organ/internal/heart/robotic)) - return + if(!H || istype(H,/datum/organ/internal/heart/robotic)) + 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(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++ + 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 diff --git a/code/setup.dm b/code/setup.dm index 01542984028..43f1d14434f 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