private boolean allPositionsFlattened() {
   for (RelativePoint relativePosition : requester.getBuildingType().getProtectedTiles()) {
     if (needsToBeWorkedOn(relativePosition.calculatePoint(requester.getPos()))) {
       return false;
     }
   }
   return true;
 }
  private ShortPoint2D getDiggablePosition() {
    RelativePoint[] blockedTiles = requester.getBuildingType().getProtectedTiles();
    ShortPoint2D buildingPos = requester.getPos();
    int offset = MatchConstants.random().nextInt(blockedTiles.length);

    for (int i = 0; i < blockedTiles.length; i++) {
      ShortPoint2D pos =
          blockedTiles[(i + offset) % blockedTiles.length].calculatePoint(buildingPos);
      if (!super.getGrid().isMarked(pos) && needsToBeWorkedOn(pos)) {
        return pos;
      }
    }
    return null;
  }
  @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;
    }
  }
 private void executeDigg() {
   ShortPoint2D pos = movable.getPos();
   super.getGrid().changeHeightTowards(pos.x, pos.y, requester.getAverageHeight());
 }
 private void abortJob() {
   requester.diggerRequestFailed();
 }
 private boolean needsToChangeHeight(ShortPoint2D pos) {
   return super.getGrid().getHeightAt(pos) != requester.getAverageHeight();
 }