Creates a Preference toggle for Drop Sounds (#6397)

This commit is contained in:
Conspiir
2019-05-19 08:49:14 -05:00
committed by Werner
parent 744a74390b
commit f659fa096c
10 changed files with 71 additions and 17 deletions

View File

@@ -83,8 +83,9 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
#define ASFX_FOOTSTEPS 2 #define ASFX_FOOTSTEPS 2
#define ASFX_VOTE 4 #define ASFX_VOTE 4
#define ASFX_VOX 8 #define ASFX_VOX 8
#define ASFX_DROPSOUND 16
#define ASFX_DEFAULT (ASFX_AMBIENCE|ASFX_FOOTSTEPS|ASFX_VOTE|ASFX_VOX) #define ASFX_DEFAULT (ASFX_AMBIENCE|ASFX_FOOTSTEPS|ASFX_VOTE|ASFX_VOX|ASFX_DROPSOUND)
// For secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans. // For secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
#define HEALTH_HUD 1 // A simple line rounding the mob's number health. #define HEALTH_HUD 1 // A simple line rounding the mob's number health.

View File

@@ -212,5 +212,4 @@ Proc for attack log creation, because really why not
// Returns true if the mob was removed form the dead list // Returns true if the mob was removed form the dead list
/mob/proc/remove_from_dead_mob_list() /mob/proc/remove_from_dead_mob_list()
return dead_mob_list.Remove(src) return dead_mob_list.Remove(src)

View File

@@ -245,7 +245,7 @@
/obj/item/throw_impact(atom/hit_atom) /obj/item/throw_impact(atom/hit_atom)
..() ..()
if(drop_sound) if(drop_sound)
playsound(src, drop_sound, 50, 0) playsound(src, drop_sound, 50, 0, required_asfx_toggles = ASFX_DROPSOUND)
//Apparently called whenever an item is dropped on the floor, thrown, or placed into a container. //Apparently called whenever an item is dropped on the floor, thrown, or placed into a container.
//It is called after loc is set, so if placed in a container its loc will be that container. //It is called after loc is set, so if placed in a container its loc will be that container.

View File

@@ -168,7 +168,7 @@ var/list/footstepfx = list("defaultstep","concretestep","grassstep","dirtstep","
//var/list/gun_sound = list('sound/weapons/gunshot/gunshot1.ogg', 'sound/weapons/gunshot/gunshot2.ogg','sound/weapons/gunshot/gunshot3.ogg','sound/weapons/gunshot/gunshot4.ogg') //var/list/gun_sound = list('sound/weapons/gunshot/gunshot1.ogg', 'sound/weapons/gunshot/gunshot2.ogg','sound/weapons/gunshot/gunshot3.ogg','sound/weapons/gunshot/gunshot4.ogg')
/proc/playsound(atom/source, soundin, vol as num, vary, extrarange as num, falloff, is_global, usepressure = 1, environment = -1, is_ambience = FALSE, is_footstep = FALSE) /proc/playsound(atom/source, soundin, vol as num, vary, extrarange as num, falloff, is_global, usepressure = 1, environment = -1, required_preferences = 0, required_asfx_toggles = 0)
if (istext(soundin)) if (istext(soundin))
soundin = get_sfx(soundin) // same sound for everyone soundin = get_sfx(soundin) // same sound for everyone
else if (isarea(source)) else if (isarea(source))
@@ -194,10 +194,10 @@ var/list/footstepfx = list("defaultstep","concretestep","grassstep","dirtstep","
if (!T || T.z != turf_source.z) if (!T || T.z != turf_source.z)
continue continue
if (is_ambience && !(M.client.prefs.toggles & SOUND_AMBIENCE)) if (required_preferences && (M.client.prefs.toggles & required_preferences) != required_preferences)
continue continue
if (is_footstep && !(M.client.prefs.asfx_togs & ASFX_FOOTSTEPS)) if (required_asfx_toggles && (M.client.prefs.asfx_togs & required_asfx_toggles) != required_asfx_toggles)
continue continue
M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, is_global, usepressure, environment, S) M.playsound_local(turf_source, soundin, vol, vary, frequency, falloff, is_global, usepressure, environment, S)

View File

@@ -2,7 +2,8 @@
// /client/proc/Toggle_asfx, // /client/proc/Toggle_asfx,
// /client/proc/Toggle_footsteps, // /client/proc/Toggle_footsteps,
/client/proc/Toggle_asfx_vote, /client/proc/Toggle_asfx_vote,
/client/proc/toggle_vox_voice /client/proc/toggle_vox_voice,
/client/proc/Toggle_dropsounds
) )
/client/verb/asf_toggle() /client/verb/asf_toggle()
@@ -61,3 +62,15 @@
prefs.asfx_togs ^= ASFX_VOX prefs.asfx_togs ^= ASFX_VOX
prefs.save_preferences() prefs.save_preferences()
to_chat(src, "You will [(prefs.asfx_togs & ASFX_VOX) ? "now" : "no longer"] hear the VOX voice.") to_chat(src, "You will [(prefs.asfx_togs & ASFX_VOX) ? "now" : "no longer"] hear the VOX voice.")
/client/proc/Toggle_dropsounds()
set name = "Hear/Silence Drop Sounds"
set category = "SoundFx Prefs"
set desc = "Toggles hearing dropping and throwing sound effects"
prefs.asfx_togs ^= ASFX_DROPSOUND
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_DROPSOUND)
to_chat(src, "You will now hear dropping and throwing sounds.")
else
to_chat(src, "<font color='red'>You will no longer hear dropping and throwing sounds.</font>")

View File

@@ -224,4 +224,4 @@
prefs.toggles_secondary ^= SAFETY_CHECK //Held in Parallax because we don't want to deal with an SQL migration right now. prefs.toggles_secondary ^= SAFETY_CHECK //Held in Parallax because we don't want to deal with an SQL migration right now.
prefs.save_preferences() prefs.save_preferences()
to_chat(src, "You will [(prefs.toggles_secondary & SAFETY_CHECK) ? "no longer" : "now"] fire your weapon on intents other than harm.") to_chat(src, "You will [(prefs.toggles_secondary & SAFETY_CHECK) ? "no longer" : "now"] fire your weapon on intents other than harm.")

View File

@@ -200,11 +200,11 @@ var/list/slot_equipment_priority = list( \
addtimer(CALLBACK(src, .proc/make_item_drop_sound, item_dropped), 1) addtimer(CALLBACK(src, .proc/make_item_drop_sound, item_dropped), 1)
/mob/proc/make_item_drop_sound(obj/item/I) /mob/proc/make_item_drop_sound(obj/item/I)
if(QDELETED(I)) if(QDELETED(I))
return return
if(I.drop_sound) if(I.drop_sound)
playsound(I, I.drop_sound, 25, 0) playsound(I, I.drop_sound, 25, 0, required_asfx_toggles = ASFX_DROPSOUND)
/* /*
Removes the object from any slots the mob might have, calling the appropriate icon update proc. Removes the object from any slots the mob might have, calling the appropriate icon update proc.

View File

@@ -139,11 +139,11 @@
last_x = x last_x = x
last_y = y last_y = y
if (m_intent == "run") if (m_intent == "run")
playsound(src, T.footstep_sound, 70, 1, is_footstep = TRUE) playsound(src, T.footstep_sound, 70, 1, required_asfx_toggles = ASFX_FOOTSTEPS)
else else
footstep++ footstep++
if (footstep % 2) if (footstep % 2)
playsound(src, T.footstep_sound, 40, 1, is_footstep = TRUE) playsound(src, T.footstep_sound, 40, 1, required_asfx_toggles = ASFX_FOOTSTEPS)
/mob/living/carbon/human/mob_has_gravity() /mob/living/carbon/human/mob_has_gravity()
. = ..() . = ..()

View File

@@ -35,7 +35,7 @@
check_update_ui_need() check_update_ui_need()
if (working && enabled && world.time > ambience_last_played + 30 SECONDS && prob(3)) if (working && enabled && world.time > ambience_last_played + 30 SECONDS && prob(3))
playsound(loc, "computerbeep", 30, 1, 10, is_ambience = TRUE) playsound(loc, "computerbeep", 30, 1, 10, required_preferences = SOUND_AMBIENCE)
ambience_last_played = world.time ambience_last_played = world.time
/obj/item/modular_computer/proc/get_preset_programs(var/app_preset_name) /obj/item/modular_computer/proc/get_preset_programs(var/app_preset_name)
@@ -97,7 +97,7 @@
holographic_overlay(src, src.icon, icon_state_screensaver) holographic_overlay(src, src.icon, icon_state_screensaver)
else else
add_overlay(icon_state_screensaver) add_overlay(icon_state_screensaver)
if (screensaver_light_range && working) if (screensaver_light_range && working)
set_light(screensaver_light_range, 1, screensaver_light_color ? screensaver_light_color : "#FFFFFF") set_light(screensaver_light_range, 1, screensaver_light_color ? screensaver_light_color : "#FFFFFF")
else else

View File

@@ -0,0 +1,41 @@
################################
# 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
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: Conspiir
# 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:
- tweak: "Added the ability to toggle drop/throw sounds. It is under the ASFX tab."