Skip to content

Commit

Permalink
Merge pull request #177 from maaacha/boopupdate
Browse files Browse the repository at this point in the history
Dopplerboop update: Adds mute option and volume
  • Loading branch information
CliffracerX authored Oct 19, 2024
2 parents 507f9ce + ee31e90 commit 53dc935
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
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",
)))
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)
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)
10 changes: 10 additions & 0 deletions modular_doppler/modular_customization/preferences/dopplerboop.dm
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)

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,
};

0 comments on commit 53dc935

Please sign in to comment.