This commit is contained in:
@@ -56,6 +56,8 @@ public class Block extends UnlockableContent{
|
||||
public final BlockBars bars = new BlockBars();
|
||||
public final Consumers consumes = new Consumers();
|
||||
|
||||
/** whether to display flow rate */
|
||||
public boolean displayFlow = true;
|
||||
/** whether this block is visible in the editor */
|
||||
public boolean inEditor = true;
|
||||
/** the last configuration value applied to this block. */
|
||||
|
||||
@@ -162,7 +162,11 @@ public class ItemTurret extends Turret{
|
||||
Item item = Vars.content.item(revision < 2 ? read.ub() : read.s());
|
||||
short a = read.s();
|
||||
totalAmmo += a;
|
||||
ammo.add(new ItemEntry(item, a));
|
||||
|
||||
//only add ammo if this is a valid ammo type
|
||||
if(ammoTypes.containsKey(item)){
|
||||
ammo.add(new ItemEntry(item, a));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,13 @@ public class ItemSource extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(outputItem == null) return;
|
||||
|
||||
Draw.color(outputItem.color);
|
||||
Draw.rect("center", x, y);
|
||||
Draw.color();
|
||||
if(outputItem == null){
|
||||
Draw.rect("cross", x, y);
|
||||
}else{
|
||||
Draw.color(outputItem.color);
|
||||
Draw.rect("center", x, y);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,7 @@ public class LiquidSource extends Block{
|
||||
outputsLiquid = true;
|
||||
saveConfig = true;
|
||||
noUpdateDisabled = true;
|
||||
displayFlow = false;
|
||||
|
||||
config(Liquid.class, (LiquidSourceBuild tile, Liquid l) -> tile.source = l);
|
||||
configClear((LiquidSourceBuild tile) -> tile.source = null);
|
||||
@@ -59,7 +60,9 @@ public class LiquidSource extends Block{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(source != null){
|
||||
if(source == null){
|
||||
Draw.rect("cross", x, y);
|
||||
}else{
|
||||
Draw.color(source.color);
|
||||
Draw.rect("center", x, y);
|
||||
Draw.color();
|
||||
|
||||
@@ -20,6 +20,7 @@ public class LiquidModule extends BlockModule{
|
||||
private Liquid current = content.liquid(0);
|
||||
private float smoothLiquid;
|
||||
|
||||
private boolean hadFlow;
|
||||
private @Nullable WindowedMean flow;
|
||||
private float lastAdded, currentFlowRate;
|
||||
|
||||
@@ -29,6 +30,8 @@ public class LiquidModule extends BlockModule{
|
||||
if(flowTimer.get(1, pollScl)){
|
||||
|
||||
if(flow == null) flow = new WindowedMean(windowSize);
|
||||
if(lastAdded > 0.0001f) hadFlow = true;
|
||||
|
||||
flow.add(lastAdded);
|
||||
lastAdded = 0;
|
||||
if(currentFlowRate < 0 || flowTimer.get(updateInterval)){
|
||||
@@ -38,16 +41,19 @@ public class LiquidModule extends BlockModule{
|
||||
}else{
|
||||
currentFlowRate = -1f;
|
||||
flow = null;
|
||||
hadFlow = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** @return current liquid's flow rate in u/s; any value < 0 means 'not ready'. */
|
||||
public float getFlowRate(){
|
||||
//low throughput means no display
|
||||
if(currentFlowRate < 0.0001) return -1f;
|
||||
return currentFlowRate * 60;
|
||||
}
|
||||
|
||||
public boolean hadFlow(){
|
||||
return hadFlow;
|
||||
}
|
||||
|
||||
public float smoothAmount(){
|
||||
return smoothLiquid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user