Fixed order of operations causing Has Work to flicker on and off when pointed at a clear Filler in loop mode that currently had no blocks to clear. Also fixes Fillers running while done and not in loop mode.

This commit is contained in:
Andrew Dudney 2014-04-21 02:20:26 -06:00
parent 7e5e277a4c
commit 98b68810a3

View file

@ -84,12 +84,6 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
return; return;
} }
if (done) {
if (lastMode == Mode.Loop) {
done = false;
}
}
if (lastMode == Mode.Off) { if (lastMode == Mode.Off) {
return; return;
} }
@ -102,6 +96,16 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
return; return;
} }
boolean oldDone = done;
if (done) {
if (lastMode == Mode.Loop) {
done = false;
}else{
return;
}
}
if (currentPattern != null && currentTemplate == null) { if (currentPattern != null && currentTemplate == null) {
currentTemplate = currentPattern.getTemplateBuilder(box, getWorld()); currentTemplate = currentPattern.getTemplateBuilder(box, getWorld());
context = currentTemplate.getContext(); context = currentTemplate.getContext();
@ -113,9 +117,12 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
if (currentTemplate.isDone(this)) { if (currentTemplate.isDone(this)) {
done = true; done = true;
currentTemplate = null; currentTemplate = null;
sendNetworkUpdate();
} }
} }
if(oldDone != done){
sendNetworkUpdate();
}
} }
@Override @Override