Broad TG Sound Update (#15608)

* Broad TG Sound Update

* jester update
This commit is contained in:
Fox McCloud
2021-02-27 06:59:33 -05:00
committed by GitHub
parent d510702d4f
commit f65c8994ce
58 changed files with 251 additions and 138 deletions
@@ -25,7 +25,7 @@
/obj/effect/particle_effect/sparks/New()
..()
flick("sparks", src) // replay the animation
playsound(loc, "sparks", 100, 1)
playsound(src, "sparks", 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
var/turf/T = loc
if(isturf(T))
T.hotspot_expose(hotspottemp, 100)
+82 -26
View File
@@ -1,13 +1,27 @@
//TODO: Flash range does nothing currently
#define CREAK_DELAY 5 SECONDS //Time taken for the creak to play after explosion, if applicable.
#define DEVASTATION_PROB 30 //The probability modifier for devistation, maths!
#define HEAVY_IMPACT_PROB 5 //ditto
#define FAR_UPPER 60 //Upper limit for the far_volume, distance, clamped.
#define FAR_LOWER 40 //lower limit for the far_volume, distance, clamped.
#define PROB_SOUND 75 //The probability modifier for a sound to be an echo, or a far sound. (0-100)
#define SHAKE_CLAMP 2.5 //The limit for how much the camera can shake for out of view booms.
#define FREQ_UPPER 40 //The upper limit for the randomly selected frequency.
#define FREQ_LOWER 25 //The lower of the above.
/proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1, ignorecap = 0, flame_range = 0, silent = 0, smoke = 1, cause = null, breach = TRUE)
epicenter = get_turf(epicenter)
if(!epicenter)
return
// Archive the uncapped explosion for the doppler array
var/orig_dev_range = devastation_range
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)
if(!ignorecap)
// Clamp all values to MAX_EXPLOSION_RANGE
devastation_range = min (GLOB.max_ex_devastation_range, devastation_range)
@@ -16,17 +30,21 @@
flash_range = min (GLOB.max_ex_flash_range, flash_range)
flame_range = min (GLOB.max_ex_flame_range, flame_range)
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range)
spawn(0)
var/watch = start_watch()
if(!epicenter) return
var/max_range = max(devastation_range, heavy_impact_range, light_impact_range, flame_range)
var/list/cached_exp_block = list()
if(adminlog)
message_admins("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] [cause ? "(Cause: [cause])" : ""] [ADMIN_COORDJMP(epicenter)] ")
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range], [flame_range]) in area [epicenter.loc.name] [cause ? "(Cause: [cause])" : ""] [COORD(epicenter)] ")
var/x0 = epicenter.x
var/y0 = epicenter.y
var/z0 = epicenter.z
// Play sounds; we want sounds to be different depending on distance so we will manually do it ourselves.
// Stereo users will also hear the direction of the explosion!
@@ -34,41 +52,69 @@
// 3/7/14 will calculate to 80 + 35
var/far_dist = 0
far_dist += heavy_impact_range * 5
far_dist += heavy_impact_range * 15
far_dist += devastation_range * 20
if(!silent)
var/frequency = get_rand_frequency()
var/sound/explosion_sound = sound(get_sfx("explosion"))
var/sound/global_boom = sound('sound/effects/explosionfar.ogg')
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 = is_station_level(epicenter.z)
var/creaking_explosion = FALSE
for(var/P in GLOB.player_list)
var/mob/M = P
if(prob(devastation_range * DEVASTATION_PROB + heavy_impact_range * HEAVY_IMPACT_PROB) && 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/MN in GLOB.player_list)
var/mob/M = MN
// Double check for client
if(M && M.client)
var/turf/M_turf = get_turf(M)
if(M_turf && M_turf.z == epicenter.z)
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, 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(M.can_hear() && !isspaceturf(M.loc))
M << global_boom
var/turf/M_turf = get_turf(M)
if(M_turf && M_turf.z == z0)
var/dist = get_dist(M_turf, epicenter)
var/baseshakeamount
if(orig_max_distance - dist > 0)
baseshakeamount = sqrt((orig_max_distance - dist) * 0.1)
// 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, S = explosion_sound)
if(baseshakeamount > 0)
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 / 2, FAR_LOWER, FAR_UPPER) // 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(PROB_SOUND)) // Sound variety during meteor storm/tesloose/other bad event
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, SHAKE_CLAMP))
else if(!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, SHAKE_CLAMP))
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(FREQ_LOWER, FREQ_UPPER), 1, frequency, null, null, FALSE, hull_creaking_sound, 0), CREAK_DELAY)
if(heavy_impact_range > 1)
var/datum/effect_system/explosion/E
if(smoke)
var/datum/effect_system/explosion/smoke/E = new/datum/effect_system/explosion/smoke()
E.set_up(epicenter)
E.start()
E = new /datum/effect_system/explosion/smoke
else
var/datum/effect_system/explosion/E = new/datum/effect_system/explosion()
E.set_up(epicenter)
E.start()
var/x0 = epicenter.x
var/y0 = epicenter.y
var/z0 = epicenter.z
E = new
E.set_up(epicenter)
E.start()
var/list/affected_turfs = spiral_range_turfs(max_range, epicenter)
@@ -226,3 +272,13 @@
for(var/turf/T in wipe_colours)
T.color = null
T.maptext = ""
#undef CREAK_DELAY
#undef DEVASTATION_PROB
#undef HEAVY_IMPACT_PROB
#undef FAR_UPPER
#undef FAR_LOWER
#undef PROB_SOUND
#undef SHAKE_CLAMP
#undef FREQ_UPPER
#undef FREQ_LOWER
+2
View File
@@ -33,6 +33,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
var/pickup_sound
///Sound uses when dropping the item, or when its thrown.
var/drop_sound
///Whether or not we use stealthy audio levels for this item's attack sounds
var/stealthy_audio = FALSE
var/list/attack_verb //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]"
var/w_class = WEIGHT_CLASS_NORMAL
@@ -222,7 +222,7 @@
/obj/item/lightreplacer/proc/Emag()
emagged = !emagged
playsound(loc, "sparks", 100, TRUE)
playsound(loc, "sparks", 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
if(emagged)
name = "shortcircuited [initial(name)]"
else
@@ -254,9 +254,9 @@ effective or pretty fucking useless.
var/turf/fragging_location = destination
telefrag(fragging_location, user)
C.forceMove(destination)
playsound(mobloc, "sparks", 50, TRUE)
playsound(mobloc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
new/obj/effect/temp_visual/teleport_abductor/syndi_teleporter(mobloc)
playsound(destination, "sparks", 50, TRUE)
playsound(destination, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
new/obj/effect/temp_visual/teleport_abductor/syndi_teleporter(destination)
else if (EMP_D == FALSE && !(bagholding.len && !flawless)) // This is where the fun begins
var/direction = get_dir(user, destination)
@@ -315,10 +315,10 @@ effective or pretty fucking useless.
var/turf/fragging_location = new_destination
telefrag(fragging_location, user)
C.forceMove(new_destination)
playsound(mobloc, "sparks", 50, TRUE)
playsound(mobloc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
new /obj/effect/temp_visual/teleport_abductor/syndi_teleporter(mobloc)
new /obj/effect/temp_visual/teleport_abductor/syndi_teleporter(new_destination)
playsound(new_destination, "sparks", 50, TRUE)
playsound(new_destination, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
else //We tried to save. We failed. Death time.
get_fragged(user, destination)
@@ -326,10 +326,10 @@ effective or pretty fucking useless.
/obj/item/teleporter/proc/get_fragged(mob/user, turf/destination)
var/turf/mobloc = get_turf(user)
user.forceMove(destination)
playsound(mobloc, "sparks", 50, TRUE)
playsound(mobloc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
new /obj/effect/temp_visual/teleport_abductor/syndi_teleporter(mobloc)
new /obj/effect/temp_visual/teleport_abductor/syndi_teleporter(destination)
playsound(destination, "sparks", 50, TRUE)
playsound(destination, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
playsound(destination, "sound/magic/disintegrate.ogg", 50, TRUE)
destination.ex_act(rand(1,2))
for(var/obj/item/W in user)
@@ -25,7 +25,7 @@
/obj/item/bikehorn/Initialize()
. = ..()
AddComponent(/datum/component/squeak, honk_sounds, 50)
AddComponent(/datum/component/squeak, honk_sounds, 50, falloff_exponent = 20) //die off quick please
/obj/item/bikehorn/airhorn
name = "air horn"
@@ -4,6 +4,7 @@
var/throwforce_on = 20
var/faction_bonus_force = 0 //Bonus force dealt against certain factions
var/list/nemesis_factions //Any mob with a faction that exists in this list will take bonus damage/effects
stealthy_audio = TRUE //Most of these are antag weps so we dont want them to be /too/ overt.
w_class = WEIGHT_CLASS_SMALL
var/w_class_on = WEIGHT_CLASS_BULKY
var/icon_state_on
@@ -76,7 +76,7 @@
if(istype(weapon, /obj/item/melee/energy/blade))
do_sparks(5, 0, loc)
playsound(loc, 'sound/weapons/blade1.ogg', 50, 1)
playsound(loc, "sparks", 50, 1)
playsound(loc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
to_chat(user, "You slice through the lock on [src].")
else
to_chat(user, "You short out the lock on [src].")
+1 -1
View File
@@ -728,7 +728,7 @@
if(wielded)
//if(charged == 5)
//charged = 0
playsound(loc, "sparks", 50, 1)
playsound(loc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
if(isliving(M))
M.Stun(3)
shock(M)
@@ -254,7 +254,7 @@
if(locked)
overlays += sparks
spawn(6) overlays -= sparks //Tried lots of stuff but nothing works right. so i have to use this *sadface*
playsound(src.loc, "sparks", 60, 1)
playsound(src.loc, "sparks", 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
src.locked = 0
src.broken = 1
update_icon()