@Override protected void action() { switch (state) { case JOBLESS: break; case INIT_JOB: goToDiggablePosition(); break; case PLAYING_ACTION: executeDigg(); if (!requester.isDiggerRequestActive()) { super.getGrid().setMarked(movable.getPos(), false); reportJobless(); break; } case GOING_TO_POS: if (needsToBeWorkedOn(movable.getPos())) { super.playAction(EMovableAction.ACTION1, 1f); this.state = EDiggerState.PLAYING_ACTION; } else { goToDiggablePosition(); } break; case DEAD_OBJECT: break; } }
@Override protected boolean checkPathStepPreconditions(ShortPoint2D pathTarget, int step) { if (requester == null || requester.isDiggerRequestActive()) { return true; } else { if (state != EDiggerState.JOBLESS) { reportJobless(); } if (pathTarget != null) { super.getGrid().setMarked(pathTarget, false); } return false; } }