mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-26 15:27:19 +07:00
Implement outbound queue limits.
Fixes infinite status bar issue. Lowered timer to 5 to make it drain more quickly - makes sense given the production is instant.
This commit is contained in:
parent
2796ab9801
commit
9897e200a8
@ -37,7 +37,7 @@ public class Crafter extends Block{
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
|
||||
if(tile.entity.timer.get(timerDump, 15) && tile.entity.hasItem(result)){
|
||||
if(tile.entity.timer.get(timerDump, 5) && tile.entity.hasItem(result)){
|
||||
tryDump(tile, -1, result);
|
||||
}
|
||||
|
||||
@ -46,7 +46,13 @@ public class Crafter extends Block{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// crafter full - it has to be emptied before it can craft again.
|
||||
if(tile.entity.getItem(result) >= capacity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(Item item : requirements){
|
||||
tile.entity.removeItem(item, 1);
|
||||
}
|
||||
@ -67,8 +73,10 @@ public class Crafter extends Block{
|
||||
|
||||
@Override
|
||||
public void drawSelect(Tile tile){
|
||||
float fract = (float)tile.entity.totalItems()/((requirements.length-1) *capacity);
|
||||
|
||||
// each req item has its input buffer + 1 buffer for output.
|
||||
int totalCapacity = (requirements.length + 1) * capacity;
|
||||
float fract = ((float)tile.entity.totalItems())/totalCapacity;
|
||||
|
||||
Vars.renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 6, fract);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user