mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-09 07:17:36 +07:00
Set default minimum power to 50% and set four blocks to 100%
This commit is contained in:
@ -71,13 +71,13 @@ public class DefenseBlocks extends BlockList implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
mendProjector = new MendProjector("mend-projector"){{
|
mendProjector = new MendProjector("mend-projector"){{
|
||||||
consumes.powerDirect(0.2f);
|
consumes.powerDirect(0.2f, 1.0f);
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.item(Items.phasefabric).optional(true);
|
consumes.item(Items.phasefabric).optional(true);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
overdriveProjector = new OverdriveProjector("overdrive-projector"){{
|
overdriveProjector = new OverdriveProjector("overdrive-projector"){{
|
||||||
consumes.powerDirect(0.35f);
|
consumes.powerDirect(0.35f, 1.0f);
|
||||||
size = 2;
|
size = 2;
|
||||||
consumes.item(Items.phasefabric).optional(true);
|
consumes.item(Items.phasefabric).optional(true);
|
||||||
}};
|
}};
|
||||||
|
@ -35,7 +35,7 @@ public class DistributionBlocks extends BlockList implements ContentList{
|
|||||||
phaseConveyor = new ItemBridge("phase-conveyor"){{
|
phaseConveyor = new ItemBridge("phase-conveyor"){{
|
||||||
range = 12;
|
range = 12;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumes.powerDirect(0.03f);
|
consumes.powerDirect(0.03f, 1.0f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sorter = new Sorter("sorter");
|
sorter = new Sorter("sorter");
|
||||||
|
@ -67,7 +67,7 @@ public class LiquidBlocks extends BlockList implements ContentList{
|
|||||||
phaseConduit = new LiquidBridge("phase-conduit"){{
|
phaseConduit = new LiquidBridge("phase-conduit"){{
|
||||||
range = 12;
|
range = 12;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumes.powerDirect(0.03f);
|
consumes.powerDirect(0.03f, 1.0f);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.
|
* @param powerPerTick The amount of power which is required each tick for 100% efficiency.
|
||||||
* @return the created consumer object.
|
* @return the created consumer object.
|
||||||
*/
|
*/
|
||||||
public ConsumePower powerDirect(float powerPerTick){
|
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);
|
return map.containsKey(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasSubtypeOf(Class<? extends Consume> type){
|
||||||
|
for(Consume consume : all()){
|
||||||
|
if(type.isAssignableFrom(consume.getClass())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends Consume> T get(Class<T> type){
|
public <T extends Consume> T get(Class<T> type){
|
||||||
if(!map.containsKey(type)){
|
if(!map.containsKey(type)){
|
||||||
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");
|
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");
|
||||||
@ -129,6 +138,15 @@ public class Consumers{
|
|||||||
return (T) map.get(type);
|
return (T) map.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <T extends Consume> T getSubtypeOf(Class<T> 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<Consume> all(){
|
public Iterable<Consume> all(){
|
||||||
return map.values();
|
return map.values();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user