This commit is contained in:
Anuken
2019-09-24 23:57:19 -04:00
parent f1456190b5
commit a1da82a173
2 changed files with 8 additions and 3 deletions

View File

@@ -17,9 +17,9 @@ public class MusicControl{
private static final float finTime = 120f, foutTime = 120f, musicInterval = 60 * 60 * 3f, musicChance = 0.6f, musicWaveChance = 0.5f; private static final float finTime = 120f, foutTime = 120f, musicInterval = 60 * 60 * 3f, musicChance = 0.6f, musicWaveChance = 0.5f;
/** normal, ambient music, plays at any time */ /** normal, ambient music, plays at any time */
public final Array<Music> ambientMusic = Array.with(Musics.game1, Musics.game3, Musics.game4, Musics.game6); public Array<Music> ambientMusic = Array.with();
/** darker music, used in times of conflict */ /** darker music, used in times of conflict */
public final Array<Music> darkMusic = Array.with(Musics.game2, Musics.game5, Musics.game7); public Array<Music> darkMusic = Array.with();
private Music lastRandomPlayed; private Music lastRandomPlayed;
private Interval timer = new Interval(); private Interval timer = new Interval();
private @Nullable Music current; private @Nullable Music current;
@@ -27,6 +27,11 @@ public class MusicControl{
private boolean silenced; private boolean silenced;
public MusicControl(){ public MusicControl(){
Events.on(ClientLoadEvent.class, e -> {
ambientMusic = Array.with(Musics.game1, Musics.game3, Musics.game4, Musics.game6);
darkMusic = Array.with(Musics.game2, Musics.game5, Musics.game7);
});
//only run music 10 seconds after a wave spawns //only run music 10 seconds after a wave spawns
Events.on(WaveEvent.class, e -> Time.run(60f * 10f, () -> { Events.on(WaveEvent.class, e -> Time.run(60f * 10f, () -> {
if(Mathf.chance(musicWaveChance)){ if(Mathf.chance(musicWaveChance)){

View File

@@ -111,7 +111,7 @@ public abstract class BlockStorage extends UnlockableContent{
Tile other = proximity.get((i + dump) % proximity.size); Tile other = proximity.get((i + dump) % proximity.size);
Tile in = Edges.getFacingEdge(tile, other); Tile in = Edges.getFacingEdge(tile, other);
if(other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid)){ if(other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids != null){
float ofract = other.entity.liquids.get(liquid) / other.block().liquidCapacity; float ofract = other.entity.liquids.get(liquid) / other.block().liquidCapacity;
float fract = tile.entity.liquids.get(liquid) / liquidCapacity; float fract = tile.entity.liquids.get(liquid) / liquidCapacity;