diff --git a/.gitignore b/.gitignore index e658c17679..cfa73a21a5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ logs/ /core/assets/version.properties /core/assets/locales /ios/src/io/anuke/mindustry/gen/ +/core/src/io/anuke/mindustry/gen/ *.gif version.properties diff --git a/build.gradle b/build.gradle index d16c36a4a5..8bc3fca889 100644 --- a/build.gradle +++ b/build.gradle @@ -120,7 +120,7 @@ project(":ios") { } } - build.dependsOn(copyGen) + //build.dependsOn(copyGen) dependencies { compile project(":core") @@ -131,6 +131,7 @@ project(":ios") { compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" + compileOnly project(":annotations") } } diff --git a/core/src/Mindustry.gwt.xml b/core/src/Mindustry.gwt.xml deleted file mode 100644 index 828369ac80..0000000000 --- a/core/src/Mindustry.gwt.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/src/io/anuke/mindustry/ai/BlockIndexer.java b/core/src/io/anuke/mindustry/ai/BlockIndexer.java index 1213bd2721..04c5c04cb8 100644 --- a/core/src/io/anuke/mindustry/ai/BlockIndexer.java +++ b/core/src/io/anuke/mindustry/ai/BlockIndexer.java @@ -247,7 +247,7 @@ public class BlockIndexer{ for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){ for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){ Tile result = world.tile(x, y); - if(result.block().drops == null || !scanOres.contains(result.block().drops.item)) continue; + if( result == null || result.block().drops == null || !scanOres.contains(result.block().drops.item)) continue; itemSet.add(result.block().drops.item); } diff --git a/core/src/io/anuke/mindustry/maps/SectorPresets.java b/core/src/io/anuke/mindustry/maps/SectorPresets.java index 29540e1d5b..08fa7f1b19 100644 --- a/core/src/io/anuke/mindustry/maps/SectorPresets.java +++ b/core/src/io/anuke/mindustry/maps/SectorPresets.java @@ -56,7 +56,8 @@ public class SectorPresets{ Missions.blockRecipe(ProductionBlocks.waterExtractor), new ContentMission(Items.biomatter), Missions.blockRecipe(CraftingBlocks.biomatterCompressor), - new ContentMission(Liquids.oil) + new ContentMission(Liquids.oil), + new BattleMission() ), Array.with(Items.copper, Items.lead, Items.coal, Items.titanium))); } @@ -69,6 +70,8 @@ public class SectorPresets{ return presets.get(x, y); } + public GridMap getPresets() { return presets; } + private void add(SectorPreset preset){ presets.put(preset.x, preset.y, preset); orePresets.put(preset.x, preset.y, preset.ores); diff --git a/ios/Info.plist.xml b/ios/Info.plist.xml index bc072235db..abd81b462c 100644 --- a/ios/Info.plist.xml +++ b/ios/Info.plist.xml @@ -34,6 +34,8 @@ UIRequiresFullScreen + LSSupportsOpeningDocumentsInPlace + NSPhotoLibraryAddUsageDescription Mindustry UIDeviceFamily diff --git a/ios/robovm.properties b/ios/robovm.properties index 24b6483340..f6b10f99b5 100644 --- a/ios/robovm.properties +++ b/ios/robovm.properties @@ -2,5 +2,5 @@ app.version=4.0 app.id=io.anuke.mindustry app.mainclass=io.anuke.mindustry.IOSLauncher app.executable=IOSLauncher -app.build=23 +app.build=25 app.name=Mindustry diff --git a/ios/robovm.xml b/ios/robovm.xml index 851c59da6f..efa0df89f0 100644 --- a/ios/robovm.xml +++ b/ios/robovm.xml @@ -18,6 +18,7 @@ + net.jpountz.lz4.** io.anuke.ucore.scene.** io.anuke.mindustry.gen.Call io.anuke.mindustry.net.** diff --git a/tests/src/test/java/SectorTests.java b/tests/src/test/java/SectorTests.java new file mode 100644 index 0000000000..3aae6cb305 --- /dev/null +++ b/tests/src/test/java/SectorTests.java @@ -0,0 +1,54 @@ +import com.badlogic.gdx.utils.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.*; + +/** 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 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 test_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."); + } + } +}