From 2593e9699972640ffa3a28e1a588e4ba6baaa9ac Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 17 Nov 2019 11:20:36 -0500 Subject: [PATCH] Bugfixes --- android/build.gradle | 2 +- core/src/io/anuke/mindustry/ClientLauncher.java | 2 +- core/src/io/anuke/mindustry/core/NetServer.java | 2 +- core/src/io/anuke/mindustry/game/Rules.java | 2 +- core/src/io/anuke/mindustry/input/InputHandler.java | 2 +- core/src/io/anuke/mindustry/net/Packets.java | 4 ++-- core/src/io/anuke/mindustry/world/Block.java | 4 +++- core/src/io/anuke/mindustry/world/BlockStorage.java | 2 +- .../mindustry/world/blocks/power/ItemLiquidGenerator.java | 2 +- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 15acace2ce..8dfa8665c5 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript{ } dependencies{ - classpath 'com.android.tools.build:gradle:3.5.2' + classpath 'com.android.tools.build:gradle:3.4.1' } } diff --git a/core/src/io/anuke/mindustry/ClientLauncher.java b/core/src/io/anuke/mindustry/ClientLauncher.java index 9c6248562c..6abff04782 100644 --- a/core/src/io/anuke/mindustry/ClientLauncher.java +++ b/core/src/io/anuke/mindustry/ClientLauncher.java @@ -104,7 +104,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform public void resize(int width, int height){ if(assets == null) return; - if(!assets.isFinished()){ + if(!finished){ Draw.proj().setOrtho(0, 0, width, height); }else{ super.resize(width, height); diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index 437cb10d57..233e6ef1e0 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -484,7 +484,7 @@ public class NetServer implements ApplicationListener{ for(BuildRequest req : requests){ if(req == null) continue; Tile tile = world.tile(req.x, req.y); - if(tile == null) continue; + if(tile == null || (!req.breaking && req.block == null)) continue; //auto-skip done requests if(req.breaking && tile.block() == Blocks.air){ continue; diff --git a/core/src/io/anuke/mindustry/game/Rules.java b/core/src/io/anuke/mindustry/game/Rules.java index 4579f330fa..dbafda9579 100644 --- a/core/src/io/anuke/mindustry/game/Rules.java +++ b/core/src/io/anuke/mindustry/game/Rules.java @@ -75,7 +75,7 @@ public class Rules{ /** Blocks that cannot be placed. */ public ObjectSet bannedBlocks = new ObjectSet<>(); /** Whether everything is dark. Enables lights. Experimental. */ - public boolean lighting = true; + public boolean lighting = false; /** Ambient light color, used when lighting is enabled. */ public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f); diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index ca104342c1..f95f7a2b04 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -455,7 +455,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } protected void drawRequest(BuildRequest request){ - drawRequest(request.x, request.y, request.block, request.rotation); + request.block.drawRequest(request, allRequests(), validPlace(request.x, request.y, request.block, request.rotation)); } /** Draws a placement icon for a specific block. */ diff --git a/core/src/io/anuke/mindustry/net/Packets.java b/core/src/io/anuke/mindustry/net/Packets.java index 0a39de51ef..963ed3c549 100644 --- a/core/src/io/anuke/mindustry/net/Packets.java +++ b/core/src/io/anuke/mindustry/net/Packets.java @@ -80,7 +80,7 @@ public class Packets{ buffer.put(mobile ? (byte)1 : 0); buffer.putInt(color); buffer.put(Base64Coder.decode(uuid)); - buffer.putInt(mods.size); + buffer.put((byte)mods.size); for(int i = 0; i < mods.size; i++){ TypeIO.writeString(buffer, mods.get(i)); } @@ -97,7 +97,7 @@ public class Packets{ byte[] idbytes = new byte[8]; buffer.get(idbytes); uuid = new String(Base64Coder.encode(idbytes)); - int totalMods = buffer.getInt(); + int totalMods = buffer.get(); mods = new Array<>(totalMods); for(int i = 0; i < totalMods; i++){ mods.add(TypeIO.readString(buffer)); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 1adcfe9f6c..4d28194f6b 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -720,10 +720,12 @@ public class Block extends BlockStorage{ Color color = content instanceof Item ? ((Item)content).color : content instanceof Liquid ? ((Liquid)content).color : null; if(color == null) return; + float prev = Draw.scl; + Draw.color(color); Draw.scl *= req.animScale; Draw.rect(region, req.drawx(), req.drawy()); - Draw.scl /= req.animScale; + Draw.scl = prev; Draw.color(); } diff --git a/core/src/io/anuke/mindustry/world/BlockStorage.java b/core/src/io/anuke/mindustry/world/BlockStorage.java index a60cd04716..505b3f7e30 100644 --- a/core/src/io/anuke/mindustry/world/BlockStorage.java +++ b/core/src/io/anuke/mindustry/world/BlockStorage.java @@ -116,7 +116,7 @@ public abstract class BlockStorage extends UnlockableContent{ Tile other = proximity.get((i + dump) % proximity.size); Tile in = Edges.getFacingEdge(tile, other); - other = other.block().getLiquidDestination(other, tile); + other = other.block().getLiquidDestination(other, in); if(other != null && 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; diff --git a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java index 5f24af369a..22133bf2bb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/ItemLiquidGenerator.java @@ -140,7 +140,7 @@ public class ItemLiquidGenerator extends PowerGenerator{ if(entity.generateTime > 0f){ entity.generateTime -= Math.min(1f / itemDuration * entity.delta(), entity.generateTime); - if(randomlyExplode && Mathf.chance(entity.delta() * 0.06 * Mathf.clamp(entity.explosiveness - 0.5f))){ + if(randomlyExplode && state.rules.reactorExplosions && Mathf.chance(entity.delta() * 0.06 * Mathf.clamp(entity.explosiveness - 0.5f))){ //this block is run last so that in the event of a block destruction, no code relies on the block type Core.app.post(() -> { entity.damage(Mathf.random(11f));