Package colonies.src

Examples of colonies.src.Point


    if(citizen.employer == null) return false;      // needs an employer chest to get stuff from
    if(citizen.inventory.isFull()) return false;    // need room to put stuff

    // if nearby employer chest, check wants every time
    if(destination == null){
      destination = new Point(citizen.employer);
    }
    if(destination.getDistance(citizen) < 3){
      citizen.stopNavigating();
      return wantsSomething();
    } // else too far away (would need to path there)
View Full Code Here


  @Override
  public boolean continueExecuting()
  {
    if(destination == null){ // suitable destination not yet established
      // Utility.chatMessage("looking for a spot to plant sapling");
      Point candidate = new Point();
      int blockID = 0;
      for(int i = 0; i < 10; ++i){
        // choose a spot 5-10m away from citizen in a random direction
        candidate.polarTranslation(Utility.rng.nextRadian(), Math.PI/2, 5 + Utility.rng.nextInt(5));
        candidate.plus(citizen.posX, citizen.posY, citizen.posZ);
       
        // move destination away from logging camp if necessary
        if(candidate.getDistance(citizen.homeTown.xCoord, citizen.homeTown.yCoord, citizen.homeTown.zCoord) < 10){
          double theta = Math.atan2(candidate.y - citizen.homeTown.yCoord, candidate.x - citizen.homeTown.xCoord);
          candidate.polarTranslation(theta, Math.PI/2, 10);
        }     
        Utility.terrainAdjustment(citizen.worldObj, candidate);
       
        // if we found dirt that can see sky, we're good; set navigator and return true
        if(citizen.worldObj.canBlockSeeTheSky((int)candidate.x, (int)candidate.y, (int)candidate.z)){
View Full Code Here

       if(!TileEntityTownHall.playerTown.homesList.isEmpty()){
         for(TileEntityColoniesChest c: TileEntityTownHall.playerTown.homesList){
           choices.add(c);
         }
       }
       destination = new Point(choices.get(Utility.rng.nextInt(choices.size())));
      
       // if this destination is too close, scrap this attempt
       if(destination.getDistance(citizen) < 4f){
         destination = null;
         return;
View Full Code Here

TOP

Related Classes of colonies.src.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.