This commit is contained in:
Anuken
2021-10-16 23:06:07 -04:00
parent d5a2f13442
commit b271f5b630

View File

@@ -158,10 +158,26 @@ public class PayloadDeconstructor extends PayloadBlock{
//finish deconstruction, prepare for next payload. //finish deconstruction, prepare for next payload.
if(progress >= 1f){ if(progress >= 1f){
Fx.breakBlock.at(x, y, deconstructing.size() / tilesize); canProgress = true;
//check for rounding errors
for(int i = 0; i < reqs.length; i++){
if(Mathf.equal(accum[i], 1f, 0.0001f)){
if(items.total() < itemCapacity){
items.add(reqs[i].item, 1);
accum[i] = 0f;
}else{
canProgress = false;
break;
}
}
}
deconstructing = null; if(canProgress){
accum = null; Fx.breakBlock.at(x, y, deconstructing.size() / tilesize);
deconstructing = null;
accum = null;
}
} }
}else if(moveInPayload(false) && payload != null){ }else if(moveInPayload(false) && payload != null){
accum = new float[payload.requirements().length]; accum = new float[payload.requirements().length];