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