diff --git a/build.gradle b/build.gradle index 53409d95cd..0ac560c982 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { dependencies { classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0' classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6' - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.1.3' classpath "com.badlogicgames.gdx:gdx-tools:1.9.8" } } diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index bd88c5b98c..77af915292 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -662,6 +662,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra /**Resets all values of the player.*/ public void reset(){ + status.clear(); team = Team.blue; inventory.clear(); placeQueue.clear(); diff --git a/core/src/io/anuke/mindustry/entities/Units.java b/core/src/io/anuke/mindustry/entities/Units.java index 86b74a1968..291b80ca8c 100644 --- a/core/src/io/anuke/mindustry/entities/Units.java +++ b/core/src/io/anuke/mindustry/entities/Units.java @@ -19,6 +19,9 @@ import static io.anuke.mindustry.Vars.*; public class Units { private static Rectangle rect = new Rectangle(); private static Rectangle hitrect = new Rectangle(); + private static Unit result; + private static float cdist; + private static boolean boolResult; /**Validates a target. * @param target The target to validate @@ -49,20 +52,20 @@ public class Units { rect.setSize(type.size * tilesize, type.size * tilesize); rect.setCenter(tile.drawx(), tile.drawy()); - boolean[] value = new boolean[1]; + boolResult = false; Units.getNearby(rect, unit -> { - if (value[0]) return; + if (boolResult) return; if (!unit.isFlying()) { unit.getHitbox(hitrect); if (hitrect.overlaps(rect)) { - value[0] = true; + boolResult = true; } } }); - return value[0]; + return boolResult; } /**Returns whether there are any entities on this tile, with the hitbox expanded.*/ @@ -138,8 +141,8 @@ public class Units { /**Returns the closest enemy of this team. Filter by predicate.*/ public static Unit getClosestEnemy(Team team, float x, float y, float range, Predicate predicate){ - Unit[] result = {null}; - float[] cdist = {0}; + result = null; + cdist = 0f; rect.setSize(range*2f).setCenter(x, y); @@ -149,20 +152,20 @@ public class Units { float dist = Vector2.dst(e.x, e.y, x, y); if (dist < range) { - if (result[0] == null || dist < cdist[0]) { - result[0] = e; - cdist[0] = dist; + if (result == null || dist < cdist) { + result = e; + cdist = dist; } } }); - return result[0]; + return result; } /**Returns the closest ally of this team. Filter by predicate.*/ public static Unit getClosest(Team team, float x, float y, float range, Predicate predicate){ - Unit[] result = {null}; - float[] cdist = {0}; + result = null; + cdist = 0f; rect.setSize(range*2f).setCenter(x, y); @@ -172,14 +175,14 @@ public class Units { float dist = Vector2.dst(e.x, e.y, x, y); if (dist < range) { - if (result[0] == null || dist < cdist[0]) { - result[0] = e; - cdist[0] = dist; + if (result == null || dist < cdist) { + result = e; + cdist = dist; } } }); - return result[0]; + return result; } /**Iterates over all units in a rectangle.*/ diff --git a/core/src/io/anuke/mindustry/graphics/CacheLayer.java b/core/src/io/anuke/mindustry/graphics/CacheLayer.java index 623497e912..f1471c2a42 100644 --- a/core/src/io/anuke/mindustry/graphics/CacheLayer.java +++ b/core/src/io/anuke/mindustry/graphics/CacheLayer.java @@ -66,16 +66,15 @@ public enum CacheLayer { protected void beginShader(){ //renderer.getBlocks().endFloor(); - renderer.effectSurface.getBuffer().begin(); + renderer.effectSurface.getBuffer().bind(); Graphics.clear(Color.CLEAR); //renderer.getBlocks().beginFloor(); } public void endShader(Shader shader){ renderer.getBlocks().endFloor(); - renderer.effectSurface.getBuffer().end(); - renderer.pixelSurface.getBuffer().begin(); + renderer.pixelSurface.getBuffer().bind(); Graphics.shader(shader); Graphics.begin(); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java index ce2de1999d..87f667e628 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/UnlocksDialog.java @@ -45,7 +45,7 @@ public class UnlocksDialog extends FloatingDialog { table.table(list -> { list.left(); - int maxWidth = UIUtils.portrait() ? 7 : 14; + int maxWidth = UIUtils.portrait() ? 7 : 13; int size = 8*6; int count = 0; diff --git a/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java b/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java index bb1ba9df14..60dbf0adc7 100644 --- a/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java +++ b/core/src/io/anuke/mindustry/world/blocks/distribution/OverflowGate.java @@ -17,8 +17,8 @@ public class OverflowGate extends Splitter { if(dir == -1) return null; Tile to = dest.getNearby(dir); - if(!(to.block().acceptItem(item, to, dest) && - !(to.block().instantTransfer && source.block().instantTransfer))){ + if(!(to.block().acceptItem(item, to, dest) || + (to.block().instantTransfer && source.block().instantTransfer))){ Tile a = dest.getNearby(Mathf.mod(dir - 1, 4)); Tile b = dest.getNearby(Mathf.mod(dir + 1, 4)); boolean ac = !(a.block().instantTransfer && source.block().instantTransfer) && @@ -26,6 +26,10 @@ public class OverflowGate extends Splitter { boolean bc = !(b.block().instantTransfer && source.block().instantTransfer) && b.block().acceptItem(item, b, dest); + if(!ac && !bc){ + return null; + } + if(ac && !bc){ to = a; }else if(bc && !ac){ diff --git a/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java b/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java index ef546070fb..46643069eb 100644 --- a/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/world/mapgen/WorldGenerator.java @@ -131,9 +131,9 @@ public class WorldGenerator { for(int i = ores.size-1; i >= 0; i --){ OreEntry entry = ores.get(i); - if(entry.noise.octaveNoise2D(2, 0.7, 1f / (2 + i*2), x, y)/2f + - entry.ridge.getValue(x, y, 1f / (28 + i*4)) >= 2.0f - entry.frequency*4.0f - && entry.ridge.getValue(x+9999, y+9999, 1f/100f) > 0.4){ + if(entry.noise.octaveNoise2D(1, 0.7, 1f / (4 + i*2), x, y)/4f + + Math.abs(0.5f-entry.noise.octaveNoise2D(2, 0.7, 1f / (50 + i*2), x, y)) > 0.5f && + Math.abs(0.5f-entry.noise.octaveNoise2D(1, 1, 1f / (55 + i*4), x, y)) > 0.25f){ tile.setFloor((Floor) OreBlocks.get(tile.floor(), entry.item)); break; } @@ -166,7 +166,7 @@ public class WorldGenerator { Block wall = Blocks.air; double elevation = sim.octaveNoise2D(3, 0.5, 1f/100, x, y) * 4.1 - 1; - double temp = sim3.octaveNoise2D(7, 0.53, 1f/320f, x, y); + double temp = sim3.octaveNoise2D(7, 0.54, 1f/320f, x, y); double r = sim2.octaveNoise2D(1, 0.6, 1f/70, x, y); double edgeDist = Math.max(width/2, height/2) - Math.max(Math.abs(x - width/2), Math.abs(y - height/2)); diff --git a/gradle.properties b/gradle.properties index 93e3c4269f..d8e2a1210f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,5 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms512m -Xmx1536m -org.gradle.configureondemand=true android.enableAapt2=true android.injected.build.model.only.versioned=3 android.enableD8=true