mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 10:17:39 +07:00
Fixed tests / Various build tools updated
This commit is contained in:
@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.1'
|
||||
classpath 'com.android.tools.build:gradle:3.3.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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<SpawnGroup> spawns = Waves.getDefaultSpawns();
|
||||
public transient Array<SpawnGroup> spawns = new Array<>();
|
||||
}
|
||||
|
@ -8,7 +8,11 @@ import io.anuke.mindustry.content.Weapons;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
|
||||
public class Waves{
|
||||
private static Array<SpawnGroup> spawns = Array.with(
|
||||
private static Array<SpawnGroup> spawns;
|
||||
|
||||
public static Array<SpawnGroup> getDefaultSpawns(){
|
||||
if(spawns == null){
|
||||
spawns = Array.with(
|
||||
new SpawnGroup(UnitTypes.dagger){{
|
||||
end = 8;
|
||||
unitScaling = 3;
|
||||
@ -162,8 +166,7 @@ public class Waves{
|
||||
end = 74;
|
||||
}}
|
||||
);
|
||||
|
||||
public static Array<SpawnGroup> getDefaultSpawns(){
|
||||
}
|
||||
return spawns;
|
||||
}
|
||||
|
||||
|
@ -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
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||
|
2
gradlew
vendored
2
gradlew
vendored
@ -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"
|
||||
|
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@ -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
|
||||
|
@ -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", "<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 -> {
|
||||
|
||||
ObjectSet<PlayerInfo> infos = netServer.admins.findByName(arg[0]);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user