From 5444ec4047db11903cbf7160ca0bd282d4bd0b2c Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 23 Sep 2025 14:16:11 -0400 Subject: [PATCH] Fixed a bug where _ prefixed sounds in sub directories weren't hidden from learn sounds. --- menu.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/menu.py b/menu.py index abc5b2a..bb374b4 100644 --- a/menu.py +++ b/menu.py @@ -354,7 +354,7 @@ def learn_sounds(sounds): Excluded sounds: - Files in folders named 'ambience' (at any level) - Files in any directory starting with '.' - - Files starting with 'game-intro', 'music_menu', or '_' + - Files whose filename starts with 'game-intro', 'music_menu', or '_' (regardless of directory) Args: sounds (dict): Dictionary of available sound objects @@ -374,8 +374,11 @@ def learn_sounds(sounds): # Process each sound key in the dictionary for soundKey in sounds.keys(): - # Skip if key has any excluded prefix - if any(soundKey.lower().startswith(prefix.lower()) for prefix in excludedPrefixes): + # Extract the filename (part after the last '/') + filename = soundKey.split('/')[-1] + + # Skip if filename has any excluded prefix + if any(filename.lower().startswith(prefix.lower()) for prefix in excludedPrefixes): continue # Split key into path parts