Merge remote-tracking branch 'polaris/master' into pixel_projectiles

This commit is contained in:
kevinz000
2019-01-06 23:12:48 -08:00
225 changed files with 1742 additions and 977 deletions
+1 -1
View File
@@ -59,7 +59,7 @@
return ..()
/datum/beam/proc/Draw()
if(QDELETED(target) || !QDELETED(origin))
if(QDELETED(target) || QDELETED(origin))
qdel(src)
return
+1 -1
View File
@@ -166,7 +166,7 @@
// Use sparingly
/world/proc/PushUsr(mob/M, datum/callback/CB)
var/temp = usr
testing("PushUsr() in use")
// testing("PushUsr() in use")
usr = M
. = CB.Invoke()
usr = temp
@@ -0,0 +1,111 @@
/*
output_atoms (list of atoms) The destination(s) for the sounds
mid_sounds (list or soundfile) Since this can be either a list or a single soundfile you can have random sounds. May contain further lists but must contain a soundfile at the end.
mid_length (num) The length to wait between playing mid_sounds
start_sound (soundfile) Played before starting the mid_sounds loop
start_length (num) How long to wait before starting the main loop after playing start_sound
end_sound (soundfile) The sound played after the main loop has concluded
chance (num) Chance per loop to play a mid_sound
volume (num) Sound output volume
muted (bool) Private. Used to stop the sound loop.
max_loops (num) The max amount of loops to run for.
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.
*/
/datum/looping_sound
var/list/atom/output_atoms
var/mid_sounds
var/mid_length
var/start_sound
var/start_length
var/end_sound
var/chance
var/volume = 100
var/max_loops
var/direct
var/opacity_check
var/pref_check
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.")
return
output_atoms = _output_atoms
direct = _direct
if(start_immediately)
start()
/datum/looping_sound/Destroy()
stop()
output_atoms = null
return ..()
/datum/looping_sound/proc/start(atom/add_thing)
if(add_thing)
output_atoms |= add_thing
if(timerid)
return
on_start()
/datum/looping_sound/proc/stop(atom/remove_thing)
if(remove_thing)
output_atoms -= remove_thing
if(!timerid)
return
on_stop()
deltimer(timerid)
timerid = null
/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(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
var/sound/S = sound(soundfile)
if(direct)
S.channel = open_sound_channel()
S.volume = volume
for(var/i in 1 to atoms_cache.len)
var/atom/thing = atoms_cache[i]
if(direct)
if(ismob(thing))
var/mob/M = thing
if(!M.is_preference_enabled(pref_check))
continue
SEND_SOUND(thing, S)
else
playsound(thing, S, volume, ignore_walls = !opacity_check, preference = pref_check)
/datum/looping_sound/proc/get_sound(starttime, _mid_sounds)
if(!_mid_sounds)
. = mid_sounds
else
. = _mid_sounds
while(!isfile(.) && !isnull(.))
. = pickweight(.)
/datum/looping_sound/proc/on_start()
var/start_wait = 1 // On TG this is 0, however it needs to be 1 to work around an issue.
if(start_sound)
play(start_sound)
start_wait = start_length
addtimer(CALLBACK(src, .proc/sound_loop), start_wait)
/datum/looping_sound/proc/on_stop()
if(end_sound)
play(end_sound)
+29
View File
@@ -0,0 +1,29 @@
/datum/looping_sound/geiger
mid_sounds = list(
list('sound/items/geiger/low1.ogg'=1, 'sound/items/geiger/low2.ogg'=1, 'sound/items/geiger/low3.ogg'=1, 'sound/items/geiger/low4.ogg'=1),
list('sound/items/geiger/med1.ogg'=1, 'sound/items/geiger/med2.ogg'=1, 'sound/items/geiger/med3.ogg'=1, 'sound/items/geiger/med4.ogg'=1),
list('sound/items/geiger/high1.ogg'=1, 'sound/items/geiger/high2.ogg'=1, 'sound/items/geiger/high3.ogg'=1, 'sound/items/geiger/high4.ogg'=1),
list('sound/items/geiger/ext1.ogg'=1, 'sound/items/geiger/ext2.ogg'=1, 'sound/items/geiger/ext3.ogg'=1, 'sound/items/geiger/ext4.ogg'=1)
)
mid_length = 1 SECOND
volume = 25
var/last_radiation
/datum/looping_sound/geiger/get_sound(starttime)
var/danger
switch(last_radiation)
if(0 to RAD_LEVEL_MODERATE)
danger = 1
if(RAD_LEVEL_MODERATE to RAD_LEVEL_HIGH)
danger = 2
if(RAD_LEVEL_HIGH to RAD_LEVEL_VERY_HIGH)
danger = 3
if(RAD_LEVEL_VERY_HIGH to INFINITY)
danger = 4
else
return null
return ..(starttime, mid_sounds[danger])
/datum/looping_sound/geiger/stop()
. = ..()
last_radiation = 0
@@ -0,0 +1,46 @@
/datum/looping_sound/showering
start_sound = 'sound/machines/shower/shower_start.ogg'
start_length = 2
mid_sounds = list('sound/machines/shower/shower_mid1.ogg'=1,'sound/machines/shower/shower_mid2.ogg'=1,'sound/machines/shower/shower_mid3.ogg'=1)
mid_length = 10
end_sound = 'sound/machines/shower/shower_end.ogg'
volume = 20
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/supermatter
mid_sounds = list('sound/machines/sm/supermatter1.ogg'=1,'sound/machines/sm/supermatter2.ogg'=1,'sound/machines/sm/supermatter3.ogg'=1)
mid_length = 10
volume = 1
pref_check = /datum/client_preference/supermatter_hum
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/generator
start_sound = 'sound/machines/generator/generator_start.ogg'
start_length = 4
mid_sounds = list('sound/machines/generator/generator_mid1.ogg'=1, 'sound/machines/generator/generator_mid2.ogg'=1, 'sound/machines/generator/generator_mid3.ogg'=1)
mid_length = 4
end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 40
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/deep_fryer
start_sound = 'sound/machines/fryer/deep_fryer_immerse.ogg' //my immersions
start_length = 10
mid_sounds = list('sound/machines/fryer/deep_fryer_1.ogg' = 1, 'sound/machines/fryer/deep_fryer_2.ogg' = 1)
mid_length = 2
end_sound = 'sound/machines/fryer/deep_fryer_emerge.ogg'
volume = 15
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/datum/looping_sound/microwave
start_sound = 'sound/machines/microwave/microwave-start.ogg'
start_length = 10
mid_sounds = list('sound/machines/microwave/microwave-mid1.ogg'=10, 'sound/machines/microwave/microwave-mid2.ogg'=1)
mid_length = 10
end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 90
@@ -0,0 +1,79 @@
/datum/looping_sound/weather
pref_check = /datum/client_preference/weather_sounds
/datum/looping_sound/weather/outside_blizzard
mid_sounds = list(
'sound/effects/weather/snowstorm/outside/active_mid1.ogg' = 1,
'sound/effects/weather/snowstorm/outside/active_mid1.ogg' = 1,
'sound/effects/weather/snowstorm/outside/active_mid1.ogg' = 1
)
mid_length = 8 SECONDS
start_sound = 'sound/effects/weather/snowstorm/outside/active_start.ogg'
start_length = 13 SECONDS
end_sound = 'sound/effects/weather/snowstorm/outside/active_end.ogg'
volume = 80
/datum/looping_sound/weather/inside_blizzard
mid_sounds = list(
'sound/effects/weather/snowstorm/inside/active_mid1.ogg' = 1,
'sound/effects/weather/snowstorm/inside/active_mid2.ogg' = 1,
'sound/effects/weather/snowstorm/inside/active_mid3.ogg' = 1
)
mid_length = 8 SECONDS
start_sound = 'sound/effects/weather/snowstorm/inside/active_start.ogg'
start_length = 13 SECONDS
end_sound = 'sound/effects/weather/snowstorm/inside/active_end.ogg'
volume = 60
/datum/looping_sound/weather/outside_snow
mid_sounds = list(
'sound/effects/weather/snowstorm/outside/weak_mid1.ogg' = 1,
'sound/effects/weather/snowstorm/outside/weak_mid2.ogg' = 1,
'sound/effects/weather/snowstorm/outside/weak_mid3.ogg' = 1
)
mid_length = 8 SECONDS
start_sound = 'sound/effects/weather/snowstorm/outside/weak_start.ogg'
start_length = 13 SECONDS
end_sound = 'sound/effects/weather/snowstorm/outside/weak_end.ogg'
volume = 50
/datum/looping_sound/weather/inside_snow
mid_sounds = list(
'sound/effects/weather/snowstorm/inside/weak_mid1.ogg' = 1,
'sound/effects/weather/snowstorm/inside/weak_mid2.ogg' = 1,
'sound/effects/weather/snowstorm/inside/weak_mid3.ogg' = 1
)
mid_length = 8 SECONDS
start_sound = 'sound/effects/weather/snowstorm/inside/weak_start.ogg'
start_length = 13 SECONDS
end_sound = 'sound/effects/weather/snowstorm/inside/weak_end.ogg'
volume = 30
/datum/looping_sound/weather/wind
mid_sounds = list(
'sound/effects/weather/wind/wind_2_1.ogg' = 1,
'sound/effects/weather/wind/wind_2_2.ogg' = 1,
'sound/effects/weather/wind/wind_3_1.ogg' = 1,
'sound/effects/weather/wind/wind_4_1.ogg' = 1,
'sound/effects/weather/wind/wind_4_2.ogg' = 1,
'sound/effects/weather/wind/wind_5_1.ogg' = 1
)
mid_length = 10 SECONDS // The lengths for the files vary, but the longest is ten seconds, so this will make it sound like intermittent wind.
volume = 50
// Don't have special sounds so we just make it quieter indoors.
/datum/looping_sound/weather/wind/indoors
volume = 30
/datum/looping_sound/weather/rain
mid_sounds = list(
'sound/effects/weather/acidrain_mid.ogg' = 1
)
mid_length = 15 SECONDS // The lengths for the files vary, but the longest is ten seconds, so this will make it sound like intermittent wind.
start_sound = 'sound/effects/weather/acidrain_start.ogg'
start_length = 13 SECONDS
end_sound = 'sound/effects/weather/acidrain_end.ogg'
volume = 50
/datum/looping_sound/weather/rain/indoors
volume = 30
+16
View File
@@ -0,0 +1,16 @@
// Observer Pattern Implementation: Z_Moved
// Registration type: /atom/movable
//
// Raised when: An /atom/movable instance has changed z-levels by any means.
//
// Arguments that the called proc should expect:
// /atom/movable/moving_instance: The instance that moved
// old_z: The z number before the move.
// new_z: The z number after the move.
GLOBAL_DATUM_INIT(z_moved_event, /decl/observ/z_moved, new)
/decl/observ/z_moved
name = "Z_Moved"
expected_type = /atom/movable