TODO cleanup / Test fixes
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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;
|
||||
}};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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(){
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = 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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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))){
|
||||
|
||||
Reference in New Issue
Block a user