mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-03 13:30:25 +07:00
Removed power bars from producers
This commit is contained in:
parent
f8cf185db9
commit
e5dabc63c2
@ -49,14 +49,6 @@ public class PowerGenerator extends PowerDistributor{
|
||||
return new GeneratorEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
if(hasPower){
|
||||
bars.add(new BlockBar(BarType.power, true, tile -> tile.<GeneratorEntity>entity().productionEfficiency));
|
||||
}
|
||||
}
|
||||
|
||||
public static class GeneratorEntity extends TileEntity{
|
||||
public float generateTime;
|
||||
/** The efficiency of the producer. Currently, an efficiency of 0.5 means 100% */
|
||||
|
94
tests/src/test/java/power/PowerBalancingTests.java
Normal file
94
tests/src/test/java/power/PowerBalancingTests.java
Normal file
@ -0,0 +1,94 @@
|
||||
package power;
|
||||
|
||||
import com.badlogic.gdx.math.MathUtils;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.content.blocks.PowerBlocks;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.power.BurnerGenerator;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/** Sets expectations to specific production blocks using specific inputs. */
|
||||
|
||||
public class PowerBalancingTests extends PowerTestFixture{
|
||||
// Last updated to values of: v63
|
||||
|
||||
/**
|
||||
* Tests the produced power of a power block with a full stack of items or liquids.
|
||||
* @apiNote Tests only a single tick with a fixed delta and interpolates that to match one second.
|
||||
* @param powerBlock The block to be tested.
|
||||
* @param inputItem The item to be supplied (may be null).
|
||||
* @param inputLiquid The liquid to be supplied (may be null).
|
||||
* @param expectedPowerPerSecond The amount of power which should be produced per second.
|
||||
*/
|
||||
public void testPowerGenerator(Block powerBlock, Item inputItem, Liquid inputLiquid, float expectedPowerPerSecond){
|
||||
Tile fakeTile = createFakeTile(0, 0, powerBlock);
|
||||
if(inputItem != null){
|
||||
fakeTile.entity.items.add(inputItem, powerBlock.itemCapacity);
|
||||
}
|
||||
if(inputLiquid != null){
|
||||
fakeTile.entity.liquids.add(inputLiquid, powerBlock.liquidCapacity);
|
||||
}
|
||||
fakeTile.entity.cons.update(fakeTile.entity);
|
||||
powerBlock.update(fakeTile);
|
||||
|
||||
assertEquals(expectedPowerPerSecond, fakeTile.entity.power.graph.getPowerProduced() * 60f / FakeThreadHandler.fakeDelta, MathUtils.FLOAT_ROUNDING_ERROR * 10.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCombustionWithCoal(){
|
||||
testPowerGenerator(PowerBlocks.combustionGenerator, Items.coal, null, 2.7f); // 100% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCombustionWithOil(){
|
||||
testPowerGenerator(PowerBlocks.combustionGenerator, null, Liquids.oil, 2.7f * 1.2f); // 120% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCombustionWithBlastCompound(){
|
||||
testPowerGenerator(PowerBlocks.combustionGenerator, Items.blastCompound, null, 2.7f * 0.4f); // 40% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTurbineWithCoal(){
|
||||
testPowerGenerator(PowerBlocks.turbineGenerator, Items.coal, Liquids.water, 8.4f); // 100% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTurbineWithBiomatter(){
|
||||
testPowerGenerator(PowerBlocks.turbineGenerator, Items.biomatter, Liquids.water, 8.4f * 0.8f); // 100% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThermalWithLava(){
|
||||
testPowerGenerator(PowerBlocks.thermalGenerator, null, Liquids.lava, 36f); // 100% flammability
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSolarPanel(){
|
||||
testPowerGenerator(PowerBlocks.solarPanel, null, null, 0.27f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeSolarPanel(){
|
||||
testPowerGenerator(PowerBlocks.largeSolarPanel, null, null, 3.3f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThoriumReactor(){
|
||||
testPowerGenerator(PowerBlocks.thoriumReactor, Items.thorium, Liquids.cryofluid, 33.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRadioIsotopeGenerator(){
|
||||
testPowerGenerator(PowerBlocks.rtgGenerator, Items.thorium, null, 9.0f);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user