mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-16 10:40:29 -07:00
parent
a6801af128
commit
0ffcd0b94c
2 changed files with 7 additions and 2 deletions
|
|
@ -100,6 +100,8 @@ public class MusicControl{
|
|||
/** Plays and fades in a music track. This must be called every frame.
|
||||
* If something is already playing, fades out that track and fades in this new music.*/
|
||||
private void play(@Nullable Music music){
|
||||
if(!shouldPlay()) return;
|
||||
|
||||
//update volume of current track
|
||||
if(current != null){
|
||||
current.setVolume(fade * Core.settings.getInt("musicvol") / 100f);
|
||||
|
|
@ -143,7 +145,7 @@ public class MusicControl{
|
|||
|
||||
/** Plays a music track once and only once. If something is already playing, does nothing.*/
|
||||
private void playOnce(Music music){
|
||||
if(current != null || music == null) return; //do not interrupt already-playing tracks
|
||||
if(current != null || music == null || !shouldPlay()) return; //do not interrupt already-playing tracks
|
||||
|
||||
//save last random track played to prevent duplicates
|
||||
lastRandomPlayed = music;
|
||||
|
|
@ -162,6 +164,10 @@ public class MusicControl{
|
|||
current.play();
|
||||
}
|
||||
|
||||
private boolean shouldPlay(){
|
||||
return Core.settings.getInt("musicvol") > 0;
|
||||
}
|
||||
|
||||
/** Fades out the current track, unless it has already been silenced. */
|
||||
private void silence(){
|
||||
play(null);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ public class Junction extends Block{
|
|||
super(name);
|
||||
update = true;
|
||||
solid = true;
|
||||
instantTransfer = true;
|
||||
group = BlockGroup.transportation;
|
||||
unloadable = false;
|
||||
entityType = JunctionEntity::new;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue