mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
DEATH AND DESTRUCTION
This commit is contained in:
parent
3babe7686b
commit
c324f2124b
135 changed files with 704 additions and 2080 deletions
|
|
@ -33,8 +33,8 @@ public class DirectConsumerTests extends PowerTestFixture{
|
|||
Tile ct = createFakeTile(0, 0, new GenericCrafter("fakefactory"){{
|
||||
hasPower = true;
|
||||
hasItems = true;
|
||||
consumes.power(requestedPower);
|
||||
consumes.items(new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30));
|
||||
consumePower(requestedPower);
|
||||
consumeItems(new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30));
|
||||
}});
|
||||
ct.block().init();
|
||||
ct.build.items.add(Items.silicon, siliconAmount);
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ public class PowerTestFixture{
|
|||
protected static Battery createFakeBattery(float capacity){
|
||||
return new Battery("fakebattery" + System.nanoTime()){{
|
||||
buildType = () -> new BatteryBuild();
|
||||
consumes.powerBuffered(capacity);
|
||||
consumePowerBuffered(capacity);
|
||||
}};
|
||||
}
|
||||
|
||||
protected static Block createFakeDirectConsumer(float powerPerTick){
|
||||
return new PowerBlock("fakedirectconsumer" + System.nanoTime()){{
|
||||
buildType = Building::create;
|
||||
consumes.power(powerPerTick);
|
||||
consumePower(powerPerTick);
|
||||
}};
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +81,8 @@ public class PowerTestFixture{
|
|||
Tile tile = new Tile(x, y);
|
||||
|
||||
//workaround since init() is not called for custom blocks
|
||||
if(block.consumes.all == null || block.consumes.all.length == 0){
|
||||
block.consumes.init();
|
||||
if(block.consumers.length == 0){
|
||||
block.init();
|
||||
}
|
||||
|
||||
// Using the Tile(int, int, byte, byte) constructor would require us to register any fake block or tile we create
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import mindustry.core.*;
|
|||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.power.PowerGenerator.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.consumers.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
|
@ -133,9 +132,8 @@ public class PowerTests extends PowerTestFixture{
|
|||
powerGraph.update();
|
||||
|
||||
assertEquals(0.0f, consumerTile.build.power.status, Mathf.FLOAT_ROUNDING_ERROR);
|
||||
if(consumerTile.block().consumes.hasPower()){
|
||||
ConsumePower consumePower = consumerTile.block().consumes.getPower();
|
||||
assertFalse(consumePower.valid(consumerTile.build));
|
||||
if(consumerTile.block().consPower != null){
|
||||
assertFalse(consumerTile.block().consPower.valid(consumerTile.build));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue