Adds volume channel for engine ambience (SM, Tesla) (#15845)

This commit is contained in:
dearmochi
2021-04-10 12:10:22 +01:00
committed by GitHub
parent 13512ba21a
commit 71ddf21925
7 changed files with 21 additions and 10 deletions
+4 -1
View File
@@ -6,11 +6,14 @@
#define CHANNEL_HEARTBEAT 1020 //sound channel for heartbeats
#define CHANNEL_BUZZ 1019
#define CHANNEL_AMBIENCE 1018
#define CHANNEL_ENGINE 1017 // Engine ambient sounds
#define USER_VOLUME(M, C) M?.client?.prefs.get_channel_volume(C)
//THIS SHOULD ALWAYS BE THE LOWEST ONE!
//KEEP IT UPDATED
#define CHANNEL_HIGHEST_AVAILABLE 1017
#define CHANNEL_HIGHEST_AVAILABLE 1016
#define MAX_INSTRUMENT_CHANNELS (128 * 6)
+2
View File
@@ -2116,6 +2116,8 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
return "White Noise"
if(CHANNEL_AMBIENCE)
return "Ambience"
if(CHANNEL_ENGINE)
return "Engine Ambience"
/proc/slot_bitfield_to_slot(input_slot_flags) // Kill off this garbage ASAP; slot flags and clothing flags should be IDENTICAL. GOSH DARN IT. Doesn't work with ears or pockets, either.
switch(input_slot_flags)
+7 -3
View File
@@ -31,6 +31,8 @@
var/falloff_exponent
var/muted = TRUE
var/falloff_distance
/// Channel of the audio, random otherwise
var/channel
/datum/looping_sound/New(list/_output_atoms = list(), start_immediately = FALSE, _direct = FALSE)
if(!mid_sounds)
@@ -75,14 +77,16 @@
var/list/atoms_cache = output_atoms
var/sound/S = sound(soundfile)
if(direct)
S.channel = SSsounds.random_available_channel()
S.volume = volume
S.channel = channel || SSsounds.random_available_channel()
for(var/i in 1 to atoms_cache.len)
var/atom/thing = atoms_cache[i]
if(direct)
if(ismob(thing))
var/mob/M = thing
S.volume = volume * (USER_VOLUME(M, channel) || 1)
SEND_SOUND(thing, S)
else
playsound(thing, S, volume, vary, extra_range, falloff_exponent = falloff_exponent, falloff_distance = falloff_distance)
playsound(thing, S, volume, vary, extra_range, falloff_exponent = falloff_exponent, falloff_distance = falloff_distance, channel = channel)
/datum/looping_sound/proc/get_sound(looped, _mid_sounds)
if(!_mid_sounds)
@@ -16,3 +16,4 @@
falloff_exponent = 10
falloff_distance = 5
vary = TRUE
channel = CHANNEL_ENGINE
@@ -192,6 +192,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
"1020" = 100, // CHANNEL_HEARTBEAT
"1019" = 100, // CHANNEL_BUZZ
"1018" = 100, // CHANNEL_AMBIENCE
"1017" = 100, // CHANNEL_ENGINE
)
/// The volume mixer save timer handle. Used to debounce the DB call to save, to avoid spamming.
var/volume_mixer_saving = null
@@ -377,9 +377,9 @@
if(last_accent_sound < world.time && prob(20))
var/aggression = min(((damage / 800) * (power / 2500)), 1.0) * 100
if(damage >= 300)
playsound(src, "smdelam", max(50, aggression), FALSE, 40, 30, falloff_distance = 10)
playsound(src, "smdelam", max(50, aggression), FALSE, 40, 30, falloff_distance = 10, channel = CHANNEL_ENGINE)
else
playsound(src, "smcalm", max(50, aggression), FALSE, 25, 25, falloff_distance = 10)
playsound(src, "smcalm", max(50, aggression), FALSE, 25, 25, falloff_distance = 10, channel = CHANNEL_ENGINE)
var/next_sound = round((100 - aggression) * 5)
last_accent_sound = world.time + max(SUPERMATTER_ACCENT_SOUND_MIN_COOLDOWN, next_sound)
@@ -568,7 +568,7 @@
zap_count += 1
if(zap_count >= 1)
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10, channel = CHANNEL_ENGINE)
for(var/i in 1 to zap_count)
supermatter_zap(src, range, clamp(power*2, 4000, 20000), flags)
@@ -807,7 +807,7 @@
icon_state = "darkmatter"
/obj/machinery/power/supermatter_crystal/proc/supermatter_pull(turf/center, pull_range = 3)
playsound(center, 'sound/weapons/marauder.ogg', 100, TRUE, extrarange = pull_range - world.view)
playsound(center, 'sound/weapons/marauder.ogg', 100, TRUE, extrarange = pull_range - world.view, channel = CHANNEL_ENGINE)
for(var/atom/movable/P in orange(pull_range,center))
if((P.anchored || P.move_resist >= MOVE_FORCE_EXTREMELY_STRONG)) //move resist memes.
if(istype(P, /obj/structure/closet))
+2 -2
View File
@@ -65,7 +65,7 @@
move_the_basket_ball(4 + length(orbiting_balls) * 1.5)
playsound(loc, 'sound/magic/lightningbolt.ogg', 100, TRUE, extrarange = 30)
playsound(loc, 'sound/magic/lightningbolt.ogg', 100, TRUE, extrarange = 30, channel = CHANNEL_ENGINE)
pixel_x = 0
pixel_y = 0
@@ -112,7 +112,7 @@
energy_to_lower = energy_to_raise - 20
energy_to_raise = energy_to_raise * 1.25
playsound(src.loc, 'sound/magic/lightning_chargeup.ogg', 100, TRUE, extrarange = 30)
playsound(src.loc, 'sound/magic/lightning_chargeup.ogg', 100, TRUE, extrarange = 30, channel = CHANNEL_ENGINE)
addtimer(CALLBACK(src, .proc/new_mini_ball), 100)
else if(energy < energy_to_lower && length(orbiting_balls))