From c638a2783a70fe85bde687bd9e94e8532fd4d5a1 Mon Sep 17 00:00:00 2001 From: Poojawa Date: Mon, 8 Oct 2018 20:43:26 -0500 Subject: [PATCH] improves accuracy of playsounds removes excessively defined for (var/mob/living/M in contents) that didn't need it --- .../objects/items/devices/dogborg_sleeper.dm | 31 +++++++-------- .../code/modules/vore/eating/belly_obj_vr.dm | 10 ++--- .../code/modules/vore/eating/bellymodes_vr.dm | 39 +++++++++---------- 3 files changed, 39 insertions(+), 41 deletions(-) diff --git a/code/game/objects/items/devices/dogborg_sleeper.dm b/code/game/objects/items/devices/dogborg_sleeper.dm index bbac39afff..30a3e5a9a2 100644 --- a/code/game/objects/items/devices/dogborg_sleeper.dm +++ b/code/game/objects/items/devices/dogborg_sleeper.dm @@ -315,7 +315,7 @@ for(var/mob/H in hearing_mobs) if(!istype(H.loc, /obj/item/dogborg/sleeper)) H.playsound_local(source, null, 45, falloff = 0, S = pred_death) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_death) for(var/belly in T.vore_organs) var/obj/belly/B = belly @@ -350,21 +350,20 @@ update_gut() //sound effects - for(var/mob/living/M in contents) - if(prob(50)) - if((world.time - NORMIE_HEARCHECK) > last_hearcheck) - var/turf/source = get_turf(hound) - LAZYCLEARLIST(hearing_mobs) - for(var/mob/H in get_hearers_in_view(3, source)) - if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES)) - continue - LAZYADD(hearing_mobs, H) - last_hearcheck = world.time - for(var/mob/H in hearing_mobs) - if(!istype(H.loc, /obj/item/dogborg/sleeper)) - H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else - H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) + if(prob(50)) + if((world.time - NORMIE_HEARCHECK) > last_hearcheck) + var/turf/source = get_turf(hound) + LAZYCLEARLIST(hearing_mobs) + for(var/mob/H in get_hearers_in_view(3, source)) + if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(var/mob/H in hearing_mobs) + if(!istype(H.loc, /obj/item/dogborg/sleeper)) + H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) + else if(H in contents) + H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) if(cleaning) addtimer(CALLBACK(src, .proc/clean_cycle), 50) diff --git a/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm b/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm index ec75731411..1aa8122be5 100644 --- a/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm +++ b/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm @@ -169,7 +169,7 @@ //Sound w/ antispam flag setting if(!silent && !recent_sound) for(var/mob/M in get_hearers_in_view(5, get_turf(owner))) - if(M.client && M.client.prefs.cit_toggles & EATING_NOISES) + if(M.client && (M.client.prefs.cit_toggles & EATING_NOISES)) playsound(get_turf(owner),"[src.vore_sound]",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_PRED) recent_sound = TRUE @@ -202,7 +202,7 @@ AM.forceMove(destination) // Move the belly contents into the same location as belly's owner. count++ for(var/mob/M in get_hearers_in_view(5, get_turf(owner))) - if(M.client && M.client.prefs.cit_toggles & EATING_NOISES) + if(M.client && (M.client.prefs.cit_toggles & EATING_NOISES)) playsound(get_turf(owner),"[src.release_sound]",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_PRED) if(!silent) owner.visible_message("[owner] expels everything from their [lowertext(name)]!") @@ -222,7 +222,7 @@ items_preserved -= M if(release_sound) for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & EATING_NOISES) + if(H.client && (H.client.prefs.cit_toggles & EATING_NOISES)) playsound(get_turf(owner),"[src.release_sound]",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_PRED) if(istype(M,/mob/living)) @@ -298,7 +298,7 @@ target.nom_mob(content, target.owner) if(!silent) for(var/mob/M in get_hearers_in_view(5, get_turf(owner))) - if(M.client && M.client.prefs.cit_toggles & EATING_NOISES) + if(M.client && (M.client.prefs.cit_toggles & EATING_NOISES)) playsound(get_turf(owner),"[src.vore_sound]",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_PRED) owner.updateVRPanel() for(var/mob/living/M in contents) @@ -512,7 +512,7 @@ if(!silent) for(var/mob/M in get_hearers_in_view(5, get_turf(owner))) - if(M.client && M.client.prefs.cit_toggles & EATING_NOISES) + if(M.client && (M.client.prefs.cit_toggles & EATING_NOISES)) playsound(get_turf(owner),"struggle_sound",35,0,-5,1,ignore_walls = FALSE,channel=CHANNEL_PRED) R.stop_sound_channel(CHANNEL_PRED) var/sound/prey_struggle = sound(get_sfx("prey_struggle")) diff --git a/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm b/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm index 54c3df6cbd..6c528f75a9 100644 --- a/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm +++ b/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm @@ -68,7 +68,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) //Pref protection! @@ -105,7 +105,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_death) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_death) M.stop_sound_channel(CHANNEL_PREYLOOP) digestion_death(M) @@ -140,7 +140,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) if(M.stat != DEAD) @@ -153,20 +153,19 @@ ////////////////////////// DM_NOISY ///////////////////////////////// //for when you just want people to squelch around if(digest_mode == DM_NOISY) - for (var/mob/living/M in contents) - if(prob(35)) - if((world.time - NORMIE_HEARCHECK) > last_hearcheck) - LAZYCLEARLIST(hearing_mobs) - for(var/mob/H in get_hearers_in_view(3, source)) - if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES)) - continue - LAZYADD(hearing_mobs, H) - last_hearcheck = world.time - for(var/mob/H in hearing_mobs) - if(!isbelly(H.loc)) - H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else - H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) + if(prob(35)) + if((world.time - NORMIE_HEARCHECK) > last_hearcheck) + LAZYCLEARLIST(hearing_mobs) + for(var/mob/H in get_hearers_in_view(3, source)) + if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(var/mob/H in hearing_mobs) + if(!isbelly(H.loc)) + H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) + else if(H in contents) + H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) //////////////////////////// DM_ABSORB //////////////////////////// @@ -185,7 +184,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) if(M.absorbed) @@ -223,7 +222,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_digest) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_digest) //No digestion protection for megafauna. @@ -256,7 +255,7 @@ for(var/mob/H in hearing_mobs) if(!isbelly(H.loc)) H.playsound_local(source, null, 45, falloff = 0, S = pred_death) - else + else if(H in contents) H.playsound_local(source, null, 65, falloff = 0, S = prey_death) M.spill_organs(FALSE,TRUE,TRUE) M.stop_sound_channel(CHANNEL_PREYLOOP)