Added sounds for unlocking achievements. (#77968)

## About The Pull Request
Unlocking an achievement now plays a sound. Which sound is played
depends on the associated preference of the player, found in the Sound
category of the game preferences UI.
The current options are a [glockenspiel
ping](https://freesound.org/people/FunWithSound/sounds/456965/), a
[beeps jingle](https://freesound.org/people/Eponn/sounds/619838/) and a
["tada!"
fanfare](https://freesound.org/people/plasterbrain/sounds/397355/), with
the obvious fourth option to not play a sound at all.

All sounds are from Freesound and are public domain. As such,
attributions are not required. The sounds have been also converted to
.OGG mono 44.1 Khz in accordance to the standards.

## Why It's Good For The Game
Enhancing the player feedback for unlocking an achievement with
choosable sounds.

## Changelog

🆑
sound: Unlocking an achievement now plays a sound by default. You can
change it in the Sound category of the game preferences.
/🆑
This commit is contained in:
Ghom
2023-08-29 21:10:38 +02:00
committed by GitHub
parent 6fef21b7f7
commit fed2abfc05
8 changed files with 42 additions and 0 deletions
+6
View File
@@ -11,6 +11,12 @@
///the priority of the achievements score. NO achievement should have a priority equal or lower than this.
#define AWARD_PRIORITY_LAST 0
/// preferences for the sound played when unlocking an achievement
#define CHEEVO_SOUND_TADA "Tada Fanfare"
#define CHEEVO_SOUND_JINGLE "Beeps Jingle"
#define CHEEVO_SOUND_PING "Success Ping"
#define CHEEVO_SOUND_OFF "Disabled"
//Misc Medal hub IDs
#define MEDAL_METEOR "Your Life Before Your Eyes"
#define MEDAL_PULSE "Jackpot"
+6
View File
@@ -1,3 +1,9 @@
GLOBAL_LIST_EMPTY(commendations)
///A list of the current achievement categories supported by the UI and checked by the achievement unit test
GLOBAL_LIST_INIT(achievement_categories, list("Bosses", "Jobs", "Skills", "Misc", "Mafia", "Scores"))
///A list of sounds that can be played when unlocking an achievement, set in the preferences.
GLOBAL_LIST_INIT(achievement_sounds, list(
CHEEVO_SOUND_PING = sound('sound/effects/glockenspiel_ping.ogg', volume = 70),
CHEEVO_SOUND_JINGLE = sound('sound/effects/beeps_jingle.ogg', volume = 70),
CHEEVO_SOUND_TADA = sound('sound/effects/tada_fanfare.ogg', volume = 30),
))
+4
View File
@@ -110,6 +110,10 @@
. = ..()
to_chat(user, span_greenannounce("<B>Achievement unlocked: [name]!</B>"))
user.client.give_award(/datum/award/score/achievements_score, user, 1)
var/sound/sound_to_send = LAZYACCESS(GLOB.achievement_sounds, user.client.prefs.read_preference(/datum/preference/choiced/sound_achievement))
if(sound_to_send)
SEND_SOUND(user, sound_to_send)
times_achieved++
if(SSachievements.most_unlocked_achievement?.times_achieved < times_achieved)
SSachievements.most_unlocked_achievement = src
+16
View File
@@ -50,6 +50,22 @@
/datum/preference/numeric/sound_tts_volume/create_default_value()
return maximum
/datum/preference/choiced/sound_achievement
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "sound_achievement"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/choiced/sound_achievement/init_possible_values()
return list(CHEEVO_SOUND_PING, CHEEVO_SOUND_JINGLE, CHEEVO_SOUND_TADA, CHEEVO_SOUND_OFF)
/datum/preference/choiced/sound_achievement/create_default_value()
return CHEEVO_SOUND_PING
/datum/preference/choiced/sound_achievement/apply_to_client_updated(client/client, value)
var/sound/sound_to_send = LAZYACCESS(GLOB.achievement_sounds, value)
if(sound_to_send)
SEND_SOUND(client.mob, sound_to_send)
/// Controls hearing dance machines
/datum/preference/toggle/sound_jukebox
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -83,3 +83,13 @@ export const sound_elevator: FeatureToggle = {
category: 'SOUND',
component: CheckboxInput,
};
export const sound_achievement: FeatureChoiced = {
name: 'Achievement unlock sound',
category: 'SOUND',
description: multiline`
The sound that's played when unlocking an achievement.
If disabled, no sound will be played.
`,
component: FeatureDropdownInput,
};