From a1da82a173e1fd280371cd963d07f592f77517af Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 24 Sep 2019 23:57:19 -0400 Subject: [PATCH] crashfix --- core/src/io/anuke/mindustry/game/MusicControl.java | 9 +++++++-- core/src/io/anuke/mindustry/world/BlockStorage.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/io/anuke/mindustry/game/MusicControl.java b/core/src/io/anuke/mindustry/game/MusicControl.java index 81b0cdf0b6..a582babaca 100644 --- a/core/src/io/anuke/mindustry/game/MusicControl.java +++ b/core/src/io/anuke/mindustry/game/MusicControl.java @@ -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; /** normal, ambient music, plays at any time */ - public final Array ambientMusic = Array.with(Musics.game1, Musics.game3, Musics.game4, Musics.game6); + public Array ambientMusic = Array.with(); /** darker music, used in times of conflict */ - public final Array darkMusic = Array.with(Musics.game2, Musics.game5, Musics.game7); + public Array darkMusic = Array.with(); private Music lastRandomPlayed; private Interval timer = new Interval(); private @Nullable Music current; @@ -27,6 +27,11 @@ public class MusicControl{ private boolean silenced; 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 Events.on(WaveEvent.class, e -> Time.run(60f * 10f, () -> { if(Mathf.chance(musicWaveChance)){ diff --git a/core/src/io/anuke/mindustry/world/BlockStorage.java b/core/src/io/anuke/mindustry/world/BlockStorage.java index 8573284852..920dba6c3e 100644 --- a/core/src/io/anuke/mindustry/world/BlockStorage.java +++ b/core/src/io/anuke/mindustry/world/BlockStorage.java @@ -111,7 +111,7 @@ public abstract class BlockStorage extends UnlockableContent{ Tile other = proximity.get((i + dump) % proximity.size); 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 fract = tile.entity.liquids.get(liquid) / liquidCapacity;