Adds Various Sounds, Looping Sound System

This commit is contained in:
Anewbe
2018-12-31 09:01:31 -06:00
committed by Novacat
parent 7a13562736
commit 09b01407e3
133 changed files with 1313 additions and 206 deletions

View File

@@ -302,4 +302,11 @@ var/global/list/##LIST_NAME = list();\
#define RCD_SHEETS_PER_MATTER_UNIT 4 // Each physical material sheet is worth four matter units.
<<<<<<< HEAD
#define RCD_MAX_CAPACITY 30 * RCD_SHEETS_PER_MATTER_UNIT
// Radiation 'levels'. Used for the geiger counter, for visuals and sound. They are in different files so this goes here.
#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

View File

@@ -9,6 +9,9 @@
#define WEATHER_WINDY "windy"
#define WEATHER_HOT "hot"
#define WEATHER_BLOOD_MOON "blood moon" // For admin fun or cult later on.
#define WEATHER_EMBERFALL "emberfall" // More adminbuse, from TG. Harmless.
#define WEATHER_ASH_STORM "ash storm" // Ripped from TG, like the above. Less harmless.
#define WEATHER_FALLOUT "fallout" // Modified emberfall, actually harmful. Admin only.
#define MOON_PHASE_NEW_MOON "new moon"
#define MOON_PHASE_WAXING_CRESCENT "waxing crescent"

View File

@@ -2,4 +2,7 @@ GLOBAL_LIST_EMPTY(admins) //all clients whom are admins
GLOBAL_PROTECT(admins)
GLOBAL_LIST_EMPTY(deadmins) //all ckeys who have used the de-admin verb.
GLOBAL_LIST_EMPTY(stealthminID)
<<<<<<< HEAD
GLOBAL_LIST_EMPTY(directory) //all ckeys with associated client
GLOBAL_LIST_EMPTY(directory) //all ckeys with associated client
GLOBAL_LIST_EMPTY(players_by_zlevel)

View File

@@ -62,6 +62,11 @@
#define to_file(file_entry, source_var) file_entry << source_var
#define from_file(file_entry, target_var) file_entry >> target_var
// From TG, might be useful to have.
// Didn't port SEND_TEXT() since to_chat() appears to serve the same purpose.
#define DIRECT_OUTPUT(A, B) A << B
#define SEND_IMAGE(target, image) DIRECT_OUTPUT(target, image)
#define SEND_SOUND(target, sound) DIRECT_OUTPUT(target, sound)
#define CanInteract(user, state) (CanUseTopic(user, state) == STATUS_INTERACTIVE)

View File

@@ -10,6 +10,7 @@ SUBSYSTEM_DEF(mapping)
/datum/controller/subsystem/mapping/Initialize(timeofday)
if(subsystem_initialized)
return
world.max_z_changed() // This is to set up the player z-level list, maxz hasn't actually changed (probably)
maploader = new()
load_map_templates()

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

View File

@@ -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)

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

View File

@@ -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

View File

@@ -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

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

View File

@@ -291,3 +291,10 @@
/atom/movable/proc/adjust_rotation(new_rotation)
icon_rotation = new_rotation
update_transform()
// Called when something changes z-levels.
/atom/movable/proc/on_z_change(old_z, new_z)
GLOB.z_moved_event.raise_event(src, old_z, new_z)
for(var/item in src) // Notify contents of Z-transition. This can be overriden IF we know the items contents do not care.
var/atom/movable/AM = item
AM.on_z_change(old_z, new_z)

View File

@@ -44,7 +44,7 @@ var/global/list/narsie_list = list()
..()
if(announce)
world << "<font size='15' color='red'><b>[uppertext(name)] HAS RISEN</b></font>"
world << sound('sound/effects/wind/wind_5_1.ogg')
world << sound('sound/effects/weather/wind/wind_5_1.ogg')
narsie_spawn_animation()

View File

@@ -206,7 +206,7 @@ var/list/sacrificed = list()
if(cultists.len >= 9)
if(!narsie_cometh)//so we don't initiate Hell more than one time.
world << "<font size='15' color='red'><b>THE VEIL HAS BEEN SHATTERED!</b></font>"
world << sound('sound/effects/wind/wind_5_1.ogg')
world << sound('sound/effects/weather/wind/wind_5_1.ogg')
SetUniversalState(/datum/universal_state/hell)
narsie_cometh = 1

View File

@@ -54,15 +54,19 @@
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")
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
@@ -73,10 +77,8 @@
interval_lower_bound = 5 SECONDS
interval_upper_bound = 10 SECONDS
/obj/effect/map_effect/interval/sound_emitter/distant_explosions
/obj/effect/map_effect/interval/sound_emitter/explosions/distant
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(

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

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)

View File

@@ -23,7 +23,7 @@
if(distance <= maxdistance)
if(T && T.z == turf_source.z)
M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, is_global, channel, pressure_affected, S)
M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, is_global, channel, pressure_affected, S, preference)
/mob/proc/playsound_local(turf/turf_source, soundin, vol as num, vary, frequency, falloff, is_global, channel = 0, pressure_affected = TRUE, sound/S, preference)
if(!client || ear_deaf > 0)
@@ -130,8 +130,6 @@
if ("fracture") soundin = pick('sound/effects/bonebreak1.ogg','sound/effects/bonebreak2.ogg','sound/effects/bonebreak3.ogg','sound/effects/bonebreak4.ogg')
if ("canopen") soundin = pick('sound/effects/can_open1.ogg','sound/effects/can_open2.ogg','sound/effects/can_open3.ogg','sound/effects/can_open4.ogg')
if ("mechstep") soundin = pick('sound/mecha/mechstep1.ogg', 'sound/mecha/mechstep2.ogg')
if ("geiger") soundin = pick('sound/items/geiger1.ogg', 'sound/items/geiger2.ogg', 'sound/items/geiger3.ogg', 'sound/items/geiger4.ogg', 'sound/items/geiger5.ogg')
if ("geiger_weak") soundin = pick('sound/items/geiger_weak1.ogg', 'sound/items/geiger_weak2.ogg', 'sound/items/geiger_weak3.ogg', 'sound/items/geiger_weak4.ogg')
if ("thunder") soundin = pick('sound/effects/thunder/thunder1.ogg', 'sound/effects/thunder/thunder2.ogg', 'sound/effects/thunder/thunder3.ogg', 'sound/effects/thunder/thunder4.ogg',
'sound/effects/thunder/thunder5.ogg', 'sound/effects/thunder/thunder6.ogg', 'sound/effects/thunder/thunder7.ogg', 'sound/effects/thunder/thunder8.ogg', 'sound/effects/thunder/thunder9.ogg',
'sound/effects/thunder/thunder10.ogg')

View File

@@ -74,7 +74,6 @@ var/list/flooring_types
'sound/effects/footstep/snow4.ogg',
'sound/effects/footstep/snow5.ogg'))
/decl/flooring/snow/snow2
name = "snow"
desc = "A layer of many tiny bits of frozen water. It's hard to tell how deep it is."

View File

@@ -77,6 +77,7 @@ var/list/_client_preferences_by_type
preference_mob << sound(null, repeat = 0, wait = 0, volume = 0, channel = 1)
preference_mob << sound(null, repeat = 0, wait = 0, volume = 0, channel = 2)
<<<<<<< HEAD
/datum/client_preference/play_jukebox
description ="Play jukebox music"
key = "SOUND_JUKEBOX"
@@ -98,6 +99,20 @@ var/list/_client_preferences_by_type
enabled_description = "Noisy"
disabled_description = "Silent"
//VOREStation Add End
=======
/datum/client_preference/weather_sounds
description ="Weather sounds"
key = "SOUND_WEATHER"
enabled_description = "Audible"
disabled_description = "Silent"
/datum/client_preference/supermatter_hum
description ="Supermatter hum"
key = "SOUND_SUPERMATTER"
enabled_description = "Audible"
disabled_description = "Silent"
>>>>>>> 5fb77b3... Merge pull request #5791 from Neerti/looping_sounds
/datum/client_preference/ghost_ears
description ="Ghost ears"
key = "CHAT_GHOSTEARS"

View File

@@ -162,7 +162,37 @@
prefs.save_preferences()
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
feedback_add_details("admin_verb","TAmbience") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_weather_sounds()
set name = "Toggle Weather Sounds"
set category = "Preferences"
set desc = "Toggles the ability to hear weather sounds while on a planet."
var/pref_path = /datum/client_preference/weather_sounds
toggle_preference(pref_path)
to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear weather sounds.")
prefs.save_preferences()
feedback_add_details("admin_verb","TWeatherSounds") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_supermatter_hum()
set name = "Toggle SM Hum" // Avoiding using the full 'Supermatter' name to not conflict with the Setup-Supermatter adminverb.
set category = "Preferences"
set desc = "Toggles the ability to hear supermatter hums."
var/pref_path = /datum/client_preference/supermatter_hum
toggle_preference(pref_path)
to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear a hum from the supermatter.")
prefs.save_preferences()
feedback_add_details("admin_verb","TSupermatterHum") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_jukebox()
set name = "Toggle Jukebox"

View File

@@ -35,6 +35,10 @@
cooking_obj = null
return ..()
/obj/machinery/cooker/proc/set_cooking(new_setting)
cooking = new_setting
icon_state = new_setting ? on_icon : off_icon
/obj/machinery/cooker/examine()
..()
if(cooking_obj && Adjacent(usr))
@@ -113,7 +117,7 @@
user.visible_message("<span class='notice'>\The [user] puts \the [I] into \the [src].</span>")
cooking_obj = I
cooking_obj.forceMove(src)
cooking = 1
set_cooking(TRUE)
icon_state = on_icon
// Doop de doo. Jeopardy theme goes here.
@@ -123,7 +127,7 @@
if(!cooking_obj || cooking_obj.loc != src)
cooking_obj = null
icon_state = off_icon
cooking = 0
set_cooking(FALSE)
return
// RIP slow-moving held mobs.
@@ -166,7 +170,7 @@
if(!can_burn_food)
icon_state = off_icon
cooking = 0
set_cooking(FALSE)
result.forceMove(get_turf(src))
cooking_obj = null
else
@@ -192,7 +196,7 @@
failed = 1
if(failed)
cooking = 0
set_cooking(FALSE)
icon_state = off_icon
break
@@ -201,7 +205,7 @@
if(cooking_obj && user.Adjacent(src)) //Fixes borgs being able to teleport food in these machines to themselves.
user << "<span class='notice'>You grab \the [cooking_obj] from \the [src].</span>"
user.put_in_hands(cooking_obj)
cooking = 0
set_cooking(FALSE)
cooking_obj = null
icon_state = off_icon
return

View File

@@ -8,6 +8,22 @@
off_icon = "fryer_off"
food_color = "#FFAD33"
cooked_sound = 'sound/machines/ding.ogg'
var/datum/looping_sound/deep_fryer/fry_loop
/obj/machinery/cooker/fryer/Initialize()
fry_loop = new(list(src), FALSE)
return ..()
/obj/machinery/cooker/fryer/Destroy()
QDEL_NULL(fry_loop)
return ..()
/obj/machinery/cooker/fryer/set_cooking(new_setting)
..()
if(new_setting)
fry_loop.start()
else
fry_loop.stop()
/obj/machinery/cooker/fryer/cook_mob(var/mob/living/victim, var/mob/user)
@@ -17,16 +33,19 @@
user.visible_message("<span class='danger'>\The [user] starts pushing \the [victim] into \the [src]!</span>")
icon_state = on_icon
cooking = 1
fry_loop.start()
if(!do_mob(user, victim, 20))
cooking = 0
icon_state = off_icon
fry_loop.stop()
return
if(!victim || !victim.Adjacent(user))
user << "<span class='danger'>Your victim slipped free!</span>"
cooking = 0
icon_state = off_icon
fry_loop.stop()
return
var/obj/item/organ/external/E
@@ -62,4 +81,5 @@
icon_state = off_icon
cooking = 0
fry_loop.stop()
return

View File

@@ -1,3 +1,4 @@
<<<<<<< HEAD
/obj/machinery/microwave
name = "microwave"
icon = 'icons/obj/kitchen.dmi'
@@ -390,3 +391,402 @@
if ("dispose")
dispose()
return
=======
/obj/machinery/microwave
name = "microwave"
icon = 'icons/obj/kitchen.dmi'
icon_state = "mw"
density = 1
anchored = 1
use_power = 1
idle_power_usage = 5
active_power_usage = 100
flags = OPENCONTAINER | NOREACT
circuit = /obj/item/weapon/circuitboard/microwave
var/operating = 0 // Is it on?
var/dirty = 0 // = {0..100} Does it need cleaning?
var/broken = 0 // ={0,1,2} How broken is it???
var/global/list/datum/recipe/available_recipes // List of the recipes you can use
var/global/list/acceptable_items // List of the items you can put in
var/global/list/acceptable_reagents // List of the reagents you can put in
var/global/max_n_of_items = 0
var/datum/looping_sound/microwave/soundloop
// see code/modules/food/recipes_microwave.dm for recipes
/*******************
* Initialising
********************/
/obj/machinery/microwave/Initialize()
reagents = new/datum/reagents(100)
reagents.my_atom = src
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/console_screen(src)
component_parts += new /obj/item/weapon/stock_parts/motor(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
if (!available_recipes)
available_recipes = new
for (var/type in (typesof(/datum/recipe)-/datum/recipe))
available_recipes+= new type
acceptable_items = new
acceptable_reagents = new
for (var/datum/recipe/recipe in available_recipes)
for (var/item in recipe.items)
acceptable_items |= item
for (var/reagent in recipe.reagents)
acceptable_reagents |= reagent
if (recipe.items)
max_n_of_items = max(max_n_of_items,recipe.items.len)
// This will do until I can think of a fun recipe to use dionaea in -
// will also allow anything using the holder item to be microwaved into
// impure carbon. ~Z
acceptable_items |= /obj/item/weapon/holder
acceptable_items |= /obj/item/weapon/reagent_containers/food/snacks/grown
RefreshParts()
soundloop = new(list(src), FALSE)
return ..()
/obj/machinery/microwave/Destroy()
QDEL_NULL(soundloop)
return ..()
/*******************
* Item Adding
********************/
/obj/machinery/microwave/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(src.broken > 0)
if(src.broken == 2 && O.is_screwdriver()) // If it's broken and they're using a screwdriver
user.visible_message( \
"<span class='notice'>\The [user] starts to fix part of the microwave.</span>", \
"<span class='notice'>You start to fix part of the microwave.</span>" \
)
playsound(src, O.usesound, 50, 1)
if (do_after(user,20 * O.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] fixes part of the microwave.</span>", \
"<span class='notice'>You have fixed part of the microwave.</span>" \
)
src.broken = 1 // Fix it a bit
else if(src.broken == 1 && O.is_wrench()) // If it's broken and they're doing the wrench
user.visible_message( \
"<span class='notice'>\The [user] starts to fix part of the microwave.</span>", \
"<span class='notice'>You start to fix part of the microwave.</span>" \
)
if (do_after(user,20 * O.toolspeed))
user.visible_message( \
"<span class='notice'>\The [user] fixes the microwave.</span>", \
"<span class='notice'>You have fixed the microwave.</span>" \
)
src.icon_state = "mw"
src.broken = 0 // Fix it!
src.dirty = 0 // just to be sure
src.flags = OPENCONTAINER | NOREACT
else
to_chat(user, "<span class='warning'>It's broken!</span>")
return 1
else if(default_deconstruction_screwdriver(user, O))
return
else if(default_deconstruction_crowbar(user, O))
return
else if(default_unfasten_wrench(user, O, 10))
return
else if(src.dirty==100) // The microwave is all dirty so can't be used!
if(istype(O, /obj/item/weapon/reagent_containers/spray/cleaner) || istype(O, /obj/item/weapon/soap)) // If they're trying to clean it then let them
user.visible_message( \
"<span class='notice'>\The [user] starts to clean the microwave.</span>", \
"<span class='notice'>You start to clean the microwave.</span>" \
)
if (do_after(user,20))
user.visible_message( \
"<span class='notice'>\The [user] has cleaned the microwave.</span>", \
"<span class='notice'>You have cleaned the microwave.</span>" \
)
src.dirty = 0 // It's clean!
src.broken = 0 // just to be sure
src.icon_state = "mw"
src.flags = OPENCONTAINER | NOREACT
else //Otherwise bad luck!!
to_chat(user, "<span class='warning'>It's dirty!</span>")
return 1
else if(is_type_in_list(O,acceptable_items))
if (contents.len>=(max_n_of_items + component_parts.len + 1)) //Adds component_parts to the maximum number of items. The 1 is from the circuit
to_chat(user, "<span class='warning'>This [src] is full of ingredients, you cannot put more.</span>")
return 1
if(istype(O, /obj/item/stack) && O:get_amount() > 1) // This is bad, but I can't think of how to change it
var/obj/item/stack/S = O
new O.type (src)
S.use(1)
user.visible_message( \
"<span class='notice'>\The [user] has added one of [O] to \the [src].</span>", \
"<span class='notice'>You add one of [O] to \the [src].</span>")
return
else
// user.remove_from_mob(O) //This just causes problems so far as I can tell. -Pete
user.drop_item()
O.loc = src
user.visible_message( \
"<span class='notice'>\The [user] has added \the [O] to \the [src].</span>", \
"<span class='notice'>You add \the [O] to \the [src].</span>")
return
else if(istype(O,/obj/item/weapon/reagent_containers/glass) || \
istype(O,/obj/item/weapon/reagent_containers/food/drinks) || \
istype(O,/obj/item/weapon/reagent_containers/food/condiment) \
)
if (!O.reagents)
return 1
for (var/datum/reagent/R in O.reagents.reagent_list)
if (!(R.id in acceptable_reagents))
to_chat(user, "<span class='warning'>Your [O] contains components unsuitable for cookery.</span>")
return 1
return
else if(istype(O,/obj/item/weapon/grab))
var/obj/item/weapon/grab/G = O
to_chat(user, "<span class='warning'>This is ridiculous. You can not fit \the [G.affecting] in this [src].</span>")
return 1
else
to_chat(user, "<span class='warning'>You have no idea what you can cook with this [O].</span>")
..()
src.updateUsrDialog()
/obj/machinery/microwave/attack_ai(mob/user as mob)
if(istype(user, /mob/living/silicon/robot) && Adjacent(user))
attack_hand(user)
/obj/machinery/microwave/attack_hand(mob/user as mob)
user.set_machine(src)
interact(user)
/*******************
* Microwave Menu
********************/
/obj/machinery/microwave/interact(mob/user as mob) // The microwave Menu
var/dat = ""
if(src.broken > 0)
dat = {"<TT>Bzzzzttttt</TT>"}
else if(src.operating)
dat = {"<TT>Microwaving in progress!<BR>Please wait...!</TT>"}
else if(src.dirty==100)
dat = {"<TT>This microwave is dirty!<BR>Please clean it before use!</TT>"}
else
var/list/items_counts = new
var/list/items_measures = new
var/list/items_measures_p = new
for (var/obj/O in ((contents - component_parts) - circuit))
var/display_name = O.name
if (istype(O,/obj/item/weapon/reagent_containers/food/snacks/egg))
items_measures[display_name] = "egg"
items_measures_p[display_name] = "eggs"
if (istype(O,/obj/item/weapon/reagent_containers/food/snacks/tofu))
items_measures[display_name] = "tofu chunk"
items_measures_p[display_name] = "tofu chunks"
if (istype(O,/obj/item/weapon/reagent_containers/food/snacks/meat)) //any meat
items_measures[display_name] = "slab of meat"
items_measures_p[display_name] = "slabs of meat"
if (istype(O,/obj/item/weapon/reagent_containers/food/snacks/donkpocket))

View File

@@ -32,22 +32,22 @@
"Beach" = new/datum/holodeck_program(/area/holodeck/source_beach),
"Desert" = new/datum/holodeck_program(/area/holodeck/source_desert,
list(
'sound/effects/wind/wind_2_1.ogg',
'sound/effects/wind/wind_2_2.ogg',
'sound/effects/wind/wind_3_1.ogg',
'sound/effects/wind/wind_4_1.ogg',
'sound/effects/wind/wind_4_2.ogg',
'sound/effects/wind/wind_5_1.ogg'
'sound/effects/weather/wind/wind_2_1.ogg',
'sound/effects/weather/wind/wind_2_2.ogg',
'sound/effects/weather/wind/wind_3_1.ogg',
'sound/effects/weather/wind/wind_4_1.ogg',
'sound/effects/weather/wind/wind_4_2.ogg',
'sound/effects/weather/wind/wind_5_1.ogg'
)
),
"Snowfield" = new/datum/holodeck_program(/area/holodeck/source_snowfield,
list(
'sound/effects/wind/wind_2_1.ogg',
'sound/effects/wind/wind_2_2.ogg',
'sound/effects/wind/wind_3_1.ogg',
'sound/effects/wind/wind_4_1.ogg',
'sound/effects/wind/wind_4_2.ogg',
'sound/effects/wind/wind_5_1.ogg'
'sound/effects/weather/wind/wind_2_1.ogg',
'sound/effects/weather/wind/wind_2_2.ogg',
'sound/effects/weather/wind/wind_3_1.ogg',
'sound/effects/weather/wind/wind_4_1.ogg',
'sound/effects/weather/wind/wind_4_2.ogg',
'sound/effects/weather/wind/wind_5_1.ogg'
)
),
"Space" = new/datum/holodeck_program(/area/holodeck/source_space,

View File

@@ -109,7 +109,8 @@ var/global/use_preloader = FALSE
if(cropMap)
continue
else
world.maxz = zcrd //create a new z_level if needed
while(world.maxz < zcrd)
world.increment_max_z() // create a new z_level if needed.
if(!no_changeturf)
WARNING("Z-level expansion occurred without no_changeturf set, this may cause problems")

View File

@@ -72,3 +72,6 @@
if(!client.tooltips)
client.tooltips = new(client)
var/turf/T = get_turf(src)
if(isturf(T))
update_client_z(T.z)

View File

@@ -1,7 +1,11 @@
/mob/Logout()
GLOB.nanomanager.user_logout(src) // this is used to clean up (remove) this user's Nano UIs
player_list -= src
<<<<<<< HEAD
disconnect_time = world.realtime
=======
update_client_z(null)
>>>>>>> 5fb77b3... Merge pull request #5791 from Neerti/looping_sounds
log_access_out(src)
if(admin_datums[src.ckey])
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.

View File

@@ -1180,3 +1180,19 @@ mob/proc/yank_out_object()
closeToolTip(usr) //No reason not to, really
..()
// Manages a global list of mobs with clients attached, indexed by z-level.
/mob/proc/update_client_z(new_z) // +1 to register, null to unregister.
if(registered_z != new_z)
if(registered_z)
GLOB.players_by_zlevel[registered_z] -= src
if(client)
if(new_z)
GLOB.players_by_zlevel[new_z] += src
registered_z = new_z
else
registered_z = null
/mob/on_z_change(old_z, new_z)
..()
update_client_z(new_z)

View File

@@ -232,3 +232,5 @@
var/attack_icon //Icon to use when attacking w/o anything in-hand
var/attack_icon_state //State for above
var/registered_z

View File

@@ -170,6 +170,8 @@
src.move_speed = world.time - src.l_move_time
src.l_move_time = world.time
src.m_flag = 1
if(A && A.z != src.z) // If we changed z-levels, tell the AM that.
on_z_change(A.z, src.z)
if ((A != src.loc && A && A.z == src.z))
src.last_move = get_dir(A, src.loc)
if(.)

View File

@@ -14,7 +14,7 @@
var/sun_position = 0 // 0 means midnight, 1 means noon.
var/list/sun = list("range","brightness","color","lum_r","lum_g","lum_b")
var/list/datum/lighting_corner/sunlit_corners = list()
var/expected_z_levels = list()
var/list/expected_z_levels = list()
var/turf/unsimulated/wall/planetary/planetary_wall_type = /turf/unsimulated/wall/planetary

View File

@@ -121,7 +121,10 @@ var/datum/planet/sif/planet_sif = null
WEATHER_RAIN = new /datum/weather/sif/rain(),
WEATHER_STORM = new /datum/weather/sif/storm(),
WEATHER_HAIL = new /datum/weather/sif/hail(),
WEATHER_BLOOD_MOON = new /datum/weather/sif/blood_moon()
WEATHER_BLOOD_MOON = new /datum/weather/sif/blood_moon(),
WEATHER_EMBERFALL = new /datum/weather/sif/emberfall(),
WEATHER_ASH_STORM = new /datum/weather/sif/ash_storm(),
WEATHER_FALLOUT = new /datum/weather/sif/fallout()
)
roundstart_weather_chances = list(
WEATHER_CLEAR = 30,
@@ -208,6 +211,8 @@ var/datum/planet/sif/planet_sif = null
"It's starting to snow.",
"The air feels much colder as snowflakes fall from above."
)
outdoor_sounds_type = /datum/looping_sound/weather/outside_snow
indoor_sounds_type = /datum/looping_sound/weather/inside_snow
/datum/weather/sif/snow/process_effects()
..()
@@ -237,6 +242,8 @@ var/datum/planet/sif/planet_sif = null
"Strong winds howl around you as a blizzard appears.",
"It starts snowing heavily, and it feels extremly cold now."
)
outdoor_sounds_type = /datum/looping_sound/weather/outside_blizzard
indoor_sounds_type = /datum/looping_sound/weather/inside_blizzard
/datum/weather/sif/blizzard/process_effects()
..()
@@ -265,6 +272,8 @@ var/datum/planet/sif/planet_sif = null
transition_messages = list(
"The sky is dark, and rain falls down upon you."
)
// outdoor_sounds_type = /datum/looping_sound/weather/rain
// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors
/datum/weather/sif/rain/process_effects()
..()
@@ -310,6 +319,8 @@ var/datum/planet/sif/planet_sif = null
"Loud thunder is heard in the distance.",
"A bright flash heralds the approach of a storm."
)
// outdoor_sounds_type = /datum/looping_sound/weather/rain
// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors
transition_chances = list(
@@ -435,6 +446,10 @@ var/datum/planet/sif/planet_sif = null
if(show_message)
to_chat(H, effect_message)
// These never happen naturally, and are for adminbuse.
// A culty weather.
/datum/weather/sif/blood_moon
name = "blood moon"
light_modifier = 0.5
@@ -446,4 +461,114 @@ var/datum/planet/sif/planet_sif = null
observed_message = "Everything is red. Something really wrong is going on."
transition_messages = list(
"The sky turns blood red!"
<<<<<<< refs/remotes/VOREStation/master
)
=======
<<<<<<< HEAD
)
=======
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// Ash and embers fall forever, such as from a volcano or something.
/datum/weather/sif/emberfall
name = "emberfall"
icon_state = "ashfall_light"
light_modifier = 0.7
light_color = "#880000"
temp_high = 293.15 // 20c
temp_low = 283.15 // 10c
flight_failure_modifier = 20
transition_chances = list(
WEATHER_EMBERFALL = 100
)
observed_message = "Soot, ash, and embers float down from above."
transition_messages = list(
"Gentle embers waft down around you like grotesque snow."
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// Like the above but a lot more harmful.
/datum/weather/sif/ash_storm
name = "ash storm"
icon_state = "ashfall_heavy"
light_modifier = 0.1
light_color = "#FF0000"
temp_high = 323.15 // 50c
temp_low = 313.15 // 40c
flight_failure_modifier = 50
transition_chances = list(
WEATHER_ASH_STORM = 100
)
observed_message = "All that can be seen is black smoldering ash."
transition_messages = list(
"Smoldering clouds of scorching ash billow down around you!"
)
// Lets recycle.
outdoor_sounds_type = /datum/looping_sound/weather/outside_blizzard
indoor_sounds_type = /datum/looping_sound/weather/inside_blizzard
/datum/weather/sif/ash_storm/process_effects()
..()
for(var/thing in living_mob_list)
var/mob/living/L = thing
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
continue // They're indoors, so no need to burn them with ash.
L.inflict_heat_damage(rand(1, 3))
// Totally radical.
/datum/weather/sif/fallout
name = "fallout"
icon_state = "fallout"
light_modifier = 0.7
light_color = "#CCFFCC"
flight_failure_modifier = 30
transition_chances = list(
WEATHER_FALLOUT = 100
)
observed_message = "Radioactive soot and ash rains down from the heavens."
transition_messages = list(
"Radioactive soot and ash start to float down around you, contaminating whatever they touch."
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// How much radiation a mob gets while on an outside tile.
var/direct_rad_low = RAD_LEVEL_LOW
var/direct_rad_high = RAD_LEVEL_MODERATE
// How much radiation is bursted onto a random tile near a mob.
var/fallout_rad_low = RAD_LEVEL_HIGH
var/fallout_rad_high = RAD_LEVEL_VERY_HIGH
/datum/weather/sif/fallout/process_effects()
..()
for(var/thing in living_mob_list)
var/mob/living/L = thing
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
if(!T.outdoors)
continue // They're indoors, so no need to irradiate them with fallout.
L.rad_act(rand(direct_rad_low, direct_rad_high))
// This makes random tiles near people radioactive for awhile.
// Tiles far away from people are left alone, for performance.
/datum/weather/sif/fallout/proc/irradiate_nearby_turf(mob/living/L)
if(!istype(L))
return
var/list/turfs = RANGE_TURFS(world.view, L)
var/turf/T = pick(turfs) // We get one try per tick.
if(!istype(T))
return
if(T.outdoors)
radiation_repository.radiate(T, rand(fallout_rad_low, fallout_rad_high))
>>>>>>> 5fb77b3... Merge pull request #5791 from Neerti/looping_sounds
>>>>>>> Adds Various Sounds, Looping Sound System

View File

@@ -25,13 +25,19 @@
/datum/weather_holder/proc/change_weather(var/new_weather)
var/old_light_modifier = null
var/old_weather = null
var/datum/weather/old_weather = null
if(current_weather)
old_light_modifier = current_weather.light_modifier // We store the old one, so we can determine if recalculating the sun is needed.
old_weather = current_weather
current_weather = allowed_weather_types[new_weather]
next_weather_shift = world.time + rand(current_weather.timer_low_bound, current_weather.timer_high_bound) MINUTES
if(new_weather != old_weather)
if(istype(old_weather)) // At roundstart this is null.
old_weather.process_sounds() // Ensure that people who should hear the ending sound will hear it.
old_weather.stop_sounds()
current_weather.process_sounds() // Same story, make sure the starting sound is heard.
current_weather.start_sounds()
show_transition_message()
update_icon_effects()
@@ -48,7 +54,7 @@
advance_forecast()
else
current_weather.process_effects()
current_weather.process_sounds()
// Should only have to be called once.
@@ -140,6 +146,18 @@
var/list/transition_messages = list()// List of messages shown to all outdoor mobs when this weather is transitioned to, for flavor. Not shown if already this weather.
var/observed_message = null // What is shown to a player 'examining' the weather.
// Looping sound datums for weather sounds, both inside and outside.
var/datum/looping_sound/outdoor_sounds = null
var/datum/looping_sound/indoor_sounds = null
var/outdoor_sounds_type = null
var/indoor_sounds_type = null
/datum/weather/New()
if(outdoor_sounds_type)
outdoor_sounds = new outdoor_sounds_type(list(), FALSE, TRUE)
if(indoor_sounds_type)
indoor_sounds = new indoor_sounds_type(list(), FALSE, TRUE)
/datum/weather/proc/process_effects()
show_message = FALSE // Need to reset the show_message var, just in case
if(effect_message) // Only bother with the code below if we actually need to display something
@@ -148,6 +166,71 @@
show_message = TRUE // Tell the rest of the process that we need to make a message
return
/datum/weather/proc/process_sounds()
if(!outdoor_sounds && !indoor_sounds) // No point bothering if we have no sounds.
return
for(var/z_level in 1 to world.maxz)
for(var/a in GLOB.players_by_zlevel[z_level])
var/mob/M = a
// Check if the mob left the z-levels we control. If so, make the sounds stop for them.
if(!(z_level in holder.our_planet.expected_z_levels))
hear_indoor_sounds(M, FALSE)
hear_outdoor_sounds(M, FALSE)
continue
// Otherwise they should hear some sounds, depending on if they're inside or not.
var/turf/T = get_turf(M)
if(istype(T))
if(T.outdoors) // Mob is currently outdoors.
hear_outdoor_sounds(M, TRUE)
hear_indoor_sounds(M, FALSE)
else // Mob is currently indoors.
hear_outdoor_sounds(M, FALSE)
hear_indoor_sounds(M, TRUE)
else
hear_indoor_sounds(M, FALSE)
hear_outdoor_sounds(M, FALSE)
/datum/weather/proc/start_sounds()
if(outdoor_sounds)
outdoor_sounds.start()
if(indoor_sounds)
indoor_sounds.start()
/datum/weather/proc/stop_sounds()
if(outdoor_sounds)
outdoor_sounds.stop()
if(indoor_sounds)
indoor_sounds.stop()
// Stop everything just in case.
for(var/z_level in 1 to world.maxz)
for(var/a in GLOB.players_by_zlevel[z_level])
hear_indoor_sounds(a, FALSE)
hear_outdoor_sounds(a, FALSE)
// Adds or removes someone from the outdoor list.
/datum/weather/proc/hear_outdoor_sounds(mob/M, adding)
if(!outdoor_sounds)
return
if(adding)
outdoor_sounds.output_atoms |= M
return
outdoor_sounds.output_atoms -= M
// Ditto, for indoors.
/datum/weather/proc/hear_indoor_sounds(mob/M, adding)
if(!indoor_sounds)
return
if(adding)
indoor_sounds.output_atoms |= M
return
indoor_sounds.output_atoms -= M
// All this does is hold the weather icon.
/atom/movable/weather_visuals
icon = 'icons/effects/weather.dmi'

View File

@@ -22,12 +22,18 @@
var/lastgen2 = 0
var/effective_gen = 0
var/lastgenlev = 0
var/datum/looping_sound/generator/soundloop
/obj/machinery/power/generator/New()
..()
/obj/machinery/power/generator/Initialize()
soundloop = new(list(src), FALSE)
desc = initial(desc) + " Rated for [round(max_power/1000)] kW."
spawn(1)
reconnect()
return ..()
/obj/machinery/power/generator/Destroy()
QDEL_NULL(soundloop)
return ..()
//generators connect in dir and reverse_dir(dir) directions
//mnemonic to determine circulator/generator directions: the cirulators orbit clockwise around the generator
@@ -124,6 +130,13 @@
stored_energy -= lastgen1
effective_gen = (lastgen1 + lastgen2) / 2
// Sounds.
if(effective_gen > (max_power * 0.05)) // More than 5% and sounds start.
soundloop.start()
soundloop.volume = LERP(1, 40, effective_gen / max_power)
else
soundloop.stop()
// update icon overlays and power usage only if displayed level has changed
var/genlev = max(0, min( round(11*effective_gen / max_power), 11))
if(effective_gen > 100 && genlev == 0)

View File

@@ -88,9 +88,15 @@
var/debug = 0
var/datum/looping_sound/supermatter/soundloop
/obj/machinery/power/supermatter/Initialize()
soundloop = new(list(src), TRUE)
return ..()
/obj/machinery/power/supermatter/Destroy()
. = ..()
QDEL_NULL(soundloop)
return ..()
/obj/machinery/power/supermatter/proc/explode()
message_admins("Supermatter exploded at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
@@ -197,6 +203,11 @@
if(grav_pulling)
supermatter_pull(src)
if(power)
// Volume will be 1 at no power, ~12.5 at ENERGY_NITROGEN, and 20+ at ENERGY_PHORON.
// Capped to 20 volume since higher volumes get annoying and it sounds worse.
soundloop.volume = min(round(power/10)+1, 20)
//Ok, get the air from the turf
var/datum/gas_mixture/removed = null
var/datum/gas_mixture/env = null

View File

@@ -667,4 +667,17 @@ proc/establish_old_db_connection()
else
return 1
// Things to do when a new z-level was just made.
/world/proc/max_z_changed()
if(!islist(GLOB.players_by_zlevel))
GLOB.players_by_zlevel = new /list(world.maxz, 0)
while(GLOB.players_by_zlevel.len < world.maxz)
GLOB.players_by_zlevel.len++
GLOB.players_by_zlevel[GLOB.players_by_zlevel.len] = list()
// Call this to make a new blank z-level, don't modify maxz directly.
/world/proc/increment_max_z()
maxz++
max_z_changed()
#undef FAILED_DB_CONNECTION_CUTOFF

View File

@@ -0,0 +1,38 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Neerti
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- soundadd: "Adds a lot of sounds, and the code to let them loop seemlessly. Things made audible now include the microwave, deep fryer, showers, the supermatter when it's active, the TEGs when active, geiger counters, and severe weather on Sif. The weather has different sounds for when indoors and when outdoors."
- tweak: "The weather sounds, and the supermatter hum can be disabled in your preferences."
- rscadd: "Adds a few more weather types that can only be activated by admin powers, such as ash storms and fallout."

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -258,8 +258,7 @@
expected_z_levels = list(
Z_LEVEL_SURFACE,
Z_LEVEL_SURFACE_MINE,
Z_LEVEL_SURFACE_WILD,
Z_LEVEL_TRANSIT
Z_LEVEL_SURFACE_WILD
)
//Suit Storage Units

View File

@@ -140,7 +140,7 @@ var/list/all_maps = list()
/datum/map/proc/get_empty_zlevel()
if(empty_levels == null)
world.maxz++
world.increment_max_z()
empty_levels = list(world.maxz)
return pick(empty_levels)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sound/items/geiger/ext1.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/ext2.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/ext3.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/ext4.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sound/items/geiger/low1.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/low2.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/low3.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/low4.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/med1.ogg Normal file

Binary file not shown.

BIN
sound/items/geiger/med2.ogg Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More