diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index cb30e98d51..707f1d586c 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -159,6 +159,9 @@ public class Vars{ Version.init(); content = new ContentLoader(); + if(!headless){ + content.setVerbose(); + } playerGroup = Entities.addGroup(Player.class).enableMapping(); tileGroup = Entities.addGroup(TileEntity.class, false); diff --git a/core/src/io/anuke/mindustry/core/ContentLoader.java b/core/src/io/anuke/mindustry/core/ContentLoader.java index 1d71ff81db..8ce56c10de 100644 --- a/core/src/io/anuke/mindustry/core/ContentLoader.java +++ b/core/src/io/anuke/mindustry/core/ContentLoader.java @@ -34,7 +34,7 @@ import static io.anuke.arc.Core.files; @SuppressWarnings("unchecked") public class ContentLoader{ private boolean loaded = false; - private boolean verbose = true; + private boolean verbose = false; private ObjectMap[] contentNameMap = new ObjectMap[ContentType.values().length]; private Array[] contentMap = new Array[ContentType.values().length]; @@ -57,6 +57,10 @@ public class ContentLoader{ new LegacyColorMapper(), }; + public void setVerbose(){ + verbose = true; + } + /**Creates all content types.*/ public void load(){ if(loaded){ diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java index 35a3d7ba51..8e51f1d1c0 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -106,7 +106,7 @@ public class PowerGraph{ public float chargeBatteries(float excess){ float capacity = getBatteryCapacity(); - if(Mathf.isEqual(capacity, 0f)){ return 0f; } + if(Mathf.isEqual(capacity, 0f)) return 0f; for(Tile battery : batteries){ Consumers consumes = battery.block().consumes; @@ -123,7 +123,7 @@ public class PowerGraph{ public void distributePower(float needed, float produced){ //distribute even if not needed. this is because some might be requiring power but not requesting it; it updates consumers - float coverage = Math.min(1, produced / (Mathf.isZero(needed) ? 1f : needed)); + float coverage = Mathf.isZero(needed) ? 1f : Math.min(1, produced / needed); for(Tile consumer : consumers){ Consumers consumes = consumer.block().consumes; if(consumes.has(ConsumePower.class)){ diff --git a/tests/src/test/java/power/DirectConsumerTests.java b/tests/src/test/java/power/DirectConsumerTests.java index 88233734ce..5298c27fde 100644 --- a/tests/src/test/java/power/DirectConsumerTests.java +++ b/tests/src/test/java/power/DirectConsumerTests.java @@ -16,13 +16,13 @@ public class DirectConsumerTests extends PowerTestFixture{ @Test void noPowerRequestedWithNoItems(){ - testUnitFactory(0, 0, 0.08f, 0.08f, 0f); + testUnitFactory(0, 0, 0.08f, 0.08f, 1f); } @Test void noPowerRequestedWithInsufficientItems(){ - testUnitFactory(30, 0, 0.08f, 0.08f, 0f); - testUnitFactory(0, 30, 0.08f, 0.08f, 0f); + testUnitFactory(30, 0, 0.08f, 0.08f, 1f); + testUnitFactory(0, 30, 0.08f, 0.08f, 1f); } @Test