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 a651541870..d49a825775 100644 --- a/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm +++ b/modular_citadel/code/modules/vore/eating/belly_obj_vr.dm @@ -48,6 +48,8 @@ var/tmp/list/items_preserved = list() // Stuff that wont digest so we shouldn't process it again. var/tmp/next_emote = 0 // When we're supposed to print our next emote, as a belly controller tick # var/tmp/recent_sound = FALSE // Prevent audio spam + var/tmp/last_hearcheck = 0 + var/tmp/list/hearing_mobs // Don't forget to watch your commas at the end of each line if you change these. var/list/struggle_messages_outside = list( @@ -228,7 +230,7 @@ SEND_SIGNAL(ML, COMSIG_CLEAR_MOOD_EVENT, "fedprey", /datum/mood_event/fedprey) SEND_SIGNAL(OW, COMSIG_ADD_MOOD_EVENT, "emptypred", /datum/mood_event/emptypred) SEND_SIGNAL(ML, COMSIG_ADD_MOOD_EVENT, "emptyprey", /datum/mood_event/emptyprey) - + if(ML.absorbed) ML.absorbed = FALSE if(ishuman(M) && ishuman(OW)) @@ -252,14 +254,14 @@ return if (prey.buckled) prey.buckled.unbuckle_mob(prey,TRUE) - + if(!isbelly(prey.loc)) SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "fedpred", /datum/mood_event/fedpred) SEND_SIGNAL(prey, COMSIG_ADD_MOOD_EVENT, "fedprey", /datum/mood_event/fedprey) else SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "emptypred", /datum/mood_event/emptypred) SEND_SIGNAL(prey, COMSIG_CLEAR_MOOD_EVENT, "emptyprey", /datum/mood_event/emptyprey) - + prey.forceMove(src) var/sound/preyloop = sound('sound/vore/prey/loop.ogg', repeat = TRUE) if(!silent) diff --git a/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm b/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm index 8b8781cb02..804936087e 100644 --- a/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm +++ b/modular_citadel/code/modules/vore/eating/bellymodes_vr.dm @@ -1,3 +1,5 @@ +#define NORMIE_HEARCHECK 4 + // Process the predator's effects upon the contents of its belly (i.e digestion/transformation etc) /obj/belly/proc/process_belly(var/times_fired,var/wait) //Passed by controller if((times_fired < next_process) || !contents.len) @@ -45,6 +47,7 @@ ////////////////////////// Sound vars ///////////////////////////// var/sound/prey_digest = sound(get_sfx("digest_prey")) var/sound/prey_death = sound(get_sfx("death_prey")) + var/turf/source = get_turf(owner) ///////////////////////////// DM_HOLD ///////////////////////////// @@ -55,12 +58,17 @@ else if(digest_mode == DM_DIGEST) for (var/mob/living/M in contents) if(prob(25)) - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"digest_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_DIGEST) - M.playsound_local(get_turf(M), prey_digest, 45) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "digest_pred") + M.playsound_local(source, null, 45, falloff = 0, S = prey_digest) //Pref protection! if (!M.digestable || M.absorbed) @@ -86,13 +94,18 @@ M.visible_message("You watch as [owner]'s form loses its additions.") owner.nutrition += 400 // so eating dead mobs gives you *something*. - M.stop_sound_channel(DIGESTION_NOISES) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"death_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(DIGESTION_NOISES) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "death_pred") + M.playsound_local(source, null, 65, falloff = 0, S = prey_death) M.stop_sound_channel(CHANNEL_PREYLOOP) - M.playsound_local(get_turf(M), prey_death, 65) digestion_death(M) owner.update_icons() continue @@ -115,12 +128,17 @@ if(digest_mode == DM_HEAL) for (var/mob/living/M in contents) if(prob(25)) - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"digest_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_DIGEST) - M.playsound_local(get_turf(M), prey_digest, 65) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "digest_pred") + M.playsound_local(source, null, 45, falloff = 0, S = prey_digest) if(M.stat != DEAD) if(owner.nutrition >= NUTRITION_LEVEL_STARVING && (M.health < M.maxHealth)) @@ -134,12 +152,17 @@ if(digest_mode == DM_NOISY) for (var/mob/living/M in contents) if(prob(35)) - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"digest_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_PRED) - M.playsound_local(get_turf(M), prey_digest, 65) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "digest_pred") + M.playsound_local(source, null, 45, falloff = 0, S = prey_digest) //////////////////////////// DM_ABSORB //////////////////////////// @@ -147,13 +170,18 @@ for (var/mob/living/M in contents) - if(prob(10)) //Less often than gurgles. People might leave this on forever. - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"digest_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_PRED) - M.playsound_local(get_turf(M), prey_digest, 65) + if(prob(10))//Less often than gurgles. People might leave this on forever. + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "digest_pred") + M.playsound_local(source, null, 45, falloff = 0, S = prey_digest) if(M.absorbed) continue @@ -180,12 +208,17 @@ if(digest_mode == DM_DRAGON) for (var/mob/living/M in contents) if(prob(55)) //if you're hearing this, you're a vore ho anyway. - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"digest_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_DIGEST) - M.playsound_local(get_turf(M), prey_digest, 65) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "digest_pred") + M.playsound_local(source, null, 45, falloff = 0, S = prey_digest) //No digestion protection for megafauna. @@ -207,13 +240,17 @@ to_chat(owner, "[digest_alert_owner]") to_chat(M, "[digest_alert_prey]") M.visible_message("You watch as [owner]'s guts loudly rumble as it finishes off a meal.") - - M.stop_sound_channel(CHANNEL_DIGEST) - for(var/mob/H in get_hearers_in_view(5, get_turf(owner))) - if(H.client && H.client.prefs.cit_toggles & DIGESTION_NOISES) - playsound(get_turf(owner),"death_pred",50,0,-5,0,ignore_walls = FALSE,channel=CHANNEL_DIGEST) - M.stop_sound_channel(CHANNEL_DIGEST) - M.playsound_local(get_turf(M), prey_death, 65) + 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) && !isbelly(H.loc)) + continue + LAZYADD(hearing_mobs, H) + last_hearcheck = world.time + for(M in hearing_mobs) + var/mob/i = M + i.playsound_local(source, null, 45, falloff = 0, S = "death_pred") + M.playsound_local(source, null, 65, falloff = 0, S = prey_death) M.spill_organs(FALSE,TRUE,TRUE) M.stop_sound_channel(CHANNEL_PREYLOOP) digestion_death(M)