Package me.daddychurchill.CityWorld.Plugins

Examples of me.daddychurchill.CityWorld.Plugins.ShapeProvider


    // let the user add their stuff first, then plug any remaining holes with our stuff
    //mapsSchematics.populate(generator, platmap);
   
    // random fluff
    Odds odds = platmap.getOddsGenerator();
    ShapeProvider shapeProvider = generator.shapeProvider;
   
    // where it all begins
    int originX = platmap.originX;
    int originZ = platmap.originZ;
    HeightInfo heights;
   
    // is this natural or buildable?
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
        if (current == null) {
         
          // what is the world location of the lot?
          int blockX = (originX + x) * SupportChunk.chunksBlockWidth;
          int blockZ = (originZ + z) * SupportChunk.chunksBlockWidth;
         
          // get the height info for this chunk
          heights = HeightInfo.getHeightsFaster(generator, blockX, blockZ);
          if (!heights.isBuildable()) {
           
            // our inner chunks?
            if (x > 0 && x < PlatMap.Width - 1 && z > 0 && z < PlatMap.Width - 1) {
             
              // floating building?
              if (generator.settings.includeHouses) {
                if (shapeProvider.isIsolatedConstructAt(originX + x, originZ + z, oddsOfIsolatedConstructs))
                  current = new FloatingHouseLot(platmap, originX + x, originZ + z,
                      shapeProvider.getConstuctMin() + odds.getRandomInt(shapeProvider.getConstuctRange()));
              }
            }
           
            // did current get defined?
            if (current != null)
View Full Code Here


  @Override
  public void populateMap(WorldGenerator generator, PlatMap platmap) {
   
    // now add our stuff
    Odds platmapOdds = platmap.getOddsGenerator();
    ShapeProvider shapeProvider = generator.shapeProvider;
    boolean housePlaced = false;
    int lastX = 0, lastZ = 0;
   
    // where do we begin?
    int originX = platmap.originX;
    int originZ = platmap.originZ;
   
    // clean up the platmap of singletons and odd road structures
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
       
        // something here?
        if (current == null) {
         
          // but there aren't neighbors
          if (!platmap.isEmptyLot(x - 1, z) && !platmap.isEmptyLot(x + 1, z) &&
            !platmap.isEmptyLot(x, z - 1) && !platmap.isEmptyLot(x, z + 1))
            platmap.recycleLot(x, z);
        }
       
        // look for singleton nature and roundabouts
        else {
         
          // if a single natural thing is here but surrounded by four "things"
          if (current.style == LotStyle.NATURE &&
            platmap.isEmptyLot(x - 1, z) && platmap.isEmptyLot(x + 1, z) &&
            platmap.isEmptyLot(x, z - 1) && platmap.isEmptyLot(x, z + 1))
            platmap.emptyLot(x, z);
         
          // get rid of roundabouts
          else if (current.style == LotStyle.ROUNDABOUT) {
            platmap.paveLot(x, z, false);
            platmap.emptyLot(x - 1, z - 1);
            platmap.emptyLot(x - 1, z + 1);
            platmap.emptyLot(x + 1, z - 1);
            platmap.emptyLot(x + 1, z + 1);
          }
        }
      }
    }
   
    // let the user add their stuff first
    getSchematics(generator).populate(generator, platmap);
   
    // backfill with farms and a single house
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
        if (current == null) {
         
          //TODO Barns and Wells
         
          // farm house here?
          if (!housePlaced && platmapOdds.playOdds(oddsOfFarmHouse) && generator.settings.includeHouses) {
            housePlaced = platmap.setLot(x, z, getHouseLot(generator, platmap, platmapOdds, originX + lastX, originZ + lastZ));
         
          // place the farm
          } else {
           
            // place the farm
            current = getFarmLot(generator, platmap, platmapOdds, originX + x, originZ + z);
           
            // see if the previous chunk is the same type
            PlatLot previous = null;
            if (x > 0 && current.isConnectable(platmap.getLot(x - 1, z))) {
              previous = platmap.getLot(x - 1, z);
            } else if (z > 0 && current.isConnectable(platmap.getLot(x, z - 1))) {
              previous = platmap.getLot(x, z - 1);
            }
           
            // if there was a similar previous one then copy it... maybe
            if (previous != null && !shapeProvider.isIsolatedLotAt(originX + x, originZ + z, oddsOfIsolatedLots)) {
              current.makeConnected(previous);
            }

            // remember what we did
            platmap.setLot(x, z, current);
View Full Code Here

    //TODO, This doesn't handle schematics quite right yet
    // let the user add their stuff first, then plug any remaining holes with our stuff
    //mapsSchematics.populate(generator, platmap);
   
    // random fluff
    ShapeProvider shapeProvider = generator.shapeProvider;
   
    // where it all begins
    int originX = platmap.originX;
    int originZ = platmap.originZ;
    HeightInfo heights;
    boolean towerPlaced = false;
   
    // is this natural or buildable?
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
        if (current == null) {
       
          // what is the world location of the lot?
          int blockX = (originX + x) * SupportChunk.chunksBlockWidth;
          int blockZ = (originZ + z) * SupportChunk.chunksBlockWidth;
         
          // get the height info for this chunk
          heights = HeightInfo.getHeightsFaster(generator, blockX, blockZ);
          if (!heights.anyEmpties && heights.averageHeight < generator.seaLevel) {
         
            // tower?
            if (!towerPlaced && shapeProvider.isIsolatedConstructAt(originX + x, originZ + z, oddsOfIsolatedConstructs)) {
              current = new AstralBlackTowerLot(platmap, originX + x, originZ + z);
              towerPlaced = true;
            }
           
            // still empty? well then lets put some blocks then
View Full Code Here

    // let the user add their stuff first, then plug any remaining holes with our stuff
    getSchematics(generator).populate(generator, platmap);
   
    // random fluff!
    Odds platmapOdds = platmap.getOddsGenerator();
    ShapeProvider shapeProvider = generator.shapeProvider;
   
    // backfill with buildings and parks
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
        if (current == null) {
         
          //TODO I need to come up with a more elegant way of doing this!
          if (generator.settings.includeBuildings) {

            // what to build?
            boolean buildPark = platmapOdds.playOdds(oddsOfParks);
            if (buildPark)
              current = getPark(generator, platmap, platmapOdds, platmap.originX + x, platmap.originZ + z);
            else
              current = getBackfillLot(generator, platmap, platmapOdds, platmap.originX + x, platmap.originZ + z);
           
            // see if the previous chunk is the same type
            PlatLot previous = null;
            if (x > 0 && current.isConnectable(platmap.getLot(x - 1, z))) {
              previous = platmap.getLot(x - 1, z);
            } else if (z > 0 && current.isConnectable(platmap.getLot(x, z - 1))) {
              previous = platmap.getLot(x, z - 1);
            }
           
            // if there was a similar previous one then copy it... maybe
            if (previous != null && !shapeProvider.isIsolatedLotAt(platmap.originX + x, platmap.originZ + z, oddsOfIsolatedLots)) {
              current.makeConnected(previous);
             
            // 2 by 2 at a minimum if at all possible
            } else if (!buildPark && x < PlatMap.Width - 1 && z < PlatMap.Width - 1) {
             
View Full Code Here

    //TODO, This doesn't handle schematics quite right yet
    // let the user add their stuff first, then plug any remaining holes with our stuff
    //mapsSchematics.populate(generator, platmap);
   
    // random fluff
    ShapeProvider shapeProvider = generator.shapeProvider;
   
    // where it all begins
    int originX = platmap.originX;
    int originZ = platmap.originZ;
    HeightInfo heights;
    boolean towerPlaced = false;
   
    // is this natural or buildable?
    for (int x = 0; x < PlatMap.Width; x++) {
      for (int z = 0; z < PlatMap.Width; z++) {
        PlatLot current = platmap.getLot(x, z);
        if (current == null) {
       
          // what is the world location of the lot?
          int blockX = (originX + x) * SupportChunk.chunksBlockWidth;
          int blockZ = (originZ + z) * SupportChunk.chunksBlockWidth;
         
          // get the height info for this chunk
          heights = HeightInfo.getHeightsFaster(generator, blockX, blockZ);
          if (!heights.anyEmpties && heights.averageHeight < generator.seaLevel) {
         
            // tower?
            if (!towerPlaced && shapeProvider.isIsolatedConstructAt(originX + x, originZ + z, oddsOfIsolatedConstructs)) {
              current = new AstralWhiteTowerLot(platmap, originX + x, originZ + z);
              towerPlaced = true;
            }
           
            // still empty? well then lets put some blocks then
View Full Code Here

TOP

Related Classes of me.daddychurchill.CityWorld.Plugins.ShapeProvider

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.