diff --git a/android/build.gradle b/android/build.gradle index 24ce776494..2c3912aeba 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.3.0' } } diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 6554acb117..50681fb1b4 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -70,6 +70,7 @@ public class Logic implements ApplicationListener{ state.gameOver = state.launched = false; state.teams = new Teams(); state.rules = new Rules(); + state.rules.spawns = Waves.getDefaultSpawns(); state.stats = new Stats(); Time.clear(); diff --git a/core/src/io/anuke/mindustry/game/Rules.java b/core/src/io/anuke/mindustry/game/Rules.java index 16a8b52845..ce6d1c7552 100644 --- a/core/src/io/anuke/mindustry/game/Rules.java +++ b/core/src/io/anuke/mindustry/game/Rules.java @@ -28,5 +28,5 @@ public class Rules{ /**Zone ID, -1 for invalid zone.*/ public byte zone = -1; /**Spawn layout. Since only zones modify this, it should be assigned on save load.*/ - public transient Array spawns = Waves.getDefaultSpawns(); + public transient Array spawns = new Array<>(); } diff --git a/core/src/io/anuke/mindustry/game/Waves.java b/core/src/io/anuke/mindustry/game/Waves.java index 48d6baf44c..3487fced36 100644 --- a/core/src/io/anuke/mindustry/game/Waves.java +++ b/core/src/io/anuke/mindustry/game/Waves.java @@ -8,162 +8,165 @@ import io.anuke.mindustry.content.Weapons; import io.anuke.mindustry.type.ItemStack; public class Waves{ - private static Array spawns = Array.with( - new SpawnGroup(UnitTypes.dagger){{ - end = 8; - unitScaling = 3; - }}, - - new SpawnGroup(UnitTypes.wraith){{ - begin = 12; - end = 14; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 11; - unitScaling = 2; - spacing = 2; - max = 4; - }}, - - new SpawnGroup(UnitTypes.titan){{ - begin = 9; - spacing = 3; - unitScaling = 2; - - end = 30; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 10; - unitScaling = 2; - unitAmount = 1; - spacing = 2; - end = 30; - }}, - - new SpawnGroup(UnitTypes.titan){{ - begin = 28; - spacing = 3; - unitScaling = 2; - weapon = Weapons.flamethrower; - end = 40; - }}, - - new SpawnGroup(UnitTypes.titan){{ - begin = 45; - spacing = 3; - unitScaling = 2; - weapon = Weapons.flamethrower; - effect = StatusEffects.overdrive; - }}, - - new SpawnGroup(UnitTypes.titan){{ - begin = 120; - spacing = 2; - unitScaling = 3; - unitAmount = 5; - weapon = Weapons.flakgun; - effect = StatusEffects.overdrive; - }}, - - new SpawnGroup(UnitTypes.wraith){{ - begin = 16; - unitScaling = 2; - spacing = 2; - - end = 39; - max = 7; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 82; - spacing = 3; - unitAmount = 4; - unitScaling = 3; - effect = StatusEffects.overdrive; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 41; - spacing = 5; - unitAmount = 1; - unitScaling = 3; - effect = StatusEffects.shielded; - max = 10; - }}, - - new SpawnGroup(UnitTypes.fortress){{ - begin = 40; - spacing = 5; - unitAmount = 2; - unitScaling = 3; - max = 10; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 35; - spacing = 3; - unitAmount = 4; - effect = StatusEffects.overdrive; - items = new ItemStack(Items.blastCompound, 60); - end = 60; - }}, - - new SpawnGroup(UnitTypes.dagger){{ - begin = 42; - spacing = 3; - unitAmount = 4; - effect = StatusEffects.overdrive; - items = new ItemStack(Items.pyratite, 100); - end = 130; - }}, - - new SpawnGroup(UnitTypes.ghoul){{ - begin = 40; - unitAmount = 2; - spacing = 2; - unitScaling = 3; - max = 8; - }}, - - new SpawnGroup(UnitTypes.wraith){{ - begin = 50; - unitAmount = 4; - unitScaling = 3; - spacing = 5; - effect = StatusEffects.overdrive; - max = 8; - }}, - - new SpawnGroup(UnitTypes.revenant){{ - begin = 50; - unitAmount = 4; - unitScaling = 3; - spacing = 5; - max = 8; - }}, - - new SpawnGroup(UnitTypes.ghoul){{ - begin = 53; - unitAmount = 2; - unitScaling = 3; - spacing = 4; - max = 8; - end = 74; - }}, - - new SpawnGroup(UnitTypes.ghoul){{ - begin = 53; - unitAmount = 2; - unitScaling = 3; - spacing = 4; - max = 8; - end = 74; - }} - ); + private static Array spawns; public static Array getDefaultSpawns(){ + if(spawns == null){ + spawns = Array.with( + new SpawnGroup(UnitTypes.dagger){{ + end = 8; + unitScaling = 3; + }}, + + new SpawnGroup(UnitTypes.wraith){{ + begin = 12; + end = 14; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 11; + unitScaling = 2; + spacing = 2; + max = 4; + }}, + + new SpawnGroup(UnitTypes.titan){{ + begin = 9; + spacing = 3; + unitScaling = 2; + + end = 30; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 10; + unitScaling = 2; + unitAmount = 1; + spacing = 2; + end = 30; + }}, + + new SpawnGroup(UnitTypes.titan){{ + begin = 28; + spacing = 3; + unitScaling = 2; + weapon = Weapons.flamethrower; + end = 40; + }}, + + new SpawnGroup(UnitTypes.titan){{ + begin = 45; + spacing = 3; + unitScaling = 2; + weapon = Weapons.flamethrower; + effect = StatusEffects.overdrive; + }}, + + new SpawnGroup(UnitTypes.titan){{ + begin = 120; + spacing = 2; + unitScaling = 3; + unitAmount = 5; + weapon = Weapons.flakgun; + effect = StatusEffects.overdrive; + }}, + + new SpawnGroup(UnitTypes.wraith){{ + begin = 16; + unitScaling = 2; + spacing = 2; + + end = 39; + max = 7; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 82; + spacing = 3; + unitAmount = 4; + unitScaling = 3; + effect = StatusEffects.overdrive; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 41; + spacing = 5; + unitAmount = 1; + unitScaling = 3; + effect = StatusEffects.shielded; + max = 10; + }}, + + new SpawnGroup(UnitTypes.fortress){{ + begin = 40; + spacing = 5; + unitAmount = 2; + unitScaling = 3; + max = 10; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 35; + spacing = 3; + unitAmount = 4; + effect = StatusEffects.overdrive; + items = new ItemStack(Items.blastCompound, 60); + end = 60; + }}, + + new SpawnGroup(UnitTypes.dagger){{ + begin = 42; + spacing = 3; + unitAmount = 4; + effect = StatusEffects.overdrive; + items = new ItemStack(Items.pyratite, 100); + end = 130; + }}, + + new SpawnGroup(UnitTypes.ghoul){{ + begin = 40; + unitAmount = 2; + spacing = 2; + unitScaling = 3; + max = 8; + }}, + + new SpawnGroup(UnitTypes.wraith){{ + begin = 50; + unitAmount = 4; + unitScaling = 3; + spacing = 5; + effect = StatusEffects.overdrive; + max = 8; + }}, + + new SpawnGroup(UnitTypes.revenant){{ + begin = 50; + unitAmount = 4; + unitScaling = 3; + spacing = 5; + max = 8; + }}, + + new SpawnGroup(UnitTypes.ghoul){{ + begin = 53; + unitAmount = 2; + unitScaling = 3; + spacing = 4; + max = 8; + end = 74; + }}, + + new SpawnGroup(UnitTypes.ghoul){{ + begin = 53; + unitAmount = 2; + unitScaling = 3; + spacing = 4; + max = 8; + end = 74; + }} + ); + } return spawns; } diff --git a/gradle.properties b/gradle.properties index d8e2a1210f..e08bde78fc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,4 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms512m -Xmx1536m -android.enableAapt2=true android.injected.build.model.only.versioned=3 -android.enableD8=true +android.enableD8=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 29953ea141..457aad0d98 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8d70..290541c738 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index cccdd3d517..af6708ff22 100755 --- a/gradlew +++ b/gradlew @@ -28,7 +28,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index e95643d6a2..0f8d5937c4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index a0acd29484..8717c54f44 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -26,10 +26,8 @@ import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Packets.KickReason; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.ItemType; -import io.anuke.mindustry.world.Tile; import java.io.IOException; -import java.lang.StringBuilder; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Scanner; @@ -565,33 +563,6 @@ public class ServerControl implements ApplicationListener{ Events.fire(new GameOverEvent(Team.red)); }); - handler.register("traceblock", " ", "Prints debug info about a block", arg -> { - try{ - int x = Integer.parseInt(arg[0]); - int y = Integer.parseInt(arg[1]); - Tile tile = world.tile(x, y); - if(tile != null){ - if(tile.entity != null){ - Array arr = tile.block().getDebugInfo(tile); - StringBuilder result = new StringBuilder(); - for(int i = 0; i < arr.size / 2; i++){ - result.append(arr.get(i * 2)); - result.append(": "); - result.append(arr.get(i * 2 + 1)); - result.append("\n"); - } - info("&ly{0}", result); - }else{ - info("No tile entity for that block."); - } - }else{ - info("No tile at that location."); - } - }catch(NumberFormatException e){ - err("Invalid coordinates passed."); - } - }); - handler.register("info", "", "Find player info(s). Can optionally check for all names or IPs a player has had.", arg -> { ObjectSet infos = netServer.admins.findByName(arg[0]); diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 3ca61212eb..eeab0b2642 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -33,6 +33,7 @@ import static io.anuke.mindustry.Vars.*; import static org.junit.jupiter.api.Assertions.*; public class ApplicationTests{ + static Map testMap; @BeforeAll static void launchApplication(){ @@ -62,6 +63,7 @@ public class ApplicationTests{ public void init(){ super.init(); begins[0] = true; + testMap = world.maps.loadInternalMap("groundZero"); } }; @@ -105,12 +107,12 @@ public class ApplicationTests{ void playMap(){ assertTrue(world.maps.all().size > 0); - world.loadMap(world.maps.all().first()); + world.loadMap(testMap); } @Test void spawnWaves(){ - world.loadMap(world.maps.all().first()); + world.loadMap(testMap); logic.runWave(); unitGroups[waveTeam.ordinal()].updateEvents(); assertFalse(unitGroups[waveTeam.ordinal()].isEmpty()); @@ -176,7 +178,7 @@ public class ApplicationTests{ void save(){ assertTrue(world.maps.all().size > 0); - world.loadMap(world.maps.all().first()); + world.loadMap(testMap); SaveIO.saveToSlot(0); } @@ -184,14 +186,14 @@ public class ApplicationTests{ void load(){ assertTrue(world.maps.all().size > 0); - world.loadMap(world.maps.all().first()); + world.loadMap(testMap); Map map = world.getMap(); SaveIO.saveToSlot(0); resetWorld(); SaveIO.loadFromSlot(0); - assertEquals(world.getMap(), map); + assertEquals(world.getMap().name, map.name); assertEquals(world.width(), map.meta.width); assertEquals(world.height(), map.meta.height); } @@ -225,8 +227,8 @@ public class ApplicationTests{ d1.set(10f, 20f); d2.set(10f, 20f); - d1.addBuildRequest(new BuildRequest(0, 0, 0, Recipe.getByResult(Blocks.copperWallLarge))); - d2.addBuildRequest(new BuildRequest(1, 1, 0, Recipe.getByResult(Blocks.copperWallLarge))); + d1.addBuildRequest(new BuildRequest(0, 0, 0, Blocks.copperWallLarge)); + d2.addBuildRequest(new BuildRequest(1, 1, 0, Blocks.copperWallLarge)); Time.setDeltaProvider(() -> 9999999f); d1.updateBuilding(d1); @@ -247,7 +249,7 @@ public class ApplicationTests{ d1.set(10f, 20f); d2.set(10f, 20f); - d1.addBuildRequest(new BuildRequest(0, 0, 0, Recipe.getByResult(Blocks.copperWallLarge))); + d1.addBuildRequest(new BuildRequest(0, 0, 0, Blocks.copperWallLarge)); d2.addBuildRequest(new BuildRequest(1, 1)); Time.setDeltaProvider(() -> 3f);