diff --git a/code/datums/looping_sounds/_looping_sound.dm b/code/datums/looping_sounds/_looping_sound.dm index 020b98e478..c2a9c20501 100644 --- a/code/datums/looping_sounds/_looping_sound.dm +++ b/code/datums/looping_sounds/_looping_sound.dm @@ -17,6 +17,7 @@ opacity_check (bool) If true, things behind walls/opaque things won't hear the sounds. pref_check (type) If set to a /datum/client_preference type, will check if the hearer has that preference active before playing it to them. volume_chan (type) If set to a specific volume channel via the incoming argument, we tell the playsound proc to modulate volume based on that channel + exclusive (bool) If true, only one of this sound is allowed to play. */ /datum/looping_sound var/list/atom/output_atoms @@ -34,16 +35,19 @@ var/opacity_check var/pref_check var/volume_chan + var/exclusive var/timerid + var/started -/datum/looping_sound/New(list/_output_atoms=list(), start_immediately=FALSE, _direct=FALSE) +/datum/looping_sound/New(list/_output_atoms=list(), start_immediately=FALSE, disable_direct=FALSE) // CHOMPEdit: Fixes shitty default _direct forcing all direct sounds to false. Now it is an explicit override if(!mid_sounds) WARNING("A looping sound datum was created without sounds to play.") return output_atoms = _output_atoms - direct = _direct + if(disable_direct) // CHOMPEdit: Fixes shitty default _direct forcing all direct sounds to false. Now it is an explicit override + direct = FALSE // CHOMPEdit: Fixes shitty default _direct forcing all direct sounds to false. Now it is an explicit override if(start_immediately) start() @@ -53,21 +57,30 @@ output_atoms = null return ..() -/datum/looping_sound/proc/start(atom/add_thing) +/datum/looping_sound/proc/start(atom/add_thing, skip_start_sound = FALSE) // CHOMPStation Edit: Skip start sounds optionally if(add_thing) output_atoms |= add_thing if(timerid) return + if(skip_start_sound && (!exclusive && !started)) // CHOMPStation Edit: Skip start sounds optionally + sound_loop() // CHOMPStation Edit: Skip start sounds optionally + started = TRUE // CHOMPStation Edit: Skip start sounds optionally + return // CHOMPStation Edit: Skip start sounds optionally + if(exclusive && started) // Prevents a sound from starting multiple times + return // Don't start this loop. on_start() + started = TRUE -/datum/looping_sound/proc/stop(atom/remove_thing) +/datum/looping_sound/proc/stop(atom/remove_thing, skip_stop_sound = FALSE) if(remove_thing) output_atoms -= remove_thing if(!timerid) return - on_stop() + if(!skip_stop_sound) // CHOMPEdit: Allows skipping the stop sound, should you need to. + on_stop() // CHOMPEdit: Allows skipping the stop sound, should you need to. deltimer(timerid) timerid = null + started = FALSE /datum/looping_sound/proc/sound_loop(starttime) if(max_loops && world.time >= starttime + mid_length * max_loops) @@ -89,7 +102,7 @@ if(direct) if(ismob(thing)) var/mob/M = thing - if(!M.is_preference_enabled(pref_check)) + if(pref_check && !M.is_preference_enabled(pref_check)) // CHOMPEdit: Fixed this broken check, sent upstream continue SEND_SOUND(thing, S) else @@ -112,4 +125,4 @@ /datum/looping_sound/proc/on_stop() if(end_sound) - play(end_sound) \ No newline at end of file + play(end_sound) diff --git a/code/datums/looping_sounds/mob_sounds.dm b/code/datums/looping_sounds/mob_sounds.dm new file mode 100644 index 0000000000..c67fe31c3c --- /dev/null +++ b/code/datums/looping_sounds/mob_sounds.dm @@ -0,0 +1,23 @@ +/* + * The purpose of this file is to house mob injury loops - such as being on fire. +*/ + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/datum/looping_sound/mob + // volume_chan = VOLUME_CHANNEL_INJ_DEATH // Commented out until pain/etc PR is in + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/datum/looping_sound/mob/deafened + start_sound = 'modular_chomp/sound/effects/ear_ring/ear_deaf_in.ogg' + start_length = 4 SECONDS // 2 seconds shorter than the actual file ending, bc we want it to overlap + mid_sounds = list('modular_chomp/sound/effects/ear_ring/ear_deaf_loop.ogg'=1) + mid_length = 3 SECONDS + end_sound = 'modular_chomp/sound/effects/ear_ring/ear_deaf_out.ogg' + volume = 40 + direct = TRUE // We send this sound directly to the mob, bc they only hear it when they're deaf. + exclusive = TRUE // This should only occur once, because we can only be deafened once. + // volume_chan = VOLUME_CHANNEL_INJ_DEATH // Commented out until pain/etc PR is in + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/code/game/dna/genes/disabilities.dm b/code/game/dna/genes/disabilities.dm index 2d3c1a3ac5..7a0b907e19 100644 --- a/code/game/dna/genes/disabilities.dm +++ b/code/game/dna/genes/disabilities.dm @@ -119,6 +119,8 @@ /datum/dna/gene/disability/deaf/activate(var/mob/M, var/connected, var/flags) ..(M,connected,flags) M.ear_deaf = 1 + var/mob/living/mL = M // CHOMPStation Add: Ear Ringing/Deafness + mL.deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness /datum/dna/gene/disability/nearsighted name="Nearsightedness" diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm index 16a40583be..abe0c509da 100644 --- a/code/game/gamemodes/cult/runes.dm +++ b/code/game/gamemodes/cult/runes.dm @@ -912,6 +912,7 @@ var/list/sacrificed = list() if(N) continue C.ear_deaf += 50 + C.deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness C.show_message("The world around you suddenly becomes quiet.", 3) affected += C if(prob(1)) @@ -932,6 +933,7 @@ var/list/sacrificed = list() if(N) continue C.ear_deaf += 30 + C.deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness //talismans is weaker. C.show_message("The world around you suddenly becomes quiet.", 3) affected += C diff --git a/code/game/gamemodes/technomancer/spells/audible_deception.dm b/code/game/gamemodes/technomancer/spells/audible_deception.dm index ebd8974305..849f86f2b8 100644 --- a/code/game/gamemodes/technomancer/spells/audible_deception.dm +++ b/code/game/gamemodes/technomancer/spells/audible_deception.dm @@ -86,6 +86,7 @@ M.SetSleeping(0) M.stuttering += 20 M.ear_deaf += 30 + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Weaken(3) if(prob(30)) M.Stun(10) diff --git a/code/game/machinery/jukebox.dm b/code/game/machinery/jukebox.dm index 0e184683ec..122a8b3635 100644 --- a/code/game/machinery/jukebox.dm +++ b/code/game/machinery/jukebox.dm @@ -230,6 +230,7 @@ M.SetSleeping(0) M.stuttering += 20 M.ear_deaf += 30 + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Weaken(3) if(prob(30)) M.Stun(10) diff --git a/code/game/mecha/equipment/weapons/honk.dm b/code/game/mecha/equipment/weapons/honk.dm index e7bee193dd..f7d49ec2ab 100644 --- a/code/game/mecha/equipment/weapons/honk.dm +++ b/code/game/mecha/equipment/weapons/honk.dm @@ -28,10 +28,11 @@ playsound(M, 'sound/effects/bang.ogg', 70, 1, 30) M.SetSleeping(0) M.ear_deaf += 30 + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.ear_damage += rand(5, 20) M.Weaken(3) M.Stun(5) chassis.use_power(energy_drain) log_message("Used a sound emission device.") do_after_cooldown() - return \ No newline at end of file + return diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index fd439dd222..24eaf70d85 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -38,6 +38,8 @@ // If inside the blast radius + world.view - 2 if(dist <= round(max_range + world.view - 2, 1)) M.playsound_local(epicenter, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound + var/mob/living/mL = M // CHOMPStation Add: Ear Ringing/Deafness + mL.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if(dist <= far_dist) var/far_volume = CLAMP(far_dist, 30, 50) // Volume is based on explosion size and dist far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion diff --git a/code/game/objects/items/devices/megaphone.dm b/code/game/objects/items/devices/megaphone.dm index 26d58082b6..bd2a5c62b1 100644 --- a/code/game/objects/items/devices/megaphone.dm +++ b/code/game/objects/items/devices/megaphone.dm @@ -143,6 +143,7 @@ M.SetSleeping(0) M.stuttering += 20 M.ear_deaf += 30 + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Weaken(3) if(prob(30)) M.Stun(10) diff --git a/code/game/objects/items/weapons/grenades/concussion.dm b/code/game/objects/items/weapons/grenades/concussion.dm index fb821ab6f8..430292ddee 100644 --- a/code/game/objects/items/weapons/grenades/concussion.dm +++ b/code/game/objects/items/weapons/grenades/concussion.dm @@ -38,6 +38,7 @@ else H.Confuse(8) H.Weaken(1) + H.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if ((prob(14) || (H == src.loc && prob(70)))) H.ear_damage += rand(1, 10) else @@ -54,6 +55,7 @@ H.Confuse(6) H.ear_damage += rand(0, 3) H.ear_deaf = max(H.ear_deaf,10) + H.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(H.client) if(prob(50)) @@ -65,15 +67,18 @@ H.Confuse(4) H.ear_damage += rand(0, 1) H.ear_deaf = max(H.ear_deaf,5) + H.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(H.ear_damage >= 15) to_chat(H, "Your ears start to ring badly!") + H.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(prob(H.ear_damage - 5)) to_chat(H, "You can't hear anything!") H.sdisabilities |= DEAF else if(H.ear_damage >= 5) to_chat(H, "Your ears start to ring!") + H.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(istype(L, /mob/living/silicon/robot)) var/mob/living/silicon/robot/R = L if(L.client) @@ -82,4 +87,4 @@ else L.client.spinright() to_chat(R, "Gyroscopic failure.") - return \ No newline at end of file + return diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm index b176563b26..5cec3c8759 100644 --- a/code/game/objects/items/weapons/grenades/flashbang.dm +++ b/code/game/objects/items/weapons/grenades/flashbang.dm @@ -64,17 +64,20 @@ else M.ear_damage += rand(0, 5) M.ear_deaf = max(M.ear_deaf,15) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if(get_dist(M, T) <= round(max_range * 0.5 * bang_effectiveness)) if(!ear_safety) M.Confuse(8) M.ear_damage += rand(0, 3) M.ear_deaf = max(M.ear_deaf,10) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if(!ear_safety && get_dist(M, T) <= (max_range * 0.7 * bang_effectiveness)) M.Confuse(4) M.ear_damage += rand(0, 1) M.ear_deaf = max(M.ear_deaf,5) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness //This really should be in mob not every check if(ishuman(M)) @@ -162,4 +165,4 @@ var/dettime = rand(15,60) spawn(dettime) - detonate() \ No newline at end of file + detonate() diff --git a/code/modules/admin/verbs/lightning_strike.dm b/code/modules/admin/verbs/lightning_strike.dm index d977c39b22..bc260a7306 100644 --- a/code/modules/admin/verbs/lightning_strike.dm +++ b/code/modules/admin/verbs/lightning_strike.dm @@ -93,6 +93,7 @@ if(iscarbon(L)) var/mob/living/carbon/C = L C.ear_deaf += 10 + C.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness to_chat(L, span("danger", "Lightning struck nearby, and the thunderclap is deafening!")) #undef LIGHTNING_ZAP_RANGE diff --git a/code/modules/mob/living/carbon/alien/alien_damage.dm b/code/modules/mob/living/carbon/alien/alien_damage.dm index f2d147641f..60df787c17 100644 --- a/code/modules/mob/living/carbon/alien/alien_damage.dm +++ b/code/modules/mob/living/carbon/alien/alien_damage.dm @@ -19,6 +19,7 @@ ear_damage += 30 ear_deaf += 120 + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(3.0) b_loss += 30 @@ -26,6 +27,7 @@ Paralyse(1) ear_damage += 15 ear_deaf += 60 + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness adjustBruteLoss(b_loss) adjustFireLoss(f_loss) diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 64e5145b97..adc221d224 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -41,12 +41,14 @@ if(stat == DEAD) blinded = 1 silent = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. else updatehealth() if(health <= 0) death() blinded = 1 silent = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. return 1 if(paralysis && paralysis > 0) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 075384bc18..95af6ec7c0 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -92,6 +92,7 @@ if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP blinded = 1 silent = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. else //ALIVE. LIGHTS ARE ON if( !container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life)) ) death() @@ -112,6 +113,7 @@ SetBlinded(1) blinded = 1 ear_deaf = 1 + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness silent = 1 if(!alert)//Sounds an alarm, but only once per 'level' emote("alarm") @@ -124,6 +126,7 @@ blinded = 0 SetBlinded(0) ear_deaf = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness silent = 0 emp_damage -= 1 if(11 to 19)//Moderate level of EMP damage, resulting in nearsightedness and ear damage @@ -219,4 +222,4 @@ if(client && !client.adminobs) reset_view(null) - return 1 \ No newline at end of file + return 1 diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 3904656a99..4f1d54f050 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -131,6 +131,7 @@ if(species.emp_sensitivity & EMP_DEAFEN) src.ear_damage += rand(0,deafen_dur) //this will heal pretty quickly, but spamming them at someone could cause serious damage src.ear_deaf = max(src.ear_deaf,deafen_dur) + src.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if(species.emp_sensitivity & EMP_CONFUSE) if(confuse_dur >= 1) to_chat(src, "Oh god, everything's spinning!") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 42582402a5..bbd1903980 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -143,6 +143,7 @@ if (!get_ear_protection() >= 2) ear_damage += 30 ear_deaf += 120 + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if (prob(70) && !shielded) Paralyse(10) @@ -153,6 +154,7 @@ if (!get_ear_protection() >= 2) ear_damage += 15 ear_deaf += 60 + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if (prob(50) && !shielded) Paralyse(10) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 333d99b5c0..99ace1685d 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1257,6 +1257,7 @@ if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP blinded = 1 silent = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. else //ALIVE. LIGHTS ARE ON updatehealth() //TODO @@ -1264,6 +1265,7 @@ death() blinded = 1 silent = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. return 1 //UNCONSCIOUS. NO-ONE IS HOME @@ -1379,6 +1381,7 @@ //Ears if(sdisabilities & DEAF) //disabled-deaf, doesn't get better on its own ear_deaf = max(ear_deaf, 1) + deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness else if(ear_deaf) //deafness, heals slowly over time ear_deaf = max(ear_deaf-1, 0) else if(get_ear_protection() >= 2) //resting your ears with earmuffs heals ear damage faster @@ -1387,6 +1390,11 @@ else if(ear_damage < 25) //ear damage heals slowly under this threshold. otherwise you'll need earmuffs ear_damage = max(ear_damage-0.05, 0) + // CHOMPAdd: Handle Ear ringing, standalone safety check. + if(ear_deaf <= 0) + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness + // CHOMPAdd End + //Resting if(resting) dizziness = max(0, dizziness - 15) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f0bac492f7..c833eeac5a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -834,6 +834,10 @@ /mob/living/adjustEarDamage(var/damage, var/deaf) ear_damage = max(0, ear_damage + damage) ear_deaf = max(0, ear_deaf + deaf) + if(ear_deaf > 0) + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. + else if(ear_deaf <= 0) + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. //pass a negative argument to skip one of the variable /mob/living/setEarDamage(var/damage, var/deaf) @@ -841,6 +845,7 @@ ear_damage = damage if(deaf >= 0) ear_deaf = deaf + deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. /mob/living/proc/vomit(var/skip_wait, var/blood_vomit) if(!check_has_mouth()) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index 3d6ebe9739..af9a73c92c 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -113,11 +113,15 @@ src.AdjustBlinded(-1) src.blinded = 1 - if (src.ear_deaf > 0) src.ear_deaf-- + if (src.ear_deaf > 0) + src.ear_deaf-- if (src.ear_damage < 25) src.ear_damage -= 0.05 src.ear_damage = max(src.ear_damage, 0) + if(src.ear_deaf <= 0) // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness - Not sure if we need this, but, safety. + src.density = !( src.lying ) if (src.sdisabilities & BLIND) diff --git a/code/modules/nifsoft/software/13_soulcatcher.dm b/code/modules/nifsoft/software/13_soulcatcher.dm index 6f5ca2edc2..5831abaf41 100644 --- a/code/modules/nifsoft/software/13_soulcatcher.dm +++ b/code/modules/nifsoft/software/13_soulcatcher.dm @@ -320,8 +320,10 @@ //If they're deaf if(ext_deaf) ear_deaf = 5 + deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness else ear_deaf = 0 + deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness /mob/living/carbon/brain/caught_soul/hear_say() if(ext_deaf || !client) diff --git a/code/modules/projectiles/guns/magnetic/magnetic.dm b/code/modules/projectiles/guns/magnetic/magnetic.dm index 05564efacd..54c0b2f0d5 100644 --- a/code/modules/projectiles/guns/magnetic/magnetic.dm +++ b/code/modules/projectiles/guns/magnetic/magnetic.dm @@ -331,7 +331,7 @@ /obj/item/weapon/gun/magnetic/fuelrod/proc/blitzed(var/turf/T, var/mob/living/carbon/M, var/max_range, var/banglet) // Added a new proc called 'bang' that takes a location and a person to be banged. to_chat(M, "BANG") // Called during the loop that bangs people in lockers/containers and when banging playsound(src, 'sound/effects/bang.ogg', 50, 1, 30) // people in normal view. Could theroetically be called during other explosions. - + //Checking for protections var/eye_safety = 0 @@ -365,17 +365,20 @@ else M.ear_damage += rand(0, 5) M.ear_deaf = max(M.ear_deaf,15) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if(get_dist(M, T) <= round(max_range * 0.5 * bang_effectiveness)) if(!ear_safety) M.Confuse(8) M.ear_damage += rand(0, 3) M.ear_deaf = max(M.ear_deaf,10) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if(!ear_safety && get_dist(M, T) <= (max_range * 0.7 * bang_effectiveness)) M.Confuse(4) M.ear_damage += rand(0, 1) M.ear_deaf = max(M.ear_deaf,5) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness //This really should be in mob not every check if(ishuman(M)) diff --git a/code/modules/projectiles/projectile/energy.dm b/code/modules/projectiles/projectile/energy.dm index 511c1e85e7..141e365625 100644 --- a/code/modules/projectiles/projectile/energy.dm +++ b/code/modules/projectiles/projectile/energy.dm @@ -256,11 +256,13 @@ M.Weaken(2) M.ear_damage += rand(1, 10) M.ear_deaf = max(M.ear_deaf,15) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness if (M.ear_damage >= 15) to_chat(M, "Your ears start to ring badly!") if (prob(M.ear_damage - 5)) to_chat(M, "You can't hear anything!") M.sdisabilities |= DEAF + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness else if (M.ear_damage >= 5) to_chat(M, "Your ears start to ring!") diff --git a/code/modules/reagents/reagents/toxins.dm b/code/modules/reagents/reagents/toxins.dm index 003ba3e74f..ec8069893a 100644 --- a/code/modules/reagents/reagents/toxins.dm +++ b/code/modules/reagents/reagents/toxins.dm @@ -691,6 +691,7 @@ M.eye_blurry = max(M.eye_blurry, 30) if(prob(20)) M.ear_deaf = max(M.ear_deaf, 4) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Confuse(2) else M.Weaken(2) @@ -735,6 +736,7 @@ if(alien == IS_SLIME) if(prob(30)) M.ear_deaf = max(M.ear_deaf, 4) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.eye_blurry = max(M.eye_blurry, 60) M.Weaken(30) M.Confuse(40) diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index 6045284b4c..110d85061f 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -110,6 +110,7 @@ /datum/disease2/effect/deaf/activate(var/mob/living/carbon/mob,var/multiplier) mob.ear_deaf += 20 + mob.deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness /datum/disease2/effect/monkey name = "Genome Regression" @@ -288,6 +289,7 @@ /datum/disease2/effect/minordeaf/activate(var/mob/living/carbon/mob,var/multiplier) mob.ear_deaf = 5 + mob.deaf_loop.start(skip_start_sound = TRUE) // CHOMPStation Add: Ear Ringing/Deafness /datum/disease2/effect/giggle name = "Uncontrolled Laughter" diff --git a/maps/gateway_archive_vr/labyrinth.dm b/maps/gateway_archive_vr/labyrinth.dm index 94a88a68fc..68ded3cf5c 100644 --- a/maps/gateway_archive_vr/labyrinth.dm +++ b/maps/gateway_archive_vr/labyrinth.dm @@ -177,6 +177,7 @@ M.sleeping = 0 M.stuttering += 20 M.ear_deaf += 30 + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Weaken(3) if(prob(30)) M.Stun(10) @@ -365,4 +366,4 @@ icon_state = "x2" lootcount = 1 //how many items will be spawned lootdoubles = 0 //if the same item can be spawned twice - loot = "" //a list of possible items to spawn- a string of paths \ No newline at end of file + loot = "" //a list of possible items to spawn- a string of paths diff --git a/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm b/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm index ce38cf5bab..08fec16d9b 100644 --- a/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm +++ b/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_rig.dm @@ -357,6 +357,7 @@ H.SetBlinded(0) H.eye_blurry = 0 H.ear_deaf = 0 + H.deaf_loop.stop() // CHOMPStation Add: Ear Ringing/Deafness H.ear_damage = 0 H.heal_overall_damage(H.getActualBruteLoss(), H.getActualFireLoss(), 1) for(var/I in H.organs_by_name) @@ -573,4 +574,4 @@ if("l_hand") usr.unEquip(src) usr.put_in_l_hand(src) - src.add_fingerprint(usr) \ No newline at end of file + src.add_fingerprint(usr) diff --git a/modular_chomp/code/modules/mob/living/living.dm b/modular_chomp/code/modules/mob/living/living.dm index 2a5293fe94..09ac2f3762 100644 --- a/modular_chomp/code/modules/mob/living/living.dm +++ b/modular_chomp/code/modules/mob/living/living.dm @@ -1,3 +1,17 @@ +/mob/living + // var/ear_deaf_loop = FALSE // Are we already playing our deafened loop? Checked for safety so we don't deafen our players. (Not sure if we need this bc looping sounds datums have protection for starts being called repeatedly, commented out) + var/datum/looping_sound/mob/deafened/deaf_loop + +/mob/living/Initialize() + . = ..() + + deaf_loop = new(list(src), FALSE) + +/mob/living/Destroy() + . = ..() + + QDEL_NULL(deaf_loop) + /mob/living/proc/vs_animate(var/belly_to_animate) return @@ -14,4 +28,4 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc. /mob/living/New(var/newloc) ..() verbs |= /mob/living/proc/click_self -*/ \ No newline at end of file +*/ diff --git a/modular_chomp/code/modules/reagents/reagents/food_drinks.dm b/modular_chomp/code/modules/reagents/reagents/food_drinks.dm index 84ca7a4f97..0fc1857688 100644 --- a/modular_chomp/code/modules/reagents/reagents/food_drinks.dm +++ b/modular_chomp/code/modules/reagents/reagents/food_drinks.dm @@ -223,6 +223,7 @@ M.eye_blurry = max(M.eye_blurry, 30) if(prob(20)) M.ear_deaf = max(M.ear_deaf, 4) + M.deaf_loop.start() // CHOMPStation Add: Ear Ringing/Deafness M.Confuse(2) else M.Weaken(2) diff --git a/modular_chomp/sound/effects/ear_ring/ear_deaf_in.ogg b/modular_chomp/sound/effects/ear_ring/ear_deaf_in.ogg new file mode 100644 index 0000000000..80ccaa2501 Binary files /dev/null and b/modular_chomp/sound/effects/ear_ring/ear_deaf_in.ogg differ diff --git a/modular_chomp/sound/effects/ear_ring/ear_deaf_loop.ogg b/modular_chomp/sound/effects/ear_ring/ear_deaf_loop.ogg new file mode 100644 index 0000000000..ffa09e9794 Binary files /dev/null and b/modular_chomp/sound/effects/ear_ring/ear_deaf_loop.ogg differ diff --git a/modular_chomp/sound/effects/ear_ring/ear_deaf_out.ogg b/modular_chomp/sound/effects/ear_ring/ear_deaf_out.ogg new file mode 100644 index 0000000000..14e0c5af41 Binary files /dev/null and b/modular_chomp/sound/effects/ear_ring/ear_deaf_out.ogg differ diff --git a/vorestation.dme b/vorestation.dme index 9a2a765610..000f62e567 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -411,6 +411,7 @@ #include "code\datums\looping_sounds\environment_sounds.dm" #include "code\datums\looping_sounds\item_sounds.dm" #include "code\datums\looping_sounds\machinery_sounds.dm" +#include "code\datums\looping_sounds\mob_sounds.dm" #include "code\datums\looping_sounds\sequence.dm" #include "code\datums\looping_sounds\weather_sounds.dm" #include "code\datums\managed_browsers\_managed_browser.dm"