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; } }
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; } } } }