mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
performance
This commit is contained in:
@@ -171,14 +171,18 @@
|
||||
|
||||
/obj/effect/meteor/proc/meteor_effect(var/sound=1)
|
||||
if(sound)
|
||||
for(var/mob/M in player_list)
|
||||
var/sound/meteor_sound = sound(meteorsound)
|
||||
var/random_frequency = get_rand_frequency()
|
||||
|
||||
for(var/P in player_list)
|
||||
var/mob/M = P
|
||||
var/turf/T = get_turf(M)
|
||||
if(!T || T.z != src.z)
|
||||
continue
|
||||
var/dist = get_dist(M.loc, src.loc)
|
||||
if(prob(50))
|
||||
shake_camera(M, dist > 20 ? 3 : 5, 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
|
||||
|
||||
@@ -40,7 +40,11 @@
|
||||
|
||||
if(!silent)
|
||||
var/frequency = get_rand_frequency()
|
||||
for(var/mob/M in player_list)
|
||||
var/sound/explosion_sound = sound(get_sfx("explosion"))
|
||||
var/sound/global_boom = sound('sound/effects/explosionfar.ogg')
|
||||
|
||||
for(var/P in player_list)
|
||||
var/mob/M = P
|
||||
// Double check for client
|
||||
if(M && M.client)
|
||||
var/turf/M_turf = get_turf(M)
|
||||
@@ -48,20 +52,10 @@
|
||||
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, get_sfx("explosion"), 100, 1, frequency, falloff = 5) // get_sfx() is so that everyone gets the same sound
|
||||
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)
|
||||
|
||||
var/close = range(world.view+round(devastation_range,1), epicenter)
|
||||
// to all distanced mobs play a different sound
|
||||
for(var/mob/M in mob_list)
|
||||
if(M.z == epicenter.z && !(M in close))
|
||||
// check if the mob can hear
|
||||
if(M.can_hear() && !istype(M.loc,/turf/space))
|
||||
M << 'sound/effects/explosionfar.ogg'
|
||||
else if(M.can_hear() && !isspaceturf(M.loc))
|
||||
M << global_boom
|
||||
|
||||
if(heavy_impact_range > 1)
|
||||
if(smoke)
|
||||
|
||||
@@ -57,10 +57,11 @@
|
||||
return
|
||||
// and play
|
||||
var/turf/source = get_turf(instrumentObj)
|
||||
var/sound/music_played = sound(soundfile)
|
||||
for(var/mob/M in hearers(15, source))
|
||||
if(!M.client || !(M.client.prefs.sound & SOUND_INSTRUMENTS))
|
||||
continue
|
||||
M.playsound_local(source, soundfile, 100, falloff = 5)
|
||||
M.playsound_local(source, null, 100, falloff = 5, S = music_played)
|
||||
|
||||
/datum/song/proc/shouldStopPlaying(mob/user)
|
||||
if(instrumentObj)
|
||||
|
||||
@@ -373,13 +373,15 @@ var/const/GRAV_NEEDS_WRENCH = 3
|
||||
// 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/our_turf = get_turf(src)
|
||||
for(var/mob/M in mob_list)
|
||||
var/sound/alert_sound = sound('sound/effects/alert.ogg')
|
||||
for(var/shaked in mob_list)
|
||||
var/mob/M = shaked
|
||||
var/turf/their_turf = get_turf(M)
|
||||
if(their_turf && their_turf.z == our_turf.z)
|
||||
M.update_gravity(M.mob_has_gravity())
|
||||
if(M.client)
|
||||
shake_camera(M, 15, 1)
|
||||
M.playsound_local(our_turf, 'sound/effects/alert.ogg', 100, 1, 0.5)
|
||||
M.playsound_local(our_turf, null, 100, 1, 0.5, S = alert_sound)
|
||||
|
||||
// TODO: Make the gravity generator cooperate with the space manager
|
||||
/obj/machinery/gravity_generator/main/proc/gravity_in_level()
|
||||
|
||||
Reference in New Issue
Block a user