コード例 #1
0
  private void stageReturnWood() {
    theFolk.isWorking = false;

    if (step == 1) {
      theFolk.statusText = "Delivering wood back to base";
      theFolk.gotoXYZ(theFolk.employedAt, null);
      step = 2;
    } else if (step == 2) {
      if (theFolk.gotoMethod == GotoMethod.WALK) {
        theFolk.updateLocationFromEntity();
      }

      int dist = theFolk.location.getDistanceTo(theFolk.employedAt);

      if (dist <= 1) {
        step = 3;
      } else {
        if (theFolk.destination == null && theFolk.theEntity != null) {
          // step=1;
        }
      }
    } else if (step == 3) {
      theFolk.stayPut = true;
      int count = getInventoryCount(theFolk, Item.getItemFromBlock(Blocks.log));
      millChests = inventoriesFindClosest(theFolk.employedAt, 6);
      inventoriesTransferFromFolk(
          theFolk.inventory, millChests, new ItemStack(Item.getItemFromBlock(Blocks.log)));
      pay = (float) count * 0.03f;
      SimukraftReloaded.states.credits -= pay;
      SimukraftReloaded.sendChat(
          theFolk.name + " has delivered " + count + " logs at the lumbermill");
      theStage = Stage.SCANFORTREE;
      step = 1;
    }
  }
コード例 #2
0
  private void stageGotoTree() {
    theFolk.isWorking = false;

    if (!onRoute) {
      theFolk.statusText = "Going to tree...";
      theFolk.gotoXYZ(foundWoodAt, null);
      startedGoing = System.currentTimeMillis();
      onRoute = true;
    } else {
      if (theFolk.gotoMethod == GotoMethod.WALK) {
        theFolk.updateLocationFromEntity();
      }

      double dist = theFolk.location.getDistanceTo(foundWoodAt);

      if (dist < 7) {
        theStage = Stage.CHOPPINGTREE;
        theFolk.stayPut = true;
        step = 1;
      } else {
        if (theFolk.destination == null && theFolk.theEntity != null) {
          // theFolk.gotoXYZ(foundWoodAt);
        }

        if (System.currentTimeMillis() - startedGoing > 25000) {
          // f*ck it, close enough
          theStage = Stage.CHOPPINGTREE;
          theFolk.stayPut = true;
          theFolk.destination = null;
          step = 1;
        }
      }
    }
  }
コード例 #3
0
  @Override
  public void onArrivedAtWork() {
    int dist = 0;
    dist = theFolk.location.getDistanceTo(theFolk.employedAt);

    if (dist <= 1) {
      theFolk.action = FolkAction.ATWORK;
      theFolk.stayPut = true;
      theFolk.statusText = "I'm a lumberjack, and I'm ok";
      theStage = Stage.ARRIVEDATMILL;
    } else {
      theFolk.gotoXYZ(theFolk.employedAt, null);
    }
  }
コード例 #4
0
  public JobLumberjack(FolkData folk) {
    theFolk = folk;

    if (theStage == null) {
      theStage = Stage.IDLE;
    }

    if (theFolk == null) {
      return; // is null when first employing, this is for next day(s)
    }

    if (theFolk.destination == null) {
      theFolk.gotoXYZ(theFolk.employedAt, null);
    }
  }