Implement custom block unlinking and pausing.
This commit is contained in:
parent
2c88dd4b03
commit
7f2686166e
@ -53,6 +53,7 @@ public class ProgramakerCustomBlockPart implements Part {
|
||||
private int height = 100;
|
||||
private String token = null;
|
||||
private Object[] lastValues;
|
||||
private boolean active = true;
|
||||
|
||||
|
||||
public ProgramakerCustomBlockPart(String id, PartGrid grid, Tuple2<Integer, Integer> center, ProgramakerCustomBlock block) {
|
||||
@ -337,6 +338,11 @@ public class ProgramakerCustomBlockPart implements Part {
|
||||
}
|
||||
|
||||
private void runBlockOperation() {
|
||||
if (!this.active) {
|
||||
Log.w(LogTag, "Trying to run inactive block function=" + this._block.getFunction_name());
|
||||
return;
|
||||
}
|
||||
|
||||
ProgramakerApi api = this._partGrid.getApi();
|
||||
List<String> arguments = new LinkedList<>();
|
||||
|
||||
@ -435,12 +441,12 @@ public class ProgramakerCustomBlockPart implements Part {
|
||||
|
||||
@Override
|
||||
public void resume() {
|
||||
// Intentionally left empty
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause() {
|
||||
// Intentionally left empty
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -542,6 +548,9 @@ public class ProgramakerCustomBlockPart implements Part {
|
||||
|
||||
@Override
|
||||
public void unlink() {
|
||||
// TODO: Implement
|
||||
this.active = false;
|
||||
for (InputConnector input : getInputConnectors()) {
|
||||
input.unlink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user