mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 14:08:44 +01:00
Upports fridge, tcomm, and shield_gen soundloops (#19405)
* Soundloops * emp fix * Update tools.dm * Update tools.dm * hum
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
direct (bool) If true plays directly to provided atoms instead of from them
|
||||
opacity_check (bool) If true, things behind walls/opaque things won't hear the sounds.
|
||||
pref_check (type) If set to a /datum/client_preference type, will check if the hearer has that preference active before playing it to them.
|
||||
volume_chan (type) If set to a specific volume channel via the incoming argument, we tell the playsound proc to modulate volume based on that channel
|
||||
exclusive (bool) If true, only one of this sound is allowed to play. Relies on if started is true or not. If true, it will not start another loop until it is false.
|
||||
*/
|
||||
/datum/looping_sound
|
||||
@@ -34,6 +35,7 @@
|
||||
var/opacity_check
|
||||
var/pref_check
|
||||
var/exclusive
|
||||
var/falloff
|
||||
var/volume_chan
|
||||
|
||||
var/timerid
|
||||
@@ -57,6 +59,8 @@
|
||||
return ..()
|
||||
|
||||
/datum/looping_sound/proc/start(atom/add_thing, skip_start_sound = FALSE)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(add_thing)
|
||||
output_atoms |= add_thing
|
||||
if(timerid)
|
||||
@@ -82,7 +86,7 @@
|
||||
started = FALSE
|
||||
|
||||
/datum/looping_sound/proc/sound_loop(starttime)
|
||||
if(max_loops && world.time >= starttime + mid_length * max_loops)
|
||||
if(QDELETED(src) || (max_loops && world.time >= starttime + mid_length * max_loops))
|
||||
stop()
|
||||
return
|
||||
if(!chance || prob(chance))
|
||||
@@ -98,7 +102,7 @@
|
||||
if(direct)
|
||||
S.channel = SSsounds.random_available_channel()
|
||||
S.volume = volume
|
||||
for(var/i in 1 to atoms_cache.len)
|
||||
for(var/i in 1 to atoms_cache?.len)
|
||||
var/atom/thing = atoms_cache[i]
|
||||
if(direct)
|
||||
if(ismob(thing))
|
||||
@@ -107,7 +111,7 @@
|
||||
continue
|
||||
SEND_SOUND(thing, S)
|
||||
else
|
||||
playsound(thing, S, volume, vary, extra_range, ignore_walls = !opacity_check, preference = pref_check)
|
||||
playsound(thing, S, volume, vary, extra_range, falloff = falloff, ignore_walls = !opacity_check, preference = pref_check, volume_channel = volume_chan)
|
||||
|
||||
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
|
||||
if(!_mid_sounds)
|
||||
|
||||
@@ -118,6 +118,40 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/looping_sound/fridge
|
||||
mid_sounds = list('sound/machines/kitchen/fridge/fridge_loop.ogg' = 1)
|
||||
mid_length = 60
|
||||
volume = 10
|
||||
extra_range = -1 // Short-range
|
||||
pref_check = /datum/preference/toggle/fridge_hum
|
||||
volume_chan = VOLUME_CHANNEL_MACHINERY_IDLE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/looping_sound/tcomms
|
||||
start_sound = 'sound/machines/tcomms/tcomms_pulse.ogg'
|
||||
mid_sounds = list('sound/machines/tcomms/tcomms_01.ogg' = 1)
|
||||
mid_length = 20
|
||||
end_sound = 'sound/machines/tcomms/tcomms_pulse.ogg'
|
||||
volume = 40
|
||||
extra_range = -5 // Short-range
|
||||
falloff = 0.1 // Harsh
|
||||
volume_chan = VOLUME_CHANNEL_MACHINERY_IDLE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/looping_sound/shield_generator
|
||||
start_sound = 'sound/machines/shield_hum/shield_generator_whir.ogg'
|
||||
mid_sounds = list('sound/machines/shield_hum/shield_generator_hum2.ogg', 'sound/machines/shield_hum/shield_generator_hum3.ogg')
|
||||
mid_length = 60
|
||||
end_sound = 'sound/machines/shield_hum/shield_generator_whir.ogg'
|
||||
volume = 40
|
||||
volume_chan = VOLUME_CHANNEL_MACHINERY
|
||||
exclusive = TRUE
|
||||
extra_range = 10
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/looping_sound/lathe_print
|
||||
mid_sounds = list('sound/machines/lathe/lathe_print.ogg')
|
||||
mid_length = 2 SECONDS
|
||||
|
||||
Reference in New Issue
Block a user