Fixed tests
This commit is contained in:
@@ -79,11 +79,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||||||
//Power amount is delta'd by PowerGraph class already.
|
//Power amount is delta'd by PowerGraph class already.
|
||||||
float calculationDelta = entity.delta();
|
float calculationDelta = entity.delta();
|
||||||
|
|
||||||
if(!entity.cons.valid()){
|
|
||||||
entity.productionEfficiency = 0.0f;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Liquid liquid = null;
|
Liquid liquid = null;
|
||||||
for(Liquid other : content.liquids()){
|
for(Liquid other : content.liquids()){
|
||||||
if(hasLiquids && entity.liquids.get(other) >= 0.001f && getLiquidEfficiency(other) >= minLiquidEfficiency){
|
if(hasLiquids && entity.liquids.get(other) >= 0.001f && getLiquidEfficiency(other) >= minLiquidEfficiency){
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.world.modules;
|
package io.anuke.mindustry.world.modules;
|
||||||
|
|
||||||
import io.anuke.arc.util.Log;
|
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.entities.type.TileEntity;
|
||||||
import io.anuke.mindustry.world.consumers.Consume;
|
import io.anuke.mindustry.world.consumers.Consume;
|
||||||
|
|
||||||
@@ -22,10 +21,7 @@ public class ConsumeModule extends BlockModule{
|
|||||||
optionalValid = true;
|
optionalValid = true;
|
||||||
boolean docons = entity.block.shouldConsume(entity.tile);
|
boolean docons = entity.block.shouldConsume(entity.tile);
|
||||||
|
|
||||||
Log.info("update begin: is valid");
|
|
||||||
|
|
||||||
for(Consume cons : entity.block.consumes.all()){
|
for(Consume cons : entity.block.consumes.all()){
|
||||||
Log.info("check cons {1}: {0}", cons, cons.valid(entity));
|
|
||||||
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||||
cons.update(entity);
|
cons.update(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package power;
|
package power;
|
||||||
|
|
||||||
import io.anuke.arc.util.Log;
|
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.Time;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
@@ -8,8 +7,6 @@ import io.anuke.mindustry.type.Item;
|
|||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator;
|
import io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator;
|
||||||
import io.anuke.mindustry.world.consumers.Consume;
|
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeItemFilter;
|
|
||||||
import org.junit.jupiter.api.DynamicTest;
|
import org.junit.jupiter.api.DynamicTest;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestFactory;
|
import org.junit.jupiter.api.TestFactory;
|
||||||
@@ -92,7 +89,6 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
|
|
||||||
entity.liquids.add(liquid, availableLiquidAmount);
|
entity.liquids.add(liquid, availableLiquidAmount);
|
||||||
entity.cons.update();
|
entity.cons.update();
|
||||||
assertTrue(entity.cons.valid());
|
|
||||||
|
|
||||||
// Perform an update on the generator once - This should use up any resource up to the maximum liquid usage
|
// Perform an update on the generator once - This should use up any resource up to the maximum liquid usage
|
||||||
generator.update(tile);
|
generator.update(tile);
|
||||||
@@ -137,14 +133,6 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
|||||||
entity.items.add(item, amount);
|
entity.items.add(item, amount);
|
||||||
}
|
}
|
||||||
entity.cons.update();
|
entity.cons.update();
|
||||||
if(!entity.cons.valid()){
|
|
||||||
Log.info("not valid: ");
|
|
||||||
for(Consume cons : entity.block.consumes.all()){
|
|
||||||
if(cons instanceof ConsumeItemFilter)
|
|
||||||
Log.info("--" + cons.getClass().getSimpleName() + ": " + cons.valid(entity) + " " + ((ConsumeItemFilter)cons).filter.test(item) + " update: " + cons.isUpdate() + " optional: " + cons.isOptional());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assertTrue(entity.cons.valid());
|
|
||||||
|
|
||||||
// Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not.
|
// Perform an update on the generator once - This should use up one or zero items - dependent on if the item is accepted and available or not.
|
||||||
generator.update(tile);
|
generator.update(tile);
|
||||||
|
|||||||
Reference in New Issue
Block a user