From 0fcac8abf8c022d86c1d7e285c69a672b92c0194 Mon Sep 17 00:00:00 2001 From: Neerti Date: Fri, 28 Dec 2018 22:48:48 -0500 Subject: [PATCH] Adds changelog, preference options for two types of sounds, and tweaks a few things. --- code/datums/looping_sounds/_looping_sound.dm | 8 +++- .../datums/looping_sounds/machinery_sounds.dm | 1 + code/datums/looping_sounds/weather_sounds.dm | 19 ++++++---- code/game/sound.dm | 2 +- .../preference_setup/global/setting_datums.dm | 12 ++++++ .../client/preferences_toggle_procs.dm | 36 ++++++++++++++++-- code/modules/planet/sif.dm | 36 +++++++++--------- html/changelogs/neerti-looping_sounds.yml | 38 +++++++++++++++++++ 8 files changed, 122 insertions(+), 30 deletions(-) create mode 100644 html/changelogs/neerti-looping_sounds.yml diff --git a/code/datums/looping_sounds/_looping_sound.dm b/code/datums/looping_sounds/_looping_sound.dm index f5ca75e1a1..99af50bf42 100644 --- a/code/datums/looping_sounds/_looping_sound.dm +++ b/code/datums/looping_sounds/_looping_sound.dm @@ -15,6 +15,7 @@ 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 @@ -28,6 +29,7 @@ var/max_loops var/direct var/opacity_check + var/pref_check var/timerid @@ -81,9 +83,13 @@ 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) + playsound(thing, S, volume, ignore_walls = !opacity_check, preference = pref_check) /datum/looping_sound/proc/get_sound(starttime, _mid_sounds) if(!_mid_sounds) diff --git a/code/datums/looping_sounds/machinery_sounds.dm b/code/datums/looping_sounds/machinery_sounds.dm index 7129b305c9..8b927b3a54 100644 --- a/code/datums/looping_sounds/machinery_sounds.dm +++ b/code/datums/looping_sounds/machinery_sounds.dm @@ -12,6 +12,7 @@ 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 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/code/datums/looping_sounds/weather_sounds.dm b/code/datums/looping_sounds/weather_sounds.dm index 0dea27a95f..106c25643a 100644 --- a/code/datums/looping_sounds/weather_sounds.dm +++ b/code/datums/looping_sounds/weather_sounds.dm @@ -1,4 +1,7 @@ -/datum/looping_sound/outside_blizzard +/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, @@ -10,7 +13,7 @@ end_sound = 'sound/effects/weather/snowstorm/outside/active_end.ogg' volume = 80 -/datum/looping_sound/inside_blizzard +/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, @@ -22,7 +25,7 @@ end_sound = 'sound/effects/weather/snowstorm/inside/active_end.ogg' volume = 60 -/datum/looping_sound/outside_snow +/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, @@ -34,7 +37,7 @@ end_sound = 'sound/effects/weather/snowstorm/outside/weak_end.ogg' volume = 50 -/datum/looping_sound/inside_snow +/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, @@ -46,7 +49,7 @@ end_sound = 'sound/effects/weather/snowstorm/inside/weak_end.ogg' volume = 30 -/datum/looping_sound/wind +/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, @@ -59,10 +62,10 @@ volume = 50 // Don't have special sounds so we just make it quieter indoors. -/datum/looping_sound/wind/indoors +/datum/looping_sound/weather/wind/indoors volume = 30 -/datum/looping_sound/rain +/datum/looping_sound/weather/rain mid_sounds = list( 'sound/effects/weather/acidrain_mid.ogg' = 1 ) @@ -72,5 +75,5 @@ end_sound = 'sound/effects/weather/acidrain_end.ogg' volume = 50 -/datum/looping_sound/rain/indoors +/datum/looping_sound/weather/rain/indoors volume = 30 \ No newline at end of file diff --git a/code/game/sound.dm b/code/game/sound.dm index 1d46f83b88..1c1d1c89ce 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -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) diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm index 1b44fbc5de..09d6f6efd0 100644 --- a/code/modules/client/preference_setup/global/setting_datums.dm +++ b/code/modules/client/preference_setup/global/setting_datums.dm @@ -74,6 +74,18 @@ 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) +/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" + /datum/client_preference/ghost_ears description ="Ghost ears" key = "CHAT_GHOSTEARS" diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index 68747a4228..c45970ec02 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -143,7 +143,7 @@ toggle_preference(pref_path) - to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear MIDIs from admins.") + to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear MIDIs from admins.") prefs.save_preferences() @@ -158,11 +158,41 @@ toggle_preference(pref_path) - to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear ambient noise.") + to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear ambient noise.") 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_be_special(role in be_special_flags) set name = "Toggle SpecialRole Candidacy" diff --git a/code/modules/planet/sif.dm b/code/modules/planet/sif.dm index 86566147d3..340320cbaf 100644 --- a/code/modules/planet/sif.dm +++ b/code/modules/planet/sif.dm @@ -211,8 +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/outside_snow - indoor_sounds_type = /datum/looping_sound/inside_snow + outdoor_sounds_type = /datum/looping_sound/weather/outside_snow + indoor_sounds_type = /datum/looping_sound/weather/inside_snow /datum/weather/sif/snow/process_effects() ..() @@ -242,8 +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/outside_blizzard - indoor_sounds_type = /datum/looping_sound/inside_blizzard + outdoor_sounds_type = /datum/looping_sound/weather/outside_blizzard + indoor_sounds_type = /datum/looping_sound/weather/inside_blizzard /datum/weather/sif/blizzard/process_effects() ..() @@ -272,8 +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/rain -// indoor_sounds_type = /datum/looping_sound/rain/indoors +// outdoor_sounds_type = /datum/looping_sound/weather/rain +// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors /datum/weather/sif/rain/process_effects() ..() @@ -319,8 +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/rain -// indoor_sounds_type = /datum/looping_sound/rain/indoors +// outdoor_sounds_type = /datum/looping_sound/weather/rain +// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors transition_chances = list( @@ -462,8 +462,8 @@ var/datum/planet/sif/planet_sif = null transition_messages = list( "The sky turns blood red!" ) - outdoor_sounds_type = /datum/looping_sound/wind - indoor_sounds_type = /datum/looping_sound/wind/indoors + 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 @@ -481,8 +481,8 @@ var/datum/planet/sif/planet_sif = null transition_messages = list( "Gentle embers waft down around you like grotesque snow." ) - outdoor_sounds_type = /datum/looping_sound/wind - indoor_sounds_type = /datum/looping_sound/wind/indoors + 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 @@ -501,8 +501,8 @@ var/datum/planet/sif/planet_sif = null "Smoldering clouds of scorching ash billow down around you!" ) // Lets recycle. - outdoor_sounds_type = /datum/looping_sound/outside_blizzard - indoor_sounds_type = /datum/looping_sound/inside_blizzard + 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() ..() @@ -521,7 +521,7 @@ var/datum/planet/sif/planet_sif = null name = "fallout" icon_state = "fallout" light_modifier = 0.7 - light_color = "#008800" + light_color = "#CCFFCC" flight_failure_modifier = 30 transition_chances = list( WEATHER_FALLOUT = 100 @@ -530,12 +530,14 @@ var/datum/planet/sif/planet_sif = null transition_messages = list( "Radioactive soot and ash start to float down around you, contaminating whatever they touch." ) - outdoor_sounds_type = /datum/looping_sound/wind - indoor_sounds_type = /datum/looping_sound/wind/indoors + 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 diff --git a/html/changelogs/neerti-looping_sounds.yml b/html/changelogs/neerti-looping_sounds.yml new file mode 100644 index 0000000000..214ec43678 --- /dev/null +++ b/html/changelogs/neerti-looping_sounds.yml @@ -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."