mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-14 01:18:40 +01:00
7d058fc613
V2 of [previous music playing PR](https://github.com/Aurorastation/Aurora.3/pull/21466). TLDR no longer uses the connect_range component for implementation because it turned out a bit too inflexible for overlapping music players. Removes a NanoUI template for the [TGUI update](https://github.com/Aurorastation/Aurora.3/pull/21046). New changelog: - refactor: "Ported Jukebox's NanoUI interface to TGUI." - refactor: "Ported Jukebox audio playing functionality to a component." - refactor: "Sound keys refactored from singletons to datums, along with larger breakout of sound.dm to allow for easier SFX updates in future." - code_imp: "Expanded track datums to include track lengths." - code_imp: "Reorganized music file folders for more intuitive access." - rscadd: "Earphone status feedback text now includes track length." - rscadd: "Added autoplay functionality to earphones." - bugfix: "Fixed earphones' 'Previous Song' verb not sending you to the end of the playlist when used while the first track is selected." - bugfix: "Fixed gain adjustment for 'Konyang-1' (-23 dB -> standard -9.8 dB)." - bugfix: "Fixed y-offset of audioconsole-running overlay animation to line up with the actual screen." --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com>
82 lines
3.1 KiB
Plaintext
82 lines
3.1 KiB
Plaintext
// Plays a sound at its location every so often.
|
|
/obj/effect/map_effect/interval/sound_emitter
|
|
name = "sound emitter"
|
|
icon_state = "sound_emitter"
|
|
var/list/sounds_to_play = list(null) // List containing sound files or strings of sound groups.
|
|
// A sound or string is picked randomly each run.
|
|
|
|
var/sound_volume = 50 // How loud the sound is. 0 is silent, and 100 is loudest. Please be reasonable with the volume.
|
|
// Note that things like vacuum may affect the volume heard by other mobs.
|
|
|
|
var/sound_frequency_variance = TRUE // If the sound will sound somewhat different each time.
|
|
// If a specific frequency is desired, sound_frequency must also be set.
|
|
|
|
var/sound_extra_range = 0 // Set to make sounds heard from farther away than normal.
|
|
|
|
var/sound_fallout = 0 // Within the 'fallout distance', the sound stays at the same volume, otherwise it attenuates.
|
|
// Higher numbers make the sound fade out more slowly with distance.
|
|
|
|
var/sound_global = FALSE // If true, sounds will not be distorted due to the current area's 'sound environment'.
|
|
// It DOES NOT make the sound have a constant volume or z-level wide range, despite the misleading name.
|
|
|
|
var/sound_frequency = null // Sets a specific custom frequency. sound_frequency_variance must be true as well.
|
|
// If sound_frequency is null, but sound_frequency_variance is true, a semi-random frequency will be chosen to the sound each time.
|
|
|
|
var/sound_channel = 0 // BYOND allows a sound to play in 1 through 1024 sound channels.
|
|
// 0 will have BYOND give it the lowest available channel, it is not recommended to change this without a good reason.
|
|
|
|
var/sound_pressure_affected = TRUE // If false, people in low pressure or vacuum will hear the sound.
|
|
|
|
var/sound_ignore_walls = TRUE // If false, walls will completely muffle the sound.
|
|
|
|
var/sound_preference = null // Player preference to check before playing this sound to them, if any.
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/trigger()
|
|
playsound(
|
|
src,
|
|
pick(sounds_to_play),
|
|
sound_volume,
|
|
sound_frequency_variance,
|
|
sound_extra_range,
|
|
sound_fallout,
|
|
sound_global,
|
|
sound_frequency,
|
|
sound_channel,
|
|
sound_pressure_affected,
|
|
sound_ignore_walls,
|
|
sound_preference
|
|
)
|
|
..()
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/punching
|
|
sounds_to_play = SFX_PUNCH
|
|
interval_lower_bound = 5
|
|
interval_upper_bound = 1 SECOND
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/explosions
|
|
sounds_to_play = SFX_EXPLOSION
|
|
interval_lower_bound = 5 SECONDS
|
|
interval_upper_bound = 10 SECONDS
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/explosions/distant
|
|
sounds_to_play = list('sound/effects/explosionfar.ogg')
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/gunfight
|
|
sounds_to_play = SFX_GUNSHOT_ANY
|
|
interval_lower_bound = 5
|
|
interval_upper_bound = 2 SECONDS
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/gunfight/ballistic
|
|
sounds_to_play = SFX_GUNSHOT_BALLISTIC
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/gunfight/energy
|
|
sounds_to_play = SFX_GUNSHOT_ENERGY
|
|
|
|
|
|
// I'm not sorry.
|
|
|
|
/obj/effect/map_effect/interval/sound_emitter/bikehorns
|
|
sounds_to_play = list('sound/items/bikehorn.ogg')
|
|
interval_lower_bound = 5
|
|
interval_upper_bound = 1 SECOND
|