mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-14 09:47:24 +07:00
Test fixes
This commit is contained in:
@ -261,6 +261,8 @@ public class BlockIndexer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateQuadrant(Tile tile){
|
private void updateQuadrant(Tile tile){
|
||||||
|
if(structQuadrants == null) return;
|
||||||
|
|
||||||
//this quadrant is now 'dirty', re-scan the whole thing
|
//this quadrant is now 'dirty', re-scan the whole thing
|
||||||
int quadrantX = tile.x / structQuadrantSize;
|
int quadrantX = tile.x / structQuadrantSize;
|
||||||
int quadrantY = tile.y / structQuadrantSize;
|
int quadrantY = tile.y / structQuadrantSize;
|
||||||
|
@ -90,7 +90,7 @@ public class Pathfinder{
|
|||||||
* This only occurs for active teams.*/
|
* This only occurs for active teams.*/
|
||||||
private void update(Tile tile, Team team){
|
private void update(Tile tile, Team team){
|
||||||
//make sure team exists
|
//make sure team exists
|
||||||
if(paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
|
if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
|
||||||
PathData path = paths[team.ordinal()];
|
PathData path = paths[team.ordinal()];
|
||||||
|
|
||||||
//impassable tiles have a weight of float.max
|
//impassable tiles have a weight of float.max
|
||||||
|
@ -5,8 +5,7 @@ import io.anuke.arc.collection.Array;
|
|||||||
import io.anuke.arc.collection.IntArray;
|
import io.anuke.arc.collection.IntArray;
|
||||||
import io.anuke.arc.math.Angles;
|
import io.anuke.arc.math.Angles;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Tmp;
|
|
||||||
import io.anuke.mindustry.content.Blocks;
|
import io.anuke.mindustry.content.Blocks;
|
||||||
import io.anuke.mindustry.content.Fx;
|
import io.anuke.mindustry.content.Fx;
|
||||||
import io.anuke.mindustry.entities.Damage;
|
import io.anuke.mindustry.entities.Damage;
|
||||||
@ -120,11 +119,13 @@ public class WaveSpawner{
|
|||||||
|
|
||||||
for(int x = 0; x < world.width(); x++){
|
for(int x = 0; x < world.width(); x++){
|
||||||
for(int y = 0; y < world.height(); y++){
|
for(int y = 0; y < world.height(); y++){
|
||||||
|
|
||||||
if(world.tile(x, y).block() == Blocks.spawn){
|
if(world.tile(x, y).block() == Blocks.spawn){
|
||||||
addSpawns(x, y);
|
addSpawns(x, y);
|
||||||
|
|
||||||
//hide spawnpoints, they have served their purpose
|
//hide spawnpoints, they have served their purpose
|
||||||
world.tile(x, y).setBlock(Blocks.air);
|
world.tile(x, y).setBlock(Blocks.air);
|
||||||
|
Log.info("Add spawn "+ x + " " + y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,14 @@ import static org.junit.jupiter.api.Assertions.*;
|
|||||||
|
|
||||||
public class ApplicationTests{
|
public class ApplicationTests{
|
||||||
static Map testMap;
|
static Map testMap;
|
||||||
|
static boolean initialized;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void launchApplication(){
|
static void launchApplication(){
|
||||||
|
//only gets called once
|
||||||
|
if(initialized) return;
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
boolean[] begins = {false};
|
boolean[] begins = {false};
|
||||||
Throwable[] exceptionThrown = {null};
|
Throwable[] exceptionThrown = {null};
|
||||||
@ -102,6 +107,7 @@ public class ApplicationTests{
|
|||||||
@Test
|
@Test
|
||||||
void spawnWaves(){
|
void spawnWaves(){
|
||||||
world.loadMap(testMap);
|
world.loadMap(testMap);
|
||||||
|
assertTrue(world.spawner.countSpawns() > 0, "No spawns present.");
|
||||||
logic.runWave();
|
logic.runWave();
|
||||||
//force trigger delayed spawns
|
//force trigger delayed spawns
|
||||||
Time.setDeltaProvider(() -> 1000f);
|
Time.setDeltaProvider(() -> 1000f);
|
||||||
@ -109,7 +115,7 @@ public class ApplicationTests{
|
|||||||
Time.update();
|
Time.update();
|
||||||
Time.setDeltaProvider(() -> 1f);
|
Time.setDeltaProvider(() -> 1f);
|
||||||
unitGroups[waveTeam.ordinal()].updateEvents();
|
unitGroups[waveTeam.ordinal()].updateEvents();
|
||||||
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty());
|
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty(), "No enemies spawned.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.collection.ObjectSet;
|
||||||
import io.anuke.arc.util.Structs;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Time;
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.type.Zone;
|
import io.anuke.mindustry.type.Zone;
|
||||||
@ -51,7 +50,7 @@ public class ZoneTests{
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(hasSpawnPoint, "Zone \"" + zone.name + "\" has no spawn points.");
|
assertTrue(hasSpawnPoint, "Zone \"" + zone.name + "\" has no spawn points.");
|
||||||
//assertTrue(world.spawner.countSpawns() > 0, "Zone \"" + zone.name + "\" has no enemy spawn points: " + world.spawner.countSpawns());
|
assertTrue(world.spawner.countSpawns() > 0, "Zone \"" + zone.name + "\" has no enemy spawn points: " + world.spawner.countSpawns());
|
||||||
|
|
||||||
for(Item item : resources){
|
for(Item item : resources){
|
||||||
assertTrue(Structs.contains(zone.resources, item), "Zone \"" + zone.name + "\" is missing item in resource list: \"" + item.name + "\"");
|
assertTrue(Structs.contains(zone.resources, item), "Zone \"" + zone.name + "\" is missing item in resource list: \"" + item.name + "\"");
|
||||||
|
Reference in New Issue
Block a user