diff --git a/code/__DEFINES/sound.dm b/code/__DEFINES/sound.dm index c3f7780b917..ba2bb37743f 100644 --- a/code/__DEFINES/sound.dm +++ b/code/__DEFINES/sound.dm @@ -7,6 +7,7 @@ #define CHANNEL_BUZZ 1019 #define CHANNEL_AMBIENCE 1018 #define CHANNEL_ENGINE 1017 // Engine ambient sounds +#define CHANNEL_FIREALARM 1016 //fire alarm alarms #define USER_VOLUME(M, C) M?.client?.prefs.get_channel_volume(C) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index d296e8c37c7..78b8d813e7c 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -2011,6 +2011,8 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) return "Ambience" if(CHANNEL_ENGINE) return "Engine Ambience" + if(CHANNEL_FIREALARM) + return "Fire Alarms" /proc/slot_bitfield_to_slot(input_slot_flags) // Kill off this garbage ASAP; slot flags and clothing flags should be IDENTICAL. GOSH DARN IT. Doesn't work with ears or pockets, either. switch(input_slot_flags) diff --git a/code/datums/looping_sounds/looping_sound.dm b/code/datums/looping_sounds/looping_sound.dm index 33fb5595c24..4a3f1108ffd 100644 --- a/code/datums/looping_sounds/looping_sound.dm +++ b/code/datums/looping_sounds/looping_sound.dm @@ -58,9 +58,11 @@ muted = FALSE on_start() -/datum/looping_sound/proc/stop(atom/remove_thing) +/datum/looping_sound/proc/stop(atom/remove_thing, do_not_mute) if(remove_thing) output_atoms -= remove_thing + if(do_not_mute) + return if(muted) return muted = TRUE diff --git a/code/datums/looping_sounds/machinery_sounds.dm b/code/datums/looping_sounds/machinery_sounds.dm index 432e2709335..f7a8f26803d 100644 --- a/code/datums/looping_sounds/machinery_sounds.dm +++ b/code/datums/looping_sounds/machinery_sounds.dm @@ -17,3 +17,19 @@ falloff_distance = 5 vary = TRUE channel = CHANNEL_ENGINE + +GLOBAL_DATUM_INIT(firealarm_soundloop, /datum/looping_sound/firealarm, new(list(), FALSE)) + +/datum/looping_sound/firealarm + mid_sounds = 'sound/machines/fire_alarm.ogg' + mid_length = 20 + volume = 80 + extra_range = 15 + falloff_exponent = 5 + channel = CHANNEL_FIREALARM + +/datum/looping_sound/firealarm/sound_loop(looped) + . = ..() + if(!length(output_atoms)) + stop() + diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 02e394c8427..c9e292f629b 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -264,6 +264,7 @@ for(var/item in firealarms) var/obj/machinery/firealarm/F = item F.update_icon() + GLOB.firealarm_soundloop.start(F) for(var/thing in cameras) var/obj/machinery/camera/C = locateUID(thing) @@ -289,6 +290,7 @@ for(var/item in firealarms) var/obj/machinery/firealarm/F = item F.update_icon() + GLOB.firealarm_soundloop.stop(F, TRUE) for(var/thing in cameras) var/obj/machinery/camera/C = locateUID(thing) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index deec95be610..2e1a9a79bd5 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -53,7 +53,6 @@ FIRE ALARM if(wiresexposed) icon_state = "firealarm_b[buildstage]" return - if(stat & BROKEN) icon_state = "firealarm_broken" else if(stat & NOPOWER) @@ -281,6 +280,7 @@ FIRE ALARM name = "fire alarm" /obj/machinery/firealarm/Destroy() + LAZYREMOVE(GLOB.firealarm_soundloop.output_atoms, src) LAZYREMOVE(myArea.firealarms, src) return ..() diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 4a76ee65f06..5fcfdbebf9c 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -85,6 +85,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts "1019" = 100, // CHANNEL_BUZZ "1018" = 100, // CHANNEL_AMBIENCE "1017" = 100, // CHANNEL_ENGINE + "1016" = 100, // CHANNEL_FIREALARM ) /// The volume mixer save timer handle. Used to debounce the DB call to save, to avoid spamming. var/volume_mixer_saving = null diff --git a/sound/machines/fire_alarm.ogg b/sound/machines/fire_alarm.ogg new file mode 100644 index 00000000000..aa2e2e9b758 Binary files /dev/null and b/sound/machines/fire_alarm.ogg differ