From 47fa8353ebebeb9414c1e34a88364c1a8a0a8c1c Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Thu, 18 May 2017 01:39:16 -0500 Subject: [PATCH] [MIRROR] Moves playsound_local() to mob and gets rid of a useless proc. (#710) * Moves playsound_local() to mob and gets rid of a useless proc. * Fixes compile errors --- code/game/machinery/dance_machine.dm | 2 +- code/game/objects/effects/step_triggers.dm | 5 +++-- code/game/sound.dm | 13 ++++--------- code/modules/flufftext/Hallucination.dm | 8 ++++---- code/modules/vore/eating/belly_vr.dm | 2 +- code/modules/vore/eating/bellymodes_vr.dm | 6 +++--- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index cf18a99875..3e36776773 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -85,7 +85,7 @@ return if(!allowed(user)) to_chat(user,"Error: Access Denied - Message: Only the engineering department can be trusted with this kind of power.") - playsound_local(src,'sound/misc/compiler-failure.ogg', 25, 1) + user.playsound_local(src,'sound/misc/compiler-failure.ogg', 25, 1) return if(!Adjacent(user) && !isAI(user)) return diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index 63b5075cc7..6bd4db9a8d 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -183,8 +183,9 @@ if(!T) return - if(triggerer_only) - A.playsound_local(T, sound, volume, freq_vary) + if(triggerer_only && ismob(A)) + var/mob/B = A + B.playsound_local(T, sound, volume, freq_vary) else playsound(T, sound, volume, freq_vary, extra_range) diff --git a/code/game/sound.dm b/code/game/sound.dm index 448f3cd85b..af5394ea2a 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -23,10 +23,10 @@ if(T && T.z == turf_source.z) M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, surround, channel, pressure_affected) -/atom/proc/playsound_direct(soundin, vol as num, vary, frequency, falloff, surround = TRUE, channel = 0, pressure_affected = FALSE) - playsound_local(get_turf(src), soundin, vol, vary, frequency, falloff, surround, channel) +/mob/proc/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff, surround = 1, channel = 0, pressure_affected = TRUE) + if(!client || !can_hear()) + return -/atom/proc/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff, surround = 1, channel = 0, pressure_affected = TRUE) soundin = get_sfx(soundin) var/sound/S = sound(soundin) @@ -76,15 +76,10 @@ // The y value is for above your head, but there is no ceiling in 2d spessmens. S.y = 1 - S.falloff = (falloff ? falloff : FALLOFF_SOUNDS) + S.falloff = falloff || FALLOFF_SOUNDS src << S -/mob/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff, surround = 1, channel = 0, pressure_affected = TRUE) - if(!client || !can_hear()) - return - ..() - /proc/open_sound_channel() var/static/next_channel = 1 //loop through the available 1024 - (the ones we reserve) channels and pray that its not still being used . = ++next_channel diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 4c1328a38b..9710098c5f 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -356,9 +356,9 @@ Gunshots/explosions/opening doors/less rare audio (done) for(var/i=0,i[struggle_outer_message]", "[struggle_user_message]") playsound(get_turf(owner),"struggle_sound",75,0,-5,1,channel=51) R.stop_sound_channel(51) - R.playsound_direct("prey_struggle_sound",60) + R.playsound_local("prey_struggle_sound",60) if(escapable && R.a_intent != "help") //If the stomach has escapable enabled and the person is actually trying to kick out to_chat(R, "You attempt to climb out of \the [name].") diff --git a/code/modules/vore/eating/bellymodes_vr.dm b/code/modules/vore/eating/bellymodes_vr.dm index 12dd76a3fd..1438f5b027 100644 --- a/code/modules/vore/eating/bellymodes_vr.dm +++ b/code/modules/vore/eating/bellymodes_vr.dm @@ -23,7 +23,7 @@ M.stop_sound_channel(CHANNEL_PRED) playsound(get_turf(owner),"digest_pred",75,0,-6,1,channel=CHANNEL_PRED) M.stop_sound_channel(CHANNEL_PRED) - M.playsound_direct("digest_prey",60) + M.playsound_local("digest_prey",60) //Pref protection! if (!M.digestable) @@ -51,7 +51,7 @@ M.stop_sound_channel(CHANNEL_PRED) playsound(get_turf(owner),"death_pred",50,0,-6,1,channel=CHANNEL_PRED) M.stop_sound_channel(CHANNEL_PRED) - M.playsound_direct("death_prey",60) + M.playsound_local("death_prey",60) digestion_death(M) owner.update_icons() continue @@ -70,7 +70,7 @@ M.stop_sound_channel(CHANNEL_PRED) playsound(get_turf(owner),"digest_pred",50,0,-6,1,channel=CHANNEL_PRED) M.stop_sound_channel(CHANNEL_PRED) - M.playsound_direct("digest_prey",60) + M.playsound_local("digest_prey",60) if(M.stat != DEAD) if(owner.nutrition >= NUTRITION_LEVEL_STARVING && (M.health < M.maxHealth))