This commit is contained in:
Poojawa
2018-09-11 02:49:41 -05:00
parent 09512a6001
commit b6430559e9
104 changed files with 1522 additions and 765 deletions
+2 -7
View File
@@ -13,7 +13,7 @@
volume = 25
var/last_radiation
/datum/looping_sound/geiger/get_sound(looped)
/datum/looping_sound/geiger/get_sound(starttime)
var/danger
switch(last_radiation)
if(RAD_BACKGROUND_RADIATION to RAD_GEIGER_LOW)
@@ -26,7 +26,7 @@
danger = 4
else
return null
return ..(looped, mid_sounds[danger])
return ..(starttime, mid_sounds[danger])
/datum/looping_sound/geiger/stop()
. = ..()
@@ -41,11 +41,6 @@
mid_length = 3.5
volume = 25
/datum/looping_sound/reverse_bear_trap/slow
mid_sounds = list('sound/effects/clock_tick.ogg')
mid_length = 10
volume = 40
/datum/looping_sound/reverse_bear_trap_beep
mid_sounds = list('sound/machines/beep.ogg')
+15 -12
View File
@@ -24,10 +24,11 @@
var/end_sound
var/chance
var/volume = 100
var/muted = TRUE
var/max_loops
var/direct
var/timerid
/datum/looping_sound/New(list/_output_atoms=list(), start_immediately=FALSE, _direct=FALSE)
if(!mid_sounds)
WARNING("A looping sound datum was created without sounds to play.")
@@ -47,25 +48,27 @@
/datum/looping_sound/proc/start(atom/add_thing)
if(add_thing)
output_atoms |= add_thing
if(!muted)
if(timerid)
return
muted = FALSE
on_start()
/datum/looping_sound/proc/stop(atom/remove_thing)
if(remove_thing)
output_atoms -= remove_thing
if(muted)
if(!timerid)
return
muted = TRUE
on_stop()
deltimer(timerid)
timerid = null
/datum/looping_sound/proc/sound_loop(looped=0)
if(muted || (max_loops && looped > max_loops))
on_stop(looped)
/datum/looping_sound/proc/sound_loop(starttime)
if(max_loops && world.time >= starttime + mid_length * max_loops)
stop()
return
if(!chance || prob(chance))
play(get_sound(looped))
addtimer(CALLBACK(src, .proc/sound_loop, ++looped), mid_length)
play(get_sound(starttime))
if(!timerid)
timerid = addtimer(CALLBACK(src, .proc/sound_loop, world.time), mid_length, TIMER_STOPPABLE | TIMER_LOOP)
/datum/looping_sound/proc/play(soundfile)
var/list/atoms_cache = output_atoms
@@ -80,7 +83,7 @@
else
playsound(thing, S, volume)
/datum/looping_sound/proc/get_sound(looped, _mid_sounds)
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
if(!_mid_sounds)
. = mid_sounds
else
@@ -95,6 +98,6 @@
start_wait = start_length
addtimer(CALLBACK(src, .proc/sound_loop), start_wait)
/datum/looping_sound/proc/on_stop(looped)
/datum/looping_sound/proc/on_stop()
if(end_sound)
play(end_sound)