Fixed #2449 / Fixed #2456 / Fixed #2458 / Fixed #2459 / Fixed #2466 / Fixed #2474

This commit is contained in:
Anuken
2020-09-01 11:34:03 -04:00
parent 6e3162aec2
commit 8e17571824
20 changed files with 129 additions and 83 deletions
@@ -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;
}