diff --git a/core/assets-raw/sprites/blocks/turrets/turrets/fuse.png b/core/assets-raw/sprites/blocks/turrets/turrets/fuse.png index 2c1946a064..a204f941ad 100644 Binary files a/core/assets-raw/sprites/blocks/turrets/turrets/fuse.png and b/core/assets-raw/sprites/blocks/turrets/turrets/fuse.png differ diff --git a/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java index 3dade68ae1..dbccab63b9 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java @@ -7,7 +7,7 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.blocks.defense.*; public class DefenseBlocks extends BlockList implements ContentList{ - public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, deflectorwall, deflectorwalllarge, + public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector; @Override @@ -41,15 +41,6 @@ public class DefenseBlocks extends BlockList implements ContentList{ size = 2; }}; - deflectorwall = new DeflectorWall("deflector-wall"){{ - health = 150 * wallHealthMultiplier; - }}; - - deflectorwalllarge = new DeflectorWall("deflector-wall-large"){{ - health = 150 * 4 * wallHealthMultiplier; - size = 2; - }}; - phaseWall = new DeflectorWall("phase-wall"){{ health = 150 * wallHealthMultiplier; }}; diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index e3311173be..9cfc987a14 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -522,7 +522,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra isBoosting = true; } - float speed = isBoosting && !mech.flying ? mech.boostSpeed : mech.speed; + float speed = isBoosting && !mech.flying ? debug ? 5f : mech.boostSpeed : mech.speed; //fraction of speed when at max load float carrySlowdown = 0.7f; diff --git a/core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java b/core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java index 260dc5432b..0c59008089 100644 --- a/core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.maps.generation; +import com.badlogic.gdx.math.GridPoint2; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Predicate; @@ -9,8 +10,18 @@ import io.anuke.mindustry.game.Team; import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.world.Block; +import io.anuke.mindustry.world.Edges; +import io.anuke.mindustry.world.Tile; +import io.anuke.mindustry.world.blocks.defense.Door; +import io.anuke.mindustry.world.blocks.defense.Wall; import io.anuke.mindustry.world.blocks.defense.turrets.ItemTurret; import io.anuke.mindustry.world.blocks.defense.turrets.PowerTurret; +import io.anuke.mindustry.world.blocks.defense.turrets.Turret; +import io.anuke.mindustry.world.blocks.power.PowerGenerator; +import io.anuke.mindustry.world.blocks.power.SolarGenerator; +import io.anuke.mindustry.world.blocks.production.Drill; +import io.anuke.mindustry.world.consumers.ConsumePower; +import io.anuke.ucore.util.Mathf; public class FortressGenerator{ private final static int coreDst = 60; @@ -31,33 +42,96 @@ public class FortressGenerator{ } void gen(){ - gen.tiles[enemyX][enemyY].setBlock(StorageBlocks.core, team); - Item[] acceptedItems = {Items.copper, Items.densealloy, Items.silicon, Items.thorium}; + gen.setBlock(enemyX, enemyY, StorageBlocks.core, team); - Array turrets = find(b -> (b instanceof ItemTurret && accepts(((ItemTurret) b).getAmmoTypes(), acceptedItems) || b instanceof PowerTurret)); + float difficultyScl = Mathf.clamp(gen.sector.difficulty / 25f + Mathf.range(1f/2f), 0f, 0.9999f); + Array turrets = find(b -> (b instanceof ItemTurret && accepts(((ItemTurret) b).getAmmoTypes(), Items.copper) || b instanceof PowerTurret)); + Array drills = find(b -> b instanceof Drill && !b.consumes.has(ConsumePower.class)); + Array gens = find(b -> b instanceof SolarGenerator); + Array walls = find(b -> b instanceof Wall && !(b instanceof Door) && b.size == 1); + + Block wall = walls.get((int)(difficultyScl * walls.size)); + Drill drill = (Drill) drills.get((int)(difficultyScl * drills.size)); + + //place down drills for(int x = 0; x < gen.width; x++){ for(int y = 0; y < gen.height; y++){ if(Vector2.dst(x, y, enemyX, enemyY) > coreDst){ continue; } - Block turret = turrets.first(); + Item item = gen.drillItem(x, y, drill); - if(gen.random.chance(0.01) && gen.canPlace(x, y, turret)){ + if(item != null && item == Items.copper && gen.canPlace(x, y, drill)){ + gen.setBlock(x, y, drill, team); + } + } + } + + Turret turret = (Turret) turrets.first(); + + //place down turrets + for(int x = 0; x < gen.width; x++){ + for(int y = 0; y < gen.height; y++){ + if(Vector2.dst(x, y, enemyX, enemyY) > coreDst + 4 || !gen.canPlace(x, y, turret)){ + continue; + } + + boolean found = false; + + for(GridPoint2 point : Edges.getEdges(turret.size)){ + Tile tile = gen.tile(x + point.x, y + point.y); + + if(tile != null){ + tile = tile.target(); + + if(turret instanceof PowerTurret && tile.target().block() instanceof PowerGenerator){ + found = true; + break; + }else if(turret instanceof ItemTurret && tile.block() instanceof Drill && accepts(((ItemTurret) turret).getAmmoTypes(), gen.drillItem(tile.x, tile.y, (Drill) tile.block()))){ + found = true; + break; + } + } + } + + if(found){ gen.setBlock(x, y, turret, team); } } } + //place down drills + for(int x = 0; x < gen.width; x++){ + for(int y = 0; y < gen.height; y++){ + if(Vector2.dst(x, y, enemyX, enemyY) > coreDst || !gen.canPlace(x, y, wall)){ + continue; + } + + boolean found = false; + for(GridPoint2 point : Edges.getEdges(wall.size)){ + Tile tile = gen.tile(x + point.x, y + point.y); + if(tile != null){ + tile = tile.target(); + if(tile.getTeamID() == team.ordinal() && !(tile.block() instanceof Wall)){ + found = true; + break; + } + } + } + if(found){ + gen.setBlock(x, y, wall, team); + } + } + } + } - boolean accepts(AmmoType[] types, Item[] items){ + boolean accepts(AmmoType[] types, Item item){ for(AmmoType type : types){ - for(Item item : items){ - if(type.item == item){ - return true; - } + if(type.item == item){ + return true; } } return false; diff --git a/core/src/io/anuke/mindustry/maps/generation/Generation.java b/core/src/io/anuke/mindustry/maps/generation/Generation.java index aa7535279d..5677d57f86 100644 --- a/core/src/io/anuke/mindustry/maps/generation/Generation.java +++ b/core/src/io/anuke/mindustry/maps/generation/Generation.java @@ -23,6 +23,13 @@ public class Generation{ this.random = random; } + Tile tile(int x, int y){ + if(!Mathf.inBounds(x, y, tiles)){ + return null; + } + return tiles[x][y]; + } + //TODO implement Item drillItem(int x, int y, Drill block){ if(block.isMultiblock()){