diff --git a/annotations/src/main/java/io/anuke/annotations/StructAnnotationProcessor.java b/annotations/src/main/java/io/anuke/annotations/StructAnnotationProcessor.java index e4efe6c6ad..dca27b6fa1 100644 --- a/annotations/src/main/java/io/anuke/annotations/StructAnnotationProcessor.java +++ b/annotations/src/main/java/io/anuke/annotations/StructAnnotationProcessor.java @@ -73,7 +73,7 @@ public class StructAnnotationProcessor extends AbstractProcessor{ Class structType = typeForSize(structSize); //[constructor] get(fields...) : structType - MethodSpec.Builder constructor = MethodSpec.methodBuilder("get") //TODO 'get'..? + MethodSpec.Builder constructor = MethodSpec.methodBuilder("get") .addModifiers(Modifier.STATIC, Modifier.PUBLIC) .returns(structType); diff --git a/core/src/io/anuke/mindustry/ai/BlockIndexer.java b/core/src/io/anuke/mindustry/ai/BlockIndexer.java index b20ef572a8..d7ebcad8eb 100644 --- a/core/src/io/anuke/mindustry/ai/BlockIndexer.java +++ b/core/src/io/anuke/mindustry/ai/BlockIndexer.java @@ -17,8 +17,6 @@ import io.anuke.mindustry.world.meta.BlockFlag; import static io.anuke.mindustry.Vars.*; -//TODO consider using quadtrees for finding specific types of blocks within an area - /**Class used for indexing special target blocks for AI.*/ @SuppressWarnings("unchecked") public class BlockIndexer{ diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 9ef07e5f47..06e63ff889 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -51,7 +51,7 @@ public class Blocks implements ContentList{ copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine, - //transpor + //transport conveyor, titaniumConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver, //liquids @@ -992,7 +992,7 @@ public class Blocks implements ContentList{ alwaysUnlocked = true; health = 1100; - itemCapacity = 5000; + itemCapacity = 3000; size = 3; }}; @@ -1000,7 +1000,7 @@ public class Blocks implements ContentList{ requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 4000, Items.silicon, 2000)); health = 2000; - itemCapacity = 8000; + itemCapacity = 6000; size = 4; }}; @@ -1008,7 +1008,7 @@ public class Blocks implements ContentList{ requirements(Category.effect, () -> false, ItemStack.with(Items.titanium, 8000, Items.silicon, 4000, Items.surgealloy, 2000)); health = 4000; - itemCapacity = 12000; + itemCapacity = 10000; size = 5; }}; diff --git a/core/src/io/anuke/mindustry/content/TechTree.java b/core/src/io/anuke/mindustry/content/TechTree.java index 4591469f55..1af9e96450 100644 --- a/core/src/io/anuke/mindustry/content/TechTree.java +++ b/core/src/io/anuke/mindustry/content/TechTree.java @@ -266,7 +266,7 @@ public class TechTree implements ContentList{ private TechNode node(Block block, Runnable children){ ItemStack[] requirements = new ItemStack[block.buildRequirements.length]; for(int i = 0; i < requirements.length; i++){ - requirements[i] = new ItemStack(block.buildRequirements[i].item, block.buildRequirements[i].amount * 50); + requirements[i] = new ItemStack(block.buildRequirements[i].item, block.buildRequirements[i].amount * 40); } return new TechNode(block, requirements, children); @@ -288,7 +288,6 @@ public class TechTree implements ContentList{ context.children.add(this); } - //TODO remove requirements... for now this.block = block; this.requirements = requirements; diff --git a/core/src/io/anuke/mindustry/content/Zones.java b/core/src/io/anuke/mindustry/content/Zones.java index 37d5e16993..2d56db65ec 100644 --- a/core/src/io/anuke/mindustry/content/Zones.java +++ b/core/src/io/anuke/mindustry/content/Zones.java @@ -29,7 +29,7 @@ public class Zones implements ContentList{ waveSpacing = 60 * 60 * 2; //2 mins spawns = Array.with( new SpawnGroup(UnitTypes.dagger){{ - unitScaling = 2; + unitScaling = 1.5f; }}, new SpawnGroup(UnitTypes.dagger){{ @@ -73,7 +73,7 @@ public class Zones implements ContentList{ waveSpacing = 60 * 60 * 1.5f; spawns = Array.with( new SpawnGroup(UnitTypes.dagger){{ - unitScaling = 2; + unitScaling = 1.5f; }}, new SpawnGroup(UnitTypes.crawler){{ @@ -109,7 +109,8 @@ public class Zones implements ContentList{ }}; frozenForest = new Zone("frozenForest", new MapGenerator("frozenForest", 2) - .decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.02))){{ + .decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.02)) + .core(Blocks.coreFoundation)){{ deployCost = ItemStack.with(Items.copper, 500); startingItems = ItemStack.with(Items.copper, 400); conditionWave = 10; @@ -168,7 +169,8 @@ public class Zones implements ContentList{ }}; }}; - ruinousShores = new Zone("ruinousShores", new MapGenerator("ruinousShores", 1)){{ + ruinousShores = new Zone("ruinousShores", new MapGenerator("ruinousShores", 1) + .core(Blocks.coreFoundation)){{ deployCost = ItemStack.with(Items.copper, 600, Items.graphite, 50); startingItems = ItemStack.with(Items.copper, 400); conditionWave = 20; @@ -242,7 +244,8 @@ public class Zones implements ContentList{ stainedMountains = new Zone("stainedMountains", new MapGenerator("stainedMountains", 2) .dist(2.5f, true) - .decor(new Decoration(Blocks.stainedStone, Blocks.stainedBoulder, 0.01))){{ + .decor(new Decoration(Blocks.stainedStone, Blocks.stainedBoulder, 0.01)) + .core(Blocks.coreFoundation)){{ deployCost = ItemStack.with(Items.copper, 500, Items.lead, 300, Items.silicon, 100); startingItems = ItemStack.with(Items.copper, 400, Items.lead, 100); conditionWave = 10; @@ -386,7 +389,8 @@ public class Zones implements ContentList{ }}; }}; - desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift").dist(2f)){{ + desolateRift = new Zone("desolateRift", new MapGenerator("desolateRift") + .core(Blocks.coreFoundation).dist(2f)){{ deployCost = ItemStack.with(Items.copper, 2000); startingItems = ItemStack.with(Items.copper, 1500); itemRequirements = ItemStack.with(Items.copper, 8000, Items.metaglass, 2000, Items.graphite, 3000); diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index e0bf8704a1..cb33334a45 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -200,8 +200,6 @@ public class Renderer implements ApplicationListener{ overlays.drawBottom(); drawAndInterpolate(playerGroup, p -> true, Player::drawBuildRequests); - //TODO shield - if(EntityDraw.countInBounds(shieldGroup) > 0){ if(graphics.getWidth() >= 2 && graphics.getHeight() >= 2 && (shieldBuffer.getWidth() != graphics.getWidth() || shieldBuffer.getHeight() != graphics.getHeight())){ shieldBuffer.resize(graphics.getWidth(), graphics.getHeight()); @@ -232,9 +230,6 @@ public class Renderer implements ApplicationListener{ } private void drawFlyerShadows(){ - //TODO fix flyer shadows - //Graphics.surface(effectSurface, true, false); - float trnsX = -12, trnsY = -13; Draw.color(0, 0, 0, 0.15f); @@ -248,8 +243,6 @@ public class Renderer implements ApplicationListener{ drawAndInterpolate(playerGroup, unit -> unit.isFlying() && !unit.isDead(), player -> player.drawShadow(trnsX, trnsY)); } - //Draw.color(0, 0, 0, 0.15f); - //Graphics.flushSurface(); Draw.color(); } diff --git a/core/src/io/anuke/mindustry/graphics/CacheLayer.java b/core/src/io/anuke/mindustry/graphics/CacheLayer.java index ea4f31a20a..e84bd0a823 100644 --- a/core/src/io/anuke/mindustry/graphics/CacheLayer.java +++ b/core/src/io/anuke/mindustry/graphics/CacheLayer.java @@ -1,22 +1,10 @@ package io.anuke.mindustry.graphics; -//TODO implement effects again public enum CacheLayer{ - water{ - public void begin(){ - //Draw.shader(Shaders.water); - } - - public void end(){ - //Draw.shader(); - } - }, - lava{ - }, - oil{ - }, - space{ - }, + water, + lava, + oil, + space, normal, walls; @@ -27,11 +15,4 @@ public enum CacheLayer{ public void end(){ } - - protected void beginShader(){ - - } - - public void endShader(){ - } } diff --git a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java index 6906357e1b..e86376ee4b 100644 --- a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java @@ -29,12 +29,8 @@ public class OverlayRenderer{ if(!input.isDrawing() || player.isDead()) continue; Shaders.outline.color.set(Pal.accent); - //TODO draw outlined version - //Graphics.beginShaders(Shaders.outline); input.drawOutlined(); - - //Graphics.endShaders(); } } diff --git a/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java b/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java index 948272bb68..e348bca08b 100644 --- a/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generators/BasicGenerator.java @@ -21,7 +21,6 @@ public class BasicGenerator extends RandomGenerator{ @Override public void generate(Tile[][] tiles){ - //todo use set seed int seed = Mathf.random(99999999); sim.setSeed(seed); sim2.setSeed(seed + 1); diff --git a/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java b/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java index 52b3f97ba0..3a85a83aac 100644 --- a/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java @@ -36,6 +36,7 @@ public class MapGenerator extends Generator{ public boolean distortFloor = false; /**Items randomly added to containers and vaults.*/ public ItemStack[] storageDrops = ItemStack.with(Items.copper, 300, Items.lead, 300, Items.silicon, 200, Items.graphite, 200, Items.blastCompound, 200); + public Block coreBlock; public MapGenerator(String mapName){ this.mapName = mapName; @@ -46,6 +47,11 @@ public class MapGenerator extends Generator{ this.enemySpawns = enemySpawns; } + public MapGenerator core(Block block){ + this.coreBlock = block; + return this; + } + public MapGenerator drops(ItemStack[] drops){ this.storageDrops = drops; return this; @@ -174,8 +180,7 @@ public class MapGenerator extends Generator{ throw new IllegalArgumentException("All zone maps must have a core."); } - //TODO set specific core block? - tiles[core.x][core.y].setBlock(coreTypes.get(players.indexOf(core)), defaultTeam); + tiles[core.x][core.y].setBlock(coreBlock == null ? coreTypes.get(players.indexOf(core)) : coreBlock, defaultTeam); world.prepareTiles(tiles); world.setMap(map); diff --git a/core/src/io/anuke/mindustry/type/Zone.java b/core/src/io/anuke/mindustry/type/Zone.java index cc7feb01b8..4882dc293d 100644 --- a/core/src/io/anuke/mindustry/type/Zone.java +++ b/core/src/io/anuke/mindustry/type/Zone.java @@ -9,6 +9,7 @@ import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.maps.generators.Generator; import io.anuke.mindustry.world.Block; +import static io.anuke.mindustry.Vars.data; import static io.anuke.mindustry.Vars.state; public class Zone extends UnlockableContent{ @@ -22,6 +23,7 @@ public class Zone extends UnlockableContent{ public Supplier rules = Rules::new; public boolean alwaysUnlocked; public int conditionWave = Integer.MAX_VALUE; + public int configureWave = 50; public int launchPeriod = 10; public Zone(String name, Generator generator){ @@ -34,6 +36,10 @@ public class Zone extends UnlockableContent{ return state.wave >= conditionWave; } + public boolean canConfigure(){ + return data.getWaveScore(this) >= configureWave; + } + @Override public void init(){ generator.init(); diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java index 7b806c0150..8f3d143a23 100644 --- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/PowerTurret.java @@ -2,11 +2,11 @@ package io.anuke.mindustry.world.blocks.defense.turrets; import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.consumers.ConsumePower; import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.StatUnit; public abstract class PowerTurret extends CooledTurret{ - //TODO recode this class, satisfaction must be 100%! /** The percentage of power which will be used per shot. */ protected float powerUsed = 0.5f; protected BulletType shootType; @@ -20,7 +20,7 @@ public abstract class PowerTurret extends CooledTurret{ public void setStats(){ super.setStats(); - stats.add(BlockStat.powerShot, powerUsed, StatUnit.powerUnits); + stats.add(BlockStat.powerShot, powerUsed * consumes.get(ConsumePower.class).powerCapacity, StatUnit.powerUnits); } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java index 40d3ea3268..c73732cace 100644 --- a/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java +++ b/core/src/io/anuke/mindustry/world/blocks/production/Smelter.java @@ -42,8 +42,6 @@ public class Smelter extends Block{ public void setStats(){ super.setStats(); - //TODO - //stats.add(BlockStat.inputFuel, fuel); stats.add(BlockStat.fuelBurnTime, burnDuration / 60f, StatUnit.seconds); stats.add(BlockStat.outputItem, result); stats.add(BlockStat.craftSpeed, 60f / craftTime, StatUnit.itemsSecond); diff --git a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java index 752598b7eb..a6cd265179 100644 --- a/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/io/anuke/mindustry/world/blocks/units/UnitFactory.java @@ -210,6 +210,12 @@ public class UnitFactory extends Block{ return new UnitFactoryEntity(); } + @Override + public boolean canProduce(Tile tile){ + UnitFactoryEntity entity = tile.entity(); + return entity.spawned < maxSpawn; + } + protected boolean hasRequirements(ItemModule inv, float fraction){ for(ItemStack stack : consumes.items()){ if(!inv.has(stack.item, (int) (fraction * stack.amount))){ diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index 28446cf210..725b6246a4 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -105,8 +105,6 @@ public class ApplicationTests{ @Test void playMap(){ - assertTrue(world.maps.all().size > 0); - world.loadMap(testMap); } @@ -125,8 +123,6 @@ public class ApplicationTests{ @Test void createMap(){ - assertTrue(world.maps.all().size > 0); - Tile[][] tiles = world.createTiles(8, 8); world.beginMapLoad(); @@ -181,16 +177,12 @@ public class ApplicationTests{ @Test void save(){ - assertTrue(world.maps.all().size > 0); - world.loadMap(testMap); SaveIO.saveToSlot(0); } @Test void load(){ - assertTrue(world.maps.all().size > 0); - world.loadMap(testMap); Map map = world.getMap(); @@ -198,7 +190,6 @@ public class ApplicationTests{ resetWorld(); SaveIO.loadFromSlot(0); - assertEquals(world.getMap().name, map.name); assertEquals(world.width(), map.meta.width); assertEquals(world.height(), map.meta.height); } diff --git a/tests/src/test/java/power/DirectConsumerTests.java b/tests/src/test/java/power/DirectConsumerTests.java index e6081f7258..31d5db1d98 100644 --- a/tests/src/test/java/power/DirectConsumerTests.java +++ b/tests/src/test/java/power/DirectConsumerTests.java @@ -41,7 +41,7 @@ public class DirectConsumerTests extends PowerTestFixture{ consumerTile.entity.items.add(Items.lead, leadAmount); Tile producerTile = createFakeTile(2, 0, createFakeProducerBlock(producedPower)); - producerTile.entity().productionEfficiency = 0.5f; // 100% + producerTile.entity().productionEfficiency = 1f; PowerGraph graph = new PowerGraph(); graph.add(producerTile); diff --git a/tests/src/test/java/power/PowerTestFixture.java b/tests/src/test/java/power/PowerTestFixture.java index dd8fcf1597..66f3058554 100644 --- a/tests/src/test/java/power/PowerTestFixture.java +++ b/tests/src/test/java/power/PowerTestFixture.java @@ -38,9 +38,8 @@ public class PowerTestFixture{ } protected static PowerGenerator createFakeProducerBlock(float producedPower){ - // Multiply produced power by 2 since production efficiency is defined to be 0.5 = 100% return new PowerGenerator("fakegen"){{ - powerProduction = producedPower * 2.0f; + powerProduction = producedPower; }}; } diff --git a/tests/src/test/java/power/PowerTests.java b/tests/src/test/java/power/PowerTests.java index 4010f10a9c..3d7a30117d 100644 --- a/tests/src/test/java/power/PowerTests.java +++ b/tests/src/test/java/power/PowerTests.java @@ -51,7 +51,6 @@ public class PowerTests extends PowerTestFixture{ } void simulateDirectConsumption(float producedPower, float requiredPower, float expectedSatisfaction, String parameterDescription){ Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower)); - producerTile.entity().productionEfficiency = 0.5f; // Currently, 0.5f = 100% Tile directConsumerTile = createFakeTile(0, 1, createFakeDirectConsumer(requiredPower)); PowerGraph powerGraph = new PowerGraph(); @@ -91,7 +90,6 @@ public class PowerTests extends PowerTestFixture{ } void simulateBufferedConsumption(float producedPower, float maxBuffer, float powerConsumedPerTick, float initialSatisfaction, float expectedSatisfaction, String parameterDescription){ Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower)); - producerTile.entity().productionEfficiency = 0.5f; // Currently, 0.5 = 100% Tile bufferedConsumerTile = createFakeTile(0, 1, createFakeBufferedConsumer(maxBuffer, maxBuffer > 0.0f ? maxBuffer/powerConsumedPerTick : 1.0f)); bufferedConsumerTile.entity.power.satisfaction = initialSatisfaction; @@ -136,7 +134,6 @@ public class PowerTests extends PowerTestFixture{ if(producedPower > 0.0f){ Tile producerTile = createFakeTile(0, 0, createFakeProducerBlock(producedPower)); - producerTile.entity().productionEfficiency = 0.5f; powerGraph.add(producerTile); } Tile directConsumerTile = null;