Added toggle for always playing music

This commit is contained in:
Anuken
2024-07-05 21:42:23 -04:00
parent 76e24f7edc
commit 04ec2c0603
4 changed files with 9 additions and 3 deletions
+2
View File
@@ -1136,6 +1136,8 @@ category.items = Items
category.crafting = Input/Output
category.function = Function
category.optional = Optional Enhancements
setting.alwaysmusic.name = Always Play Music
setting.alwaysmusic.description = When enabled, music will always play on loop in-game.\nWhen disabled, it only plays at random intervals.
setting.skipcoreanimation.name = Skip Core Launch/Land Animation
setting.landscape.name = Lock Landscape
setting.shadows.name = Shadows
+5 -2
View File
@@ -164,8 +164,11 @@ public class SoundControl{
//this just fades out the last track to make way for ingame music
silence();
//play music at intervals
if(Time.timeSinceMillis(lastPlayed) > 1000 * musicInterval / 60f){
if(Core.settings.getBool("alwaysmusic")){
if(current == null){
playRandom();
}
}else if(Time.timeSinceMillis(lastPlayed) > 1000 * musicInterval / 60f){
//chance to play it per interval
if(Mathf.chance(musicChance)){
lastPlayed = Time.millis();
@@ -297,6 +297,7 @@ public class SettingsMenuDialog extends BaseDialog{
}
void addSettings(){
sound.checkPref("alwaysmusic", false);
sound.sliderPref("musicvol", 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("sfxvol", 100, 0, 100, 1, i -> i + "%");
sound.sliderPref("ambientvol", 100, 0, 100, 1, i -> i + "%");