Improves several Sound Loops' Performance

This commit is contained in:
CitadelStationBot
2017-07-31 14:35:16 -05:00
parent f53d66b319
commit 3d53f888b1
6 changed files with 20 additions and 8 deletions

View File

@@ -96,7 +96,9 @@ GLOBAL_LIST_EMPTY(explosions)
if(!silent)
var/frequency = get_rand_frequency()
var/ex_sound = get_sfx("explosion")
var/sound/explosion_sound = sound(get_sfx("explosion"))
var/sound/far_explosion_sound = sound('sound/effects/explosionfar.ogg')
for(var/mob/M in GLOB.player_list)
// Double check for client
var/turf/M_turf = get_turf(M)
@@ -104,12 +106,12 @@ GLOBAL_LIST_EMPTY(explosions)
var/dist = get_dist(M_turf, epicenter)
// If inside the blast radius + world.view - 2
if(dist <= round(max_range + world.view - 2, 1))
M.playsound_local(epicenter, ex_sound, 100, 1, frequency, falloff = 5)
M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound)
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
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
M.playsound_local(epicenter, 'sound/effects/explosionfar.ogg', far_volume, 1, frequency, falloff = 5)
M.playsound_local(epicenter, null, far_volume, 1, frequency, falloff = 5, S = far_explosion_sound)
EX_PREPROCESS_CHECK_TICK
//postpone processing for a bit

View File

@@ -185,6 +185,9 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
/obj/effect/meteor/proc/meteor_effect()
if(heavy)
var/sound/meteor_sound = sound(meteorsound)
var/random_frequency = get_rand_frequency()
for(var/mob/M in GLOB.player_list)
if((M.orbiting) && (SSaugury.watchers[M]))
continue
@@ -193,7 +196,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
continue
var/dist = get_dist(M.loc, src.loc)
shake_camera(M, dist > 20 ? 2 : 4, dist > 20 ? 1 : 3)
M.playsound_local(src.loc, meteorsound, 50, 1, get_rand_frequency(), 10)
M.playsound_local(src.loc, null, 50, 1, random_frequency, 10, S = meteor_sound)
///////////////////////
//Meteor types

View File

@@ -456,10 +456,12 @@
if(charge<35)
charge += 1
if(world.time < stop && active)
var/sound/song_played = sound(selection.song_path)
for(var/mob/M in range(10,src))
if(!(M in rangers))
rangers[M] = TRUE
M.playsound_local(get_turf(M), selection.song_path, 100, channel = CHANNEL_JUKEBOX)
M.playsound_local(get_turf(M), null, 100, channel = CHANNEL_JUKEBOX, S = song_played)
if(prob(5+(allowed(M)*4)) && M.canmove)
dance(M)
for(var/mob/L in rangers)

View File

@@ -71,9 +71,11 @@
continue
LAZYADD(hearing_mobs, M)
last_hearcheck = world.time
var/sound/music_played = sound(soundfile)
for(var/i in hearing_mobs)
var/mob/M = i
M.playsound_local(source, soundfile, 100, falloff = 5)
M.playsound_local(source, null, 100, falloff = 5, S = music_played)
/datum/song/proc/updateDialog(mob/user)
instrumentObj.updateDialog() // assumes it's an object in world, override if otherwise

View File

@@ -372,13 +372,14 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne
// Shake everyone on the z level to let them know that gravity was enagaged/disenagaged.
/obj/machinery/gravity_generator/main/proc/shake_everyone()
var/turf/T = get_turf(src)
var/sound/alert_sound = sound('sound/effects/alert.ogg')
for(var/mob/M in GLOB.mob_list)
if(M.z != z)
continue
M.update_gravity(M.mob_has_gravity())
if(M.client)
shake_camera(M, 15, 1)
M.playsound_local(T, 'sound/effects/alert.ogg', 100, 1, 0.5)
M.playsound_local(T, null, 100, 1, 0.5, S = alert_sound)
/obj/machinery/gravity_generator/main/proc/gravity_in_level()
var/turf/T = get_turf(src)

View File

@@ -175,10 +175,12 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate)
else
message_admins("[user ? key_name_admin(user):"Unknown"] has released Legion!")
log_game("[user ? key_name(user):"Unknown"] released Legion.")
var/sound/legion_sound = sound('sound/creatures/legion_spawn.ogg')
for(var/mob/M in GLOB.player_list)
if(M.z == z)
to_chat(M, "<span class='userdanger'>Discordant whispers flood your mind in a thousand voices. Each one speaks your name, over and over. Something horrible has been released.</span>")
M.playsound_local(T, 'sound/creatures/legion_spawn.ogg', 100, FALSE, 0, FALSE, pressure_affected = FALSE)
M.playsound_local(T, null, 100, FALSE, 0, FALSE, pressure_affected = FALSE, S = legion_sound)
flash_color(M, flash_color = "#FF0000", flash_time = 50)
var/mutable_appearance/release_overlay = mutable_appearance('icons/effects/effects.dmi', "legiondoor")
notify_ghosts("Legion has been released in the [get_area(src)]!", source = src, alert_overlay = release_overlay, action = NOTIFY_JUMP)