diff --git a/code/datums/explosion.dm b/code/datums/explosion.dm index dc9569a4d5..246226ceba 100644 --- a/code/datums/explosion.dm +++ b/code/datums/explosion.dm @@ -103,13 +103,21 @@ GLOBAL_LIST_EMPTY(explosions) // 3/7/14 will calculate to 80 + 35 var/far_dist = 0 - far_dist += heavy_impact_range * 5 + far_dist += heavy_impact_range * 15 // Large explosions carry further far_dist += devastation_range * 20 if(!silent) var/frequency = get_rand_frequency() var/sound/explosion_sound = sound(get_sfx("explosion")) var/sound/far_explosion_sound = sound('sound/effects/explosionfar.ogg') + var/sound/creaking_explosion_sound = sound(get_sfx("explosion_creaking")) + var/sound/hull_creaking_sound = sound(get_sfx("hull_creaking")) + var/sound/explosion_echo_sound = sound('sound/effects/explosion_distant.ogg') + var/on_station = SSmapping.level_trait(epicenter.z, ZTRAIT_STATION) + var/creaking_explosion = FALSE + + if(prob(devastation_range*30+heavy_impact_range*5) && on_station) // Huge explosions are near guaranteed to make the station creak and whine, smaller ones might. + creaking_explosion = TRUE // prob over 100 always returns true for(var/mob/M in GLOB.player_list) // Double check for client @@ -126,11 +134,29 @@ GLOBAL_LIST_EMPTY(explosions) shake_camera(M, 25, clamp(baseshakeamount, 0, 10)) // 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) - if(baseshakeamount > 0) + var/far_volume = clamp(far_dist/2, 40, 60) // Volume is based on explosion size and dist + if(creaking_explosion) + M.playsound_local(epicenter, null, far_volume, 1, frequency, S = creaking_explosion_sound, distance_multiplier = 0) + else if(prob(75)) + M.playsound_local(epicenter, null, far_volume, 1, frequency, S = far_explosion_sound, distance_multiplier = 0) // Far sound + else + M.playsound_local(epicenter, null, far_volume, 1, frequency, S = explosion_echo_sound, distance_multiplier = 0) // Echo sound + + if(baseshakeamount > 0 || devastation_range) + if(!baseshakeamount) // Devastating explosions rock the station and ground + baseshakeamount = devastation_range*3 shake_camera(M, 10, clamp(baseshakeamount*0.25, 0, 2.5)) + + else if(M.can_hear() && !isspaceturf(get_turf(M)) && heavy_impact_range) // Big enough explosions echo throughout the hull + var/echo_volume = 40 + if(devastation_range) + baseshakeamount = devastation_range + shake_camera(M, 10, clamp(baseshakeamount*0.25, 0, 2.5)) + echo_volume = 60 + M.playsound_local(epicenter, null, echo_volume, 1, frequency, S = explosion_echo_sound, distance_multiplier = 0) + + if(creaking_explosion) // 5 seconds after the bang, the station begins to creak + addtimer(CALLBACK(M, /mob/proc/playsound_local, epicenter, null, rand(25, 40), 1, frequency, null, null, FALSE, hull_creaking_sound, null, null, null, null, 0), 5 SECONDS) EX_PREPROCESS_CHECK_TICK //postpone processing for a bit diff --git a/code/game/sound.dm b/code/game/sound.dm index 0feb01c223..b012ba4e2a 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -130,6 +130,10 @@ /proc/get_sfx(soundin) if(istext(soundin)) switch(soundin) + if ("explosion_creaking") // from skyrat-ss13/skyrat13/pull/3295 + soundin = pick('sound/effects/explosioncreak1.ogg', 'sound/effects/explosioncreak2.ogg') + if ("hull_creaking") // from skyrat-ss13/skyrat13/pull/3295 + soundin = pick('sound/effects/creak1.ogg', 'sound/effects/creak2.ogg', 'sound/effects/creak3.ogg') if ("shatter") soundin = pick('sound/effects/glassbr1.ogg','sound/effects/glassbr2.ogg','sound/effects/glassbr3.ogg') if ("explosion") diff --git a/sound/effects/creak1.ogg b/sound/effects/creak1.ogg new file mode 100644 index 0000000000..0cad4802ff Binary files /dev/null and b/sound/effects/creak1.ogg differ diff --git a/sound/effects/creak2.ogg b/sound/effects/creak2.ogg new file mode 100644 index 0000000000..707bf39e33 Binary files /dev/null and b/sound/effects/creak2.ogg differ diff --git a/sound/effects/creak3.ogg b/sound/effects/creak3.ogg new file mode 100644 index 0000000000..88ff37a339 Binary files /dev/null and b/sound/effects/creak3.ogg differ diff --git a/sound/effects/explosioncreak1.ogg b/sound/effects/explosioncreak1.ogg new file mode 100644 index 0000000000..474f5febb5 Binary files /dev/null and b/sound/effects/explosioncreak1.ogg differ diff --git a/sound/effects/explosioncreak2.ogg b/sound/effects/explosioncreak2.ogg new file mode 100644 index 0000000000..75d323eb06 Binary files /dev/null and b/sound/effects/explosioncreak2.ogg differ