From a57eba6a16e49194a9798702e2f39905a95fb9eb Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 31 Dec 2017 03:32:38 -0500 Subject: [PATCH] Explosions now cause camera shake based on distance (#33570) * Explosions now cause camera shake based on distance * Explosion close camera shake down to 2.5s * Explosion camera shake max 100 close intensity, 50 far --- code/datums/explosion.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/datums/explosion.dm b/code/datums/explosion.dm index 73b76a9155..85a8e40863 100644 --- a/code/datums/explosion.dm +++ b/code/datums/explosion.dm @@ -55,6 +55,8 @@ GLOBAL_LIST_EMPTY(explosions) var/orig_heavy_range = heavy_impact_range var/orig_light_range = light_impact_range + var/orig_max_distance = max(devastation_range, heavy_impact_range, light_impact_range, flash_range, flame_range) + //Zlevel specific bomb cap multiplier var/cap_multiplier = 1 switch(epicenter.z) @@ -119,11 +121,13 @@ GLOBAL_LIST_EMPTY(explosions) // If inside the blast radius + world.view - 2 if(dist <= round(max_range + world.view - 2, 1)) M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound) + shake_camera(M, 25, min(orig_max_distance - dist, 100)) // 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, null, far_volume, 1, frequency, falloff = 5, S = far_explosion_sound) + shake_camera(M, 10, min(orig_max_distance - dist, 50)) EX_PREPROCESS_CHECK_TICK //postpone processing for a bit