Adds Various Sounds, Looping Sound System

This commit is contained in:
Anewbe
2019-03-27 03:55:21 -04:00
committed by Novacat
parent 7a13562736
commit 09b01407e3
133 changed files with 1313 additions and 206 deletions
@@ -1,117 +1,119 @@
// 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/thunder
sounds_to_play = list("thunder")
interval_lower_bound = 10 SECONDS
interval_upper_bound = 15 SECONDS
/obj/effect/map_effect/interval/sound_emitter/geiger
sounds_to_play = list("geiger")
interval_lower_bound = 2 SECONDS
interval_upper_bound = 2 SECONDS
/obj/effect/map_effect/interval/sound_emitter/geiger_weak
sounds_to_play = list("geiger_weak")
interval_lower_bound = 1 SECOND
interval_upper_bound = 1 SECOND
/obj/effect/map_effect/interval/sound_emitter/punching
sounds_to_play = list("punch")
interval_lower_bound = 5
interval_upper_bound = 1 SECOND
/obj/effect/map_effect/interval/sound_emitter/explosions
sounds_to_play = list("explosion")
interval_lower_bound = 5 SECONDS
interval_upper_bound = 10 SECONDS
/obj/effect/map_effect/interval/sound_emitter/distant_explosions
sounds_to_play = list('sound/effects/explosionfar.ogg')
interval_lower_bound = 5 SECONDS
interval_upper_bound = 10 SECONDS
/obj/effect/map_effect/interval/sound_emitter/ballistic_gunfight
sounds_to_play = list(
'sound/weapons/gunshot.ogg',
'sound/weapons/deagle.ogg',
'sound/weapons/rifleshot.ogg',
'sound/weapons/sniper.ogg',
'sound/weapons/shotgun.ogg',
'sound/weapons/gunshot3.ogg',
'sound/weapons/machinegun.ogg'
)
interval_lower_bound = 5
interval_upper_bound = 2 SECONDS
/obj/effect/map_effect/interval/sound_emitter/energy_gunfight
sounds_to_play = list(
'sound/weapons/Taser.ogg',
'sound/weapons/laser.ogg',
'sound/weapons/eLuger.ogg',
'sound/weapons/laser3.ogg',
'sound/weapons/pulse.ogg',
'sound/weapons/gauss_shoot.ogg',
'sound/weapons/emitter.ogg'
)
interval_lower_bound = 5
interval_upper_bound = 2 SECONDS
// I'm not sorry.
/obj/effect/map_effect/interval/sound_emitter/clownsteps
sounds_to_play = list("clownstep")
interval_lower_bound = 5
interval_upper_bound = 1 SECOND
/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
// 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/thunder
sounds_to_play = list("thunder")
interval_lower_bound = 10 SECONDS
interval_upper_bound = 15 SECONDS
/obj/effect/map_effect/interval/sound_emitter/geiger
sounds_to_play = list('sound/items/geiger/low1.ogg', 'sound/items/geiger/low2.ogg', 'sound/items/geiger/low3.ogg', 'sound/items/geiger/low4.ogg')
interval_lower_bound = 1 SECOND
interval_upper_bound = 1 SECOND
/obj/effect/map_effect/interval/sound_emitter/geiger/med
sounds_to_play = list('sound/items/geiger/med1.ogg', 'sound/items/geiger/med2.ogg', 'sound/items/geiger/med3.ogg', 'sound/items/geiger/med4.ogg')
/obj/effect/map_effect/interval/sound_emitter/geiger/high
sounds_to_play = list('sound/items/geiger/high1.ogg', 'sound/items/geiger/high2.ogg', 'sound/items/geiger/high3.ogg', 'sound/items/geiger/high4.ogg')
/obj/effect/map_effect/interval/sound_emitter/geiger/ext
sounds_to_play = list('sound/items/geiger/ext1.ogg', 'sound/items/geiger/ext2.ogg', 'sound/items/geiger/ext3.ogg', 'sound/items/geiger/ext4.ogg')
/obj/effect/map_effect/interval/sound_emitter/punching
sounds_to_play = list("punch")
interval_lower_bound = 5
interval_upper_bound = 1 SECOND
/obj/effect/map_effect/interval/sound_emitter/explosions
sounds_to_play = list("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/ballistic_gunfight
sounds_to_play = list(
'sound/weapons/gunshot.ogg',
'sound/weapons/deagle.ogg',
'sound/weapons/rifleshot.ogg',
'sound/weapons/sniper.ogg',
'sound/weapons/shotgun.ogg',
'sound/weapons/gunshot3.ogg',
'sound/weapons/machinegun.ogg'
)
interval_lower_bound = 5
interval_upper_bound = 2 SECONDS
/obj/effect/map_effect/interval/sound_emitter/energy_gunfight
sounds_to_play = list(
'sound/weapons/Taser.ogg',
'sound/weapons/laser.ogg',
'sound/weapons/eLuger.ogg',
'sound/weapons/laser3.ogg',
'sound/weapons/pulse.ogg',
'sound/weapons/gauss_shoot.ogg',
'sound/weapons/emitter.ogg'
)
interval_lower_bound = 5
interval_upper_bound = 2 SECONDS
// I'm not sorry.
/obj/effect/map_effect/interval/sound_emitter/clownsteps
sounds_to_play = list("clownstep")
interval_lower_bound = 5
interval_upper_bound = 1 SECOND
/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
+25 -17
View File
@@ -1,8 +1,3 @@
#define RAD_LEVEL_LOW 0.01 // Around the level at which radiation starts to become harmful
#define RAD_LEVEL_MODERATE 10
#define RAD_LEVEL_HIGH 25
#define RAD_LEVEL_VERY_HIGH 50
//Geiger counter
//Rewritten version of TG's geiger counter
//I opted to show exact radiation levels
@@ -15,12 +10,23 @@
w_class = ITEMSIZE_SMALL
var/scanning = 0
var/radiation_count = 0
var/datum/looping_sound/geiger/soundloop
<<<<<<< HEAD
/obj/item/device/geiger/New()
START_PROCESSING(SSobj, src)
/obj/item/device/geiger/Destroy()
=======
/obj/item/device/geiger/Initialize()
START_PROCESSING(SSobj, src)
soundloop = new(list(src), FALSE)
return ..()
/obj/item/device/geiger/Destroy()
STOP_PROCESSING(SSobj, src)
QDEL_NULL(soundloop)
>>>>>>> 5fb77b3... Merge pull request #5791 from Neerti/looping_sounds
return ..()
/obj/item/device/geiger/process()
@@ -31,6 +37,7 @@
return
radiation_count = radiation_repository.get_rads_at_turf(get_turf(src))
update_icon()
update_sound()
/obj/item/device/geiger/examine(mob/user)
..(user)
@@ -44,18 +51,24 @@
if(amount > radiation_count)
radiation_count = amount
var/sound = "geiger"
if(amount < 5)
sound = "geiger_weak"
playsound(src, sound, between(10, 10 + (radiation_count * 4), 100), 0)
if(sound == "geiger_weak") // A weak geiger sound every two seconds sounds too infrequent.
spawn(1 SECOND)
playsound(src, sound, between(10, 10 + (radiation_count * 4), 100), 0)
update_icon()
update_sound()
/obj/item/device/geiger/proc/update_sound()
var/datum/looping_sound/geiger/loop = soundloop
if(!scanning)
loop.stop()
return
if(!radiation_count)
loop.stop()
return
loop.last_radiation = radiation_count
loop.start()
/obj/item/device/geiger/attack_self(var/mob/user)
scanning = !scanning
update_icon()
update_sound()
to_chat(user, "<span class='notice'>\icon[src] You switch [scanning ? "on" : "off"] \the [src].</span>")
/obj/item/device/geiger/update_icon()
@@ -76,8 +89,3 @@
icon_state = "geiger_on_4"
if(RAD_LEVEL_VERY_HIGH to INFINITY)
icon_state = "geiger_on_5"
#undef RAD_LEVEL_LOW
#undef RAD_LEVEL_MODERATE
#undef RAD_LEVEL_HIGH
#undef RAD_LEVEL_VERY_HIGH
+11 -2
View File
@@ -131,10 +131,16 @@
var/watertemp = "normal" //freezing, normal, or boiling
var/is_washing = 0
var/list/temperature_settings = list("normal" = 310, "boiling" = T0C+100, "freezing" = T0C)
var/datum/looping_sound/showering/soundloop
/obj/machinery/shower/New()
..()
/obj/machinery/shower/Initialize()
create_reagents(50)
soundloop = new(list(src), FALSE)
return ..()
/obj/machinery/shower/Destroy()
QDEL_NULL(soundloop)
return ..()
//add heat controls? when emagged, you can freeze to death in it?
@@ -151,11 +157,14 @@
on = !on
update_icon()
if(on)
soundloop.start()
if (M.loc == loc)
wash(M)
process_heat(M)
for (var/atom/movable/G in src.loc)
G.clean_blood()
else
soundloop.stop()
/obj/machinery/shower/attackby(obj/item/I as obj, mob/user as mob)
if(I.type == /obj/item/device/analyzer)