public override CharacterTask.Task getCurrentTask(CharacterTaskTracker taskTracker) { if (!hasPlacedBlock && buildSite.numBlocksLeftToBuild() > 0 && buildSite.containsBlockToBuild(targetBlock)) { hasPlacedBlock = true; return(new CharacterTask.BuildBlock(targetBlock, typeToPlace)); } else { return(new CharacterTask.SwitchJob(toReturnTo)); } }
public override CharacterTask.Task getCurrentTask(CharacterTaskTracker taskTracker) { if (character.isCarryingItem() && character.getLoad() == ResourceBlock.ResourceType.standardBlock) { if (buildSite.numBlocksLeftToBuild() > 0) { List<BlockLoc> nextBlocksToBuild = buildSite.getAllBlocksToBuild().ToList(); foreach (BlockLoc claimed in taskTracker.blocksCurrentlyClaimed()) { if (nextBlocksToBuild.Contains(claimed)) { nextBlocksToBuild.Remove(claimed); } } BlockLoc blockFoundToBuild; PathHandlerPreferringLowerBlocks pathhandler = new PathHandlerPreferringLowerBlocks(); Path path = pathhandler.getPathToMakeTheseBlocksAvaiable( buildSite.getProfile(), new BlockLoc(character.getFootLocation()), buildSite.getProfile(), nextBlocksToBuild, 2, out blockFoundToBuild); PlaceBlockJob placeBlockJob = new PlaceBlockJob(buildSite, character, blockFoundToBuild, new BuildKickoffJob(buildSite, character, workingProfile), workingProfile, buildSite.getTypeAt(blockFoundToBuild)); TravelAlongPath walkJob = new TravelAlongPath(path, getWaitJobWithReturn(30, placeBlockJob)); ; return new CharacterTask.SwitchJob(walkJob); } else { return new CharacterTask.SwitchJob(new UnemployedJob()); } } else { if (buildSite.numBlocksLeftToBuild() > 0) { List<BlockLoc> nextBlocksToBuild = buildSite.getAllBlocksToBuild().ToList(); foreach (BlockLoc claimed in taskTracker.blocksCurrentlyClaimed()) { if (nextBlocksToBuild.Contains(claimed)) { nextBlocksToBuild.Remove(claimed); } } BlockLoc blockFoundToBuild; PathHandlerPreferringLowerBlocks pathhandler = new PathHandlerPreferringLowerBlocks(); Path path = pathhandler.getPathToMakeTheseBlocksAvaiable( buildSite.getProfile(), new BlockLoc(character.getFootLocation()), buildSite.getProfile(), nextBlocksToBuild, 2, out blockFoundToBuild); //PlaceBlockJob placeBlockJob = new PlaceBlockJob(buildSite, character, location, workingProfile); BuildKickoffJob build = new BuildKickoffJob(buildSite, character, workingProfile); FetchResourceJob fetch = new FetchResourceJob(workingProfile, ResourceBlock.ResourceType.standardBlock, character, build); return new CharacterTask.SwitchJob(fetch); } else { return new CharacterTask.SwitchJob(new UnemployedJob()); } } }