diff --git a/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java index be7c016886..fb7987ca8b 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DefenseBlocks.java @@ -71,13 +71,13 @@ public class DefenseBlocks extends BlockList implements ContentList{ }}; mendProjector = new MendProjector("mend-projector"){{ - consumes.powerDirect(0.2f); + consumes.powerDirect(0.2f, 1.0f); size = 2; consumes.item(Items.phasefabric).optional(true); }}; overdriveProjector = new OverdriveProjector("overdrive-projector"){{ - consumes.powerDirect(0.35f); + consumes.powerDirect(0.35f, 1.0f); size = 2; consumes.item(Items.phasefabric).optional(true); }}; diff --git a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java index 4739347791..d0d1621cc5 100644 --- a/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/DistributionBlocks.java @@ -35,7 +35,7 @@ public class DistributionBlocks extends BlockList implements ContentList{ phaseConveyor = new ItemBridge("phase-conveyor"){{ range = 12; hasPower = true; - consumes.powerDirect(0.03f); + consumes.powerDirect(0.03f, 1.0f); }}; sorter = new Sorter("sorter"); diff --git a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java index 8be6774a72..1f60004c20 100644 --- a/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/LiquidBlocks.java @@ -67,7 +67,7 @@ public class LiquidBlocks extends BlockList implements ContentList{ phaseConduit = new LiquidBridge("phase-conduit"){{ range = 12; hasPower = true; - consumes.powerDirect(0.03f); + consumes.powerDirect(0.03f, 1.0f); }}; } } diff --git a/core/src/io/anuke/mindustry/world/consumers/Consumers.java b/core/src/io/anuke/mindustry/world/consumers/Consumers.java index 8b0f3c7861..a3d5027188 100644 --- a/core/src/io/anuke/mindustry/world/consumers/Consumers.java +++ b/core/src/io/anuke/mindustry/world/consumers/Consumers.java @@ -37,12 +37,12 @@ public class Consumers{ } /** - * Creates a consumer which directly uses power without buffering it. The module will work while at least 60% of power is supplied. + * Creates a consumer which directly uses power without buffering it. The module will work while at least 50% of power is supplied. * @param powerPerTick The amount of power which is required each tick for 100% efficiency. * @return the created consumer object. */ public ConsumePower powerDirect(float powerPerTick){ - return powerDirect(powerPerTick, 0.6f); + return powerDirect(powerPerTick, 0.5f); } /** @@ -122,6 +122,15 @@ public class Consumers{ return map.containsKey(type); } + public boolean hasSubtypeOf(Class type){ + for(Consume consume : all()){ + if(type.isAssignableFrom(consume.getClass())){ + return true; + } + } + return false; + } + public T get(Class type){ if(!map.containsKey(type)){ throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!"); @@ -129,6 +138,15 @@ public class Consumers{ return (T) map.get(type); } + public T getSubtypeOf(Class type){ + for(Consume consume : all()){ + if(type.isAssignableFrom(consume.getClass())){ + return (T)consume; + } + } + throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "' or any of its subtypes!"); + } + public Iterable all(){ return map.values(); }