Fixed tests / Various build tools updated

This commit is contained in:
Anuken
2019-01-22 15:01:30 -05:00
parent 0e5b95e3aa
commit 6229f99a2e
11 changed files with 174 additions and 198 deletions

View File

@ -8,7 +8,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.android.tools.build:gradle:3.3.0'
} }
} }

View File

@ -70,6 +70,7 @@ public class Logic implements ApplicationListener{
state.gameOver = state.launched = false; state.gameOver = state.launched = false;
state.teams = new Teams(); state.teams = new Teams();
state.rules = new Rules(); state.rules = new Rules();
state.rules.spawns = Waves.getDefaultSpawns();
state.stats = new Stats(); state.stats = new Stats();
Time.clear(); Time.clear();

View File

@ -28,5 +28,5 @@ public class Rules{
/**Zone ID, -1 for invalid zone.*/ /**Zone ID, -1 for invalid zone.*/
public byte zone = -1; public byte zone = -1;
/**Spawn layout. Since only zones modify this, it should be assigned on save load.*/ /**Spawn layout. Since only zones modify this, it should be assigned on save load.*/
public transient Array<SpawnGroup> spawns = Waves.getDefaultSpawns(); public transient Array<SpawnGroup> spawns = new Array<>();
} }

View File

@ -8,162 +8,165 @@ import io.anuke.mindustry.content.Weapons;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
public class Waves{ public class Waves{
private static Array<SpawnGroup> spawns = Array.with( private static Array<SpawnGroup> spawns;
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;
}}
);
public static Array<SpawnGroup> getDefaultSpawns(){ public static Array<SpawnGroup> 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; return spawns;
} }

View File

@ -1,5 +1,4 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms512m -Xmx1536m org.gradle.jvmargs=-Xms512m -Xmx1536m
android.enableAapt2=true
android.injected.build.model.only.versioned=3 android.injected.build.model.only.versioned=3
android.enableD8=true android.enableD8=true

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View File

@ -28,7 +28,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` 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. # 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"

2
gradlew.bat vendored
View File

@ -14,7 +14,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% 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. @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 @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View File

@ -26,10 +26,8 @@ import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.Packets.KickReason; import io.anuke.mindustry.net.Packets.KickReason;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType; import io.anuke.mindustry.type.ItemType;
import io.anuke.mindustry.world.Tile;
import java.io.IOException; import java.io.IOException;
import java.lang.StringBuilder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Scanner; import java.util.Scanner;
@ -565,33 +563,6 @@ public class ServerControl implements ApplicationListener{
Events.fire(new GameOverEvent(Team.red)); Events.fire(new GameOverEvent(Team.red));
}); });
handler.register("traceblock", "<x> <y>", "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<Object> 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", "<IP/UUID/name...>", "Find player info(s). Can optionally check for all names or IPs a player has had.", arg -> { handler.register("info", "<IP/UUID/name...>", "Find player info(s). Can optionally check for all names or IPs a player has had.", arg -> {
ObjectSet<PlayerInfo> infos = netServer.admins.findByName(arg[0]); ObjectSet<PlayerInfo> infos = netServer.admins.findByName(arg[0]);

View File

@ -33,6 +33,7 @@ import static io.anuke.mindustry.Vars.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
public class ApplicationTests{ public class ApplicationTests{
static Map testMap;
@BeforeAll @BeforeAll
static void launchApplication(){ static void launchApplication(){
@ -62,6 +63,7 @@ public class ApplicationTests{
public void init(){ public void init(){
super.init(); super.init();
begins[0] = true; begins[0] = true;
testMap = world.maps.loadInternalMap("groundZero");
} }
}; };
@ -105,12 +107,12 @@ public class ApplicationTests{
void playMap(){ void playMap(){
assertTrue(world.maps.all().size > 0); assertTrue(world.maps.all().size > 0);
world.loadMap(world.maps.all().first()); world.loadMap(testMap);
} }
@Test @Test
void spawnWaves(){ void spawnWaves(){
world.loadMap(world.maps.all().first()); world.loadMap(testMap);
logic.runWave(); logic.runWave();
unitGroups[waveTeam.ordinal()].updateEvents(); unitGroups[waveTeam.ordinal()].updateEvents();
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty()); assertFalse(unitGroups[waveTeam.ordinal()].isEmpty());
@ -176,7 +178,7 @@ public class ApplicationTests{
void save(){ void save(){
assertTrue(world.maps.all().size > 0); assertTrue(world.maps.all().size > 0);
world.loadMap(world.maps.all().first()); world.loadMap(testMap);
SaveIO.saveToSlot(0); SaveIO.saveToSlot(0);
} }
@ -184,14 +186,14 @@ public class ApplicationTests{
void load(){ void load(){
assertTrue(world.maps.all().size > 0); assertTrue(world.maps.all().size > 0);
world.loadMap(world.maps.all().first()); world.loadMap(testMap);
Map map = world.getMap(); Map map = world.getMap();
SaveIO.saveToSlot(0); SaveIO.saveToSlot(0);
resetWorld(); resetWorld();
SaveIO.loadFromSlot(0); SaveIO.loadFromSlot(0);
assertEquals(world.getMap(), map); assertEquals(world.getMap().name, map.name);
assertEquals(world.width(), map.meta.width); assertEquals(world.width(), map.meta.width);
assertEquals(world.height(), map.meta.height); assertEquals(world.height(), map.meta.height);
} }
@ -225,8 +227,8 @@ public class ApplicationTests{
d1.set(10f, 20f); d1.set(10f, 20f);
d2.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, 0, Recipe.getByResult(Blocks.copperWallLarge))); d2.addBuildRequest(new BuildRequest(1, 1, 0, Blocks.copperWallLarge));
Time.setDeltaProvider(() -> 9999999f); Time.setDeltaProvider(() -> 9999999f);
d1.updateBuilding(d1); d1.updateBuilding(d1);
@ -247,7 +249,7 @@ public class ApplicationTests{
d1.set(10f, 20f); d1.set(10f, 20f);
d2.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)); d2.addBuildRequest(new BuildRequest(1, 1));
Time.setDeltaProvider(() -> 3f); Time.setDeltaProvider(() -> 3f);