Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dopplerboop update: Adds mute option and volume #177

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modular_doppler/_HELPERS/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ GLOBAL_LIST_INIT(dopplerboop_voice_types, sort_list(list(
"grumpy",
"jock",
"lazy",
"smug"
"smug",
"mute"
CliffracerX marked this conversation as resolved.
Show resolved Hide resolved
)))
4 changes: 4 additions & 0 deletions modular_doppler/dopplerboop/dopplerboops.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

/datum/component/dopplerboop/proc/handle_booping(mob/living/carbon/human/dopplerbooper, list/speech_args, list/speech_spans, list/speech_mods)
chosen_boop = dopplerbooper?.voice_type || random_voice_type() // Uses the boop chosen by the player. If it's null for whatever unholy reason, it should chose a completely random voice for every single phonetic which should be funny.
if(chosen_boop == "mute")
return
var/message = speech_args[SPEECH_MESSAGE]
var/initial_dopplerboop_time = last_dopplerboop
var/initial_volume = volume
Expand Down Expand Up @@ -97,4 +99,6 @@
if(!volume || (last_dopplerboop != initial_dopplerboop_time) || !final_boop)
return
for(var/mob/hearer as anything in hearers)
var/user_volume = hearer.client.prefs.read_preference(/datum/preference/numeric/voice_volume)
CliffracerX marked this conversation as resolved.
Show resolved Hide resolved
volume = volume*(user_volume / 10)
hearer.playsound_local(turf_source = get_turf(dopplerbooper), sound_to_use = final_boop, vol = volume, vary = TRUE, frequency = freq, falloff_distance = falloff_exponent, max_distance = 16)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
savefile_key = "hear_dopplerboop"
savefile_identifier = PREFERENCE_PLAYER

/datum/preference/numeric/voice_volume
savefile_key = "voice_volume"
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_identifier = PREFERENCE_PLAYER
minimum = 0
maximum = 100

/datum/preference/numeric/voice_volume/create_default_value()
return maximum

//Character preferences

/datum/preference/choiced/voice_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
var/boop_letter = null
var/dopplerboop_delay_cumulative = 0
var/sound/final_boop = null
var/user_volume = user.client.prefs.read_preference(/datum/preference/numeric/voice_volume)
CliffracerX marked this conversation as resolved.
Show resolved Hide resolved

for(var/i in 1 to min(length(all_boops), MAX_DOPPLERBOOP_CHARACTERS))
var/volume = DOPPLERBOOP_DEFAULT_VOLUME
Expand All @@ -35,6 +36,7 @@
else
variation = rand(1, 5)
final_boop = "modular_doppler/dopplerboop/voices/[chosen_boop]/[boop_letter][variation].wav"
volume = volume*(user_volume / 10)
addtimer(CALLBACK(user, TYPE_PROC_REF(/mob, playsound_local), null, final_boop, volume), dopplerboop_delay_cumulative + current_delay)
dopplerboop_delay_cumulative += current_delay

Expand All @@ -43,5 +45,7 @@
return TRUE
COOLDOWN_START(src, dopplerboop_cooldown, 5 SECONDS)
var/chosen_boop = user?.client?.prefs.read_preference(/datum/preference/choiced/voice_type) || random_voice_type()
if(chosen_boop == "mute")
return
INVOKE_ASYNC(src, PROC_REF(debug_booping), user, chosen_boop)
return TRUE
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { CheckboxInput, FeatureToggle } from '../base';
import {
CheckboxInput,
FeatureNumeric,
FeatureSliderInput,
FeatureToggle,
} from '../base';

export const hear_dopplerboop: FeatureToggle = {
name: 'Enable voice mumbles',
Expand All @@ -7,3 +12,10 @@ export const hear_dopplerboop: FeatureToggle = {
'Adds a semi-syllable based voice generation system to all characters.',
component: CheckboxInput,
};

export const voice_volume: FeatureNumeric = {
name: 'Voice volume',
category: 'SOUND',
description: 'Sets the volume used for dopplerboop voices.',
component: FeatureSliderInput,
};
Loading