mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-04 08:59:33 +07:00
Merge branch 'unsector'
# Conflicts: # core/src/io/anuke/mindustry/maps/SectorPresets.java # core/src/io/anuke/mindustry/maps/Sectors.java # core/src/io/anuke/mindustry/maps/TutorialSector.java # core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java # core/src/io/anuke/mindustry/maps/missions/MissionWithStartingCore.java # core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
This commit is contained in:
@ -101,12 +101,6 @@ public class ApplicationTests{
|
||||
assertTrue(content.getContentMap().length > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadSector(){
|
||||
world.sectors.createSector(0, 0);
|
||||
world.sectors.playSector(world.sectors.get(0, 0));
|
||||
}
|
||||
|
||||
@Test
|
||||
void playMap(){
|
||||
assertTrue(world.maps.all().size > 0);
|
||||
|
@ -1,54 +0,0 @@
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.ContentLoader;
|
||||
import io.anuke.mindustry.maps.SectorPresets;
|
||||
import io.anuke.mindustry.maps.generation.Generation;
|
||||
import io.anuke.mindustry.maps.missions.Mission;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/** This class is responsible for testing predefined sectors. */
|
||||
public class SectorTests{
|
||||
|
||||
private SectorPresets presets;
|
||||
private Generation fakeGen;
|
||||
|
||||
@BeforeAll
|
||||
static void initializeDependencies(){
|
||||
Vars.content = new ContentLoader();
|
||||
Vars.content.load();
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
void initTest(){
|
||||
this.presets = new SectorPresets();
|
||||
|
||||
// Fake away the Generation dependency
|
||||
this.fakeGen = new Generation(null, null, 250, 250, null);
|
||||
}
|
||||
|
||||
/** Returns true if at least one mission provides a spawn point. */
|
||||
private boolean spawnPointIsDefined(Array<Mission> missions){
|
||||
for(Mission mission : missions){
|
||||
if(mission.getSpawnPoints(this.fakeGen).size > 0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No spawn point provided
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that every predefined sector has a position for the player core defined.
|
||||
* This is achieved by adding at least one mission which defines a spawn point.
|
||||
*/
|
||||
@Test
|
||||
void sectorHasACore(){
|
||||
for(SectorPresets.SectorPreset preset : this.presets.getPresets().values()){
|
||||
assertTrue(spawnPointIsDefined(preset.missions), "Sector at (" + preset.x + "|" + preset.y + ") contains no missions which define a spawn point. Add a battle or wave mission.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user