Merge pull request #7625 from Poojawa/patch-2

Medihound Tweaks and Sound Preference improvements
This commit is contained in:
deathride58
2018-10-10 23:59:29 -04:00
committed by GitHub
4 changed files with 144 additions and 71 deletions
@@ -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(
@@ -167,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
@@ -200,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("<font color='green'><b>[owner] expels everything from their [lowertext(name)]!</b></font>")
@@ -220,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))
@@ -296,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)
@@ -510,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"))
@@ -45,6 +45,9 @@
////////////////////////// Sound vars /////////////////////////////
var/sound/prey_digest = sound(get_sfx("digest_prey"))
var/sound/prey_death = sound(get_sfx("death_prey"))
var/sound/pred_digest = sound(get_sfx("digest_pred"))
var/sound/pred_death = sound(get_sfx("death_pred"))
var/turf/source = get_turf(owner)
///////////////////////////// DM_HOLD /////////////////////////////
@@ -55,12 +58,18 @@
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))
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)
//Pref protection!
if (!M.digestable || M.absorbed)
@@ -86,13 +95,19 @@
M.visible_message("<span class='notice'>You watch as [owner]'s form loses its additions.</span>")
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))
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_death)
else if(H in contents)
H.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 +130,18 @@
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))
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)
if(M.stat != DEAD)
if(owner.nutrition >= NUTRITION_LEVEL_STARVING && (M.health < M.maxHealth))
@@ -132,14 +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))
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(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 ////////////////////////////
@@ -147,13 +173,19 @@
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))
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)
if(M.absorbed)
continue
@@ -180,12 +212,18 @@
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))
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)
//No digestion protection for megafauna.
@@ -207,13 +245,18 @@
to_chat(owner, "<span class='warning'>[digest_alert_owner]</span>")
to_chat(M, "<span class='warning'>[digest_alert_prey]</span>")
M.visible_message("<span class='notice'>You watch as [owner]'s guts loudly rumble as it finishes off a meal.</span>")
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))
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_death)
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)
digestion_death(M)