Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Made by @QuantumWarpCode.
- # Feel free to modify and use this filter however you wish.
- # If you do, please give credit to Elopus, Elopus001, or @QuantumWarpCode.
- # Version : 1
- # Import Libraries
- # PyMC
- from pymclevel import alphaMaterials
- # Standard Python
- import random
- from math import ceil, floor
- # Define Global Variables and MCEdit Related Values
- displayName = "Procedural City"
- inputs = [
- (
- ("Tutorial", "title"),
- ("X - Width", "label"),
- ("C is the number of chunks wide.", "label"),
- ("X = 16C + 2", "label"),
- ("Y - Height", "label"),
- ("F is the number of floors high including basements.", "label"),
- ("Y = 4F + 4", "label"),
- ("Z - Length", "label"),
- ("C is the number of chunks long.", "label"),
- ("Z = 16C + 2", "label"),
- ("Example selection box sizes:", "label"),
- ("34W x 34L x 52H", "label"),
- ("130W x 130L x 128H", "label")
- ),
- (
- ("Options", "title"),
- ("Basements", 3),
- ("Minimum Height", 1),
- ("Create Derelict Structures", True),
- ("Create Empty Lots", True),
- ("Experimental", "label"),
- ("Height Randomization currently does nothing.", "label"),
- ("Enable Height Randomization", False),
- ),
- (
- ("Probabilities", "title"),
- ("Higher values denote lower probability.", "label"),
- ("It is based off of 1 divided by this value.", "label"),
- ("Values below 1 will be set to the default", "label"),
- ("Derelict Probability", 10),
- ("Derelict Remove Block increases the probability of removing glass and plants but decreases probability of removing other blocks when its value is higher.", "label"),
- ("Derelict Remove Block Probability", 10),
- ("Lot Probability", 10),
- ("Hedge Probability", 3),
- ("Flower Probability", 2),
- ("Flower Placement Probability", 5)
- ),
- (
- ("Blocks", "title"),
- ("Ground Block", alphaMaterials[1, 0]),
- ("Grass Block", alphaMaterials[2, 0]),
- ("Sidewalk Block", alphaMaterials[43, 0]),
- ("Dirt Block", alphaMaterials[3, 1]),
- ("Torch Block (Up)", alphaMaterials[50, 5]),
- ("Building Wall Block", alphaMaterials[98, 0]),
- ("Building Floor Block", alphaMaterials[5, 5]),
- ("Glass Block", alphaMaterials[102, 0]),
- ("Hedge Block", alphaMaterials[18, 7]),
- ("Lighting Block", alphaMaterials[89, 0])
- )
- ]
- xMod = 0
- xLen = 0
- xTrueLen = 0
- yMod = 0
- yLen = 0
- yTrueLen = 0
- zMod = 0
- zLen = 0
- zTrueLen = 0
- chunkHeightMap = []
- chunkPopulationMap = []
- groundHeight = 0
- minHeight = 0
- maxHeight = 0
- maxBasements = 0
- derelictProbability = 0
- derelictRProbability = 0
- lotProbability = 0
- hedgeProbability = 0
- flowerProbability = 0
- flowerPlaceProbability = 0
- groundBlock = alphaMaterials[0, 0]
- dirtBlock = alphaMaterials[0, 0]
- grassBlock = alphaMaterials[0, 0]
- sideWalkBlock = alphaMaterials[0, 0]
- buildingWallBlock = alphaMaterials[0, 0]
- buildingFloorBlock = alphaMaterials[0, 0]
- lightingBlock = alphaMaterials[0, 0]
- torchBlock = alphaMaterials[0, 0]
- hedgeBlock = alphaMaterials[0, 0]
- glassBlock = alphaMaterials[0, 0]
- createDerelicts = False
- createEmptyLots = False
- enableHeightMap = False
- # Utility Functions
- # Sets a block with modifiers automatically applied
- def setBlock(x, y, z, block, blockdata, level, derelict = False):
- global xMod
- global yMod
- global zMod
- if derelict == False:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, block)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, blockdata)
- elif derelict == True:
- global glassBlock
- global hedgeBlock
- global torchBlock
- global derelictRProbability
- probability = random.randint(1, derelictRProbability)
- if (block == glassBlock.ID or block == hedgeBlock.ID or block == torchBlock.ID) and probability == 1:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, block)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, blockdata)
- elif block != glassBlock.ID and block != hedgeBlock.ID and block != torchBlock.ID:
- if block != 0 and random.randint(1, derelictRProbability) != 1:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, block)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, blockdata)
- else:
- if random.randint(1, derelictRProbability) != 1:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, 0)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, 0)
- else:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, 30)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, 0)
- else:
- if random.randint(1, derelictRProbability) != 1:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, 0)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, 0)
- else:
- level.setBlockAt(x + xMod, y + yMod, z + zMod, 30)
- level.setBlockDataAt(x + xMod, y + yMod, z + zMod, 0)
- # Generates a rectangle
- def genRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- setBlock(x, y, z, block, blockdata, level, derelict)
- # Generates a rectangle perimeter
- def genHollowRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if x == xStart or x == xEnd - 1 or z == zStart or z == zEnd - 1:
- setBlock(x, y, z, block, blockdata, level, derelict)
- # Generates a rectangle with a gooey center
- # Block is the outside and block2 is the center
- def genFilledRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, block2, block2data, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if x == xStart or x == xEnd - 1 or z == zStart or z == zEnd - 1:
- setBlock(x, y, z, block, blockdata, level, derelict)
- else:
- setBlock(x, y, z, block2, block2data, level, derelict)
- # Generates a rectangle with different corners
- # Block is the insides and block2 is the corners
- def genCornerRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, block2, block2data, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if (x == xStart or x == xEnd - 1) and (z == zStart or z == zEnd - 1):
- setBlock(x, y, z, block2, block2data, level, derelict)
- else:
- setBlock(x, y, z, block, blockdata, level, derelict)
- # Generates blocks in corners
- def genCorners(xStart, xEnd, y, zStart, zEnd, block, blockdata, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if (x == xStart or x == xEnd - 1) and (z == zStart or z == zEnd - 1):
- setBlock(x, y, z, block, blockdata, level, derelict)
- # Generates a rectangle perimeter with different corners
- # Block is the edges and block2 is the corners
- def genHollowCornerRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, block2, block2data, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if (x == xStart or x == xEnd - 1) and (z == zStart or z == zEnd - 1):
- setBlock(x, y, z, block, blockdata, level, derelict)
- elif x == xStart or x == xEnd - 1 or z == zStart or z == zEnd - 1:
- setBlock(x, y, z, block2, block2data, level, derelict)
- # Generates a rectangle with a gooey center and different corners
- # Block is the edges and block2 is the corners while block3 is the center
- def genFilledCornerRectangle(xStart, xEnd, y, zStart, zEnd, block, blockdata, block2, block2data, block3, block3data, level, derelict = False):
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if (x == xStart or x == xEnd - 1) and (z == zStart or z == zEnd - 1):
- setBlock(x, y, z, block, blockdata, level, derelict)
- elif x == xStart or x == xEnd - 1 or z == zStart or z == zEnd - 1:
- setBlock(x, y, z, block2, block2data, level, derelict)
- else:
- setBlock(x, y, z, block3, block3data, level, derelict)
- # Generates a cube
- def genCube(xStart, xEnd, yStart, yEnd, zStart, zEnd, block, blockdata, level, derelict = False):
- for x in range(xStart, xEnd):
- for y in range(yStart, yEnd):
- for z in range(zStart, zEnd):
- setBlock(x, y, z, block, blockdata, level, derelict)
- # Generates a rectangle of flowers
- def genFlowerRectangle(xStart, xEnd, y, zStart, zEnd, level):
- global flowerPlaceProbability
- for x in range(xStart, xEnd):
- for z in range(zStart, zEnd):
- if random.randint(1, flowerPlaceProbability) == 1:
- setBlock(x, y, z, 38, random.randint(0, 8), level)
- else:
- setBlock(x, y, z, 0, 0, level)
- # Building Functions
- # Builds a skyrscraper in given area
- def genSkyscraper(xStart, xEnd, groundHeight, zStart, zEnd, level, derelict = False):
- global yTrueLen
- global hedgeProbability
- global buildingFloorBlock
- global buildingWallBlock
- global glassBlock
- global grassBlock
- global dirtBlock
- global hedgeBlock
- global torchBlock
- global maxBasements
- space = random.randint(2, 5)
- possibleHeight = yTrueLen - groundHeight
- maxFloors = int (floor((possibleHeight - 2) / 4))
- floors = random.randint(1, maxFloors)
- aboveGroundHeight = (floors * 4) + 1
- basements = random.randint(0, maxBasements)
- basementHeight = basements * 4
- ymodifier = groundHeight - basementHeight
- trueHeight = aboveGroundHeight + basementHeight + 1
- xLength = xEnd - xStart
- zLength = zEnd - zStart
- ladderPos = (random.randint(1, 4))
- ladderRot = (random.randint(1, 2))
- if ladderPos == 1:
- ladderTowerXPos = xStart + (xLength / 2) - 1
- ladderTowerZPos = zStart + (zLength / 2) - 1
- if ladderRot == 1:
- ladderXPos = ladderTowerXPos + 1
- ladderZPos = ladderTowerZPos
- ladderData = 5
- elif ladderRot == 2:
- ladderXPos = ladderTowerXPos
- ladderZPos = ladderTowerZPos + 1
- ladderData = 3
- elif ladderPos == 2:
- ladderTowerXPos = xStart + (xLength / 2)
- ladderTowerZPos = zStart + (zLength / 2) - 1
- if ladderRot == 1:
- ladderXPos = ladderTowerXPos - 1
- ladderZPos = ladderTowerZPos
- ladderData = 4
- elif ladderRot == 2:
- ladderXPos = ladderTowerXPos
- ladderZPos = ladderTowerZPos + 1
- ladderData = 3
- elif ladderPos == 3:
- ladderTowerXPos = xStart + (xLength / 2) - 1
- ladderTowerZPos = zStart + (zLength / 2)
- if ladderRot == 1:
- ladderXPos = ladderTowerXPos + 1
- ladderZPos = ladderTowerZPos
- ladderData = 5
- elif ladderRot == 2:
- ladderXPos = ladderTowerXPos
- ladderZPos = ladderTowerZPos - 1
- ladderData = 2
- elif ladderPos == 4:
- ladderTowerXPos = xStart + (xLength / 2)
- ladderTowerZPos = zStart + (zLength / 2)
- if ladderRot == 1:
- ladderXPos = ladderTowerXPos - 1
- ladderZPos = ladderTowerZPos
- ladderData = 4
- elif ladderRot == 2:
- ladderXPos = ladderTowerXPos
- ladderZPos = ladderTowerZPos - 1
- ladderData = 2
- if derelict == False:
- genRectangle(xStart + 1, xEnd - 1, groundHeight, zStart + 1, zEnd - 1, grassBlock.ID, grassBlock.blockData, level)
- global flowerProbability
- if random.randint(1, flowerProbability) == 1:
- genFlowerRectangle(xStart + 1, xEnd - 1, groundHeight + 1, zStart + 1, zEnd - 1, level)
- else:
- genRectangle(xStart + 1, xEnd - 1, groundHeight, zStart + 1, zEnd - 1, dirtBlock.ID, dirtBlock.blockData, level)
- for y in range(0, trueHeight):
- if y + 1 == trueHeight:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, 0, 0, level, derelict)
- genRectangle(xStart + space, xEnd - space, y + ymodifier + 1, zStart + space, zEnd - space, 0, 0, level, derelict)
- genCorners(xStart + space + 1, xEnd - space - 1, y + ymodifier, zStart + space + 1, zEnd - space - 1, torchBlock.ID, torchBlock.blockData, level, derelict)
- elif y + 2 == trueHeight:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, buildingFloorBlock.ID, buildingFloorBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- elif y == 0:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, buildingFloorBlock.ID, buildingFloorBlock.blockData, level, derelict)
- elif y % 4 == 0:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, buildingFloorBlock.ID, buildingFloorBlock.blockData, level, derelict)
- setBlock(ladderTowerXPos, y + ymodifier, ladderTowerZPos, buildingWallBlock.ID, buildingWallBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- elif (y - 1) % 4 == 0 and y < basementHeight:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, 0, 0, level, derelict)
- setBlock(ladderTowerXPos, y + ymodifier, ladderTowerZPos, buildingWallBlock.ID, buildingWallBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- genCorners(xStart + space + 1, xEnd - space - 1, y + ymodifier, zStart + space + 1, zEnd - space - 1, torchBlock.ID, torchBlock.blockData, level, derelict)
- elif y < basementHeight:
- genFilledRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, 0, 0, level, derelict)
- setBlock(ladderTowerXPos, y + ymodifier, ladderTowerZPos, buildingWallBlock.ID, buildingWallBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- elif (y - 1) % 4 == 0:
- genFilledCornerRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, glassBlock.ID, glassBlock.blockData, 0, 0, level, derelict)
- setBlock(ladderTowerXPos, y + ymodifier, ladderTowerZPos, buildingWallBlock.ID, buildingWallBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- genCorners(xStart + space + 1, xEnd - space - 1, y + ymodifier, zStart + space + 1, zEnd - space - 1, torchBlock.ID, torchBlock.blockData, level, derelict)
- else:
- genFilledCornerRectangle(xStart + space, xEnd - space, y + ymodifier, zStart + space, zEnd - space, buildingWallBlock.ID, buildingWallBlock.blockData, glassBlock.ID, glassBlock.blockData, 0, 0, level, derelict)
- setBlock(ladderTowerXPos, y + ymodifier, ladderTowerZPos, buildingWallBlock.ID, buildingWallBlock.blockData, level, derelict)
- setBlock(ladderXPos, y + ymodifier, ladderZPos, 65, ladderData, level, derelict)
- if space == 4:
- hedge = random.randint(1, hedgeProbability)
- if hedge == 1:
- genHollowRectangle(xStart + 2, xEnd - 2, groundHeight + 1, zStart + 2, zEnd - 2, hedgeBlock.ID, hedgeBlock.blockData, level, derelict)
- doors = (random.randint(1, 15))
- if doors == 1 or doors == 5 or doors == 7 or doors == 9 or doors == 11 or doors == 12 or doors == 13 or doors == 15:
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight, zStart + 1, zStart + space, sideWalkBlock.ID, sideWalkBlock.blockData, level, derelict)
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight + 1, zStart + 1, zStart + space + 1, 0, 0, level)
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight + 2, zStart + 1, zStart + space + 1, 0, 0, level)
- if doors == 2 or doors == 5 or doors == 8 or doors == 10 or doors == 11 or doors == 12 or doors == 14 or doors == 15:
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight, zEnd - space, zEnd - 1, sideWalkBlock.ID, sideWalkBlock.blockData, level, derelict)
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight + 1, zEnd - space - 1, zEnd - 1, 0, 0, level)
- genRectangle(xStart + (xLength / 2) - 1, xStart + (xLength / 2) + 1, groundHeight + 2, zEnd - space - 1, zEnd - 1, 0, 0, level)
- if doors == 3 or doors == 6 or doors == 7 or doors == 10 or doors == 11 or doors == 13 or doors == 14 or doors == 15:
- genRectangle(xStart + 1, xStart + space, groundHeight, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, sideWalkBlock.ID, sideWalkBlock.blockData, level, derelict)
- genRectangle(xStart + 1, xStart + space + 1, groundHeight + 1, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, 0, 0, level)
- genRectangle(xStart + 1, xStart + space + 1, groundHeight + 2, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, 0, 0, level)
- if doors == 4 or doors == 6 or doors == 8 or doors == 9 or doors == 12 or doors == 13 or doors == 14 or doors == 15:
- genRectangle(xEnd - space, xEnd - 1, groundHeight, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, sideWalkBlock.ID, sideWalkBlock.blockData, level, derelict)
- genRectangle(xEnd - space - 1, xEnd - 1, groundHeight + 1, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, 0, 0, level)
- genRectangle(xEnd - space - 1, xEnd - 1, groundHeight + 2, zStart + (zLength / 2) - 1, zStart + (zLength / 2) + 1, 0, 0, level)
- # Creates an empty (or at least sorta empty) lot
- def genEmptyLot(xStart, xEnd, groundHeight, zStart, zEnd, level, derelict = False):
- if derelict == False:
- genRectangle(xStart + 1, xEnd - 1, groundHeight, zStart + 1, zEnd - 1, grassBlock.ID, grassBlock.blockData, level)
- global flowerProbability
- if random.randint(1, flowerProbability) == 1:
- genFlowerRectangle(xStart + 1, xEnd - 1, groundHeight + 1, zStart + 1, zEnd - 1, level)
- else:
- genRectangle(xStart + 1, xEnd - 1, groundHeight, zStart + 1, zEnd - 1, dirtBlock.ID, dirtBlock.blockData, level)
- # Main Function
- def perform(level, box, options):
- #Define size in global variables
- global xMod
- xMod = box.minx
- global xLen
- xLen = box.maxx - xMod
- global yMod
- yMod = box.miny
- global yLen
- yLen = box.maxy - yMod
- global zMod
- zMod = box.minz
- global zLen
- zLen = box.maxz - zMod
- global maxBasements
- maxBasements = options["Basements"]
- global minHeight
- minHeight = ((options["Minimum Height"] + options["Basements"]) * 4) + 4
- global groundHeight
- groundHeight = options["Basements"] * 4 + 1
- # Define options
- global createDerelicts
- createDerelicts = options["Create Derelict Structures"]
- global createEmptyLots
- createEmptyLots = options["Create Empty Lots"]
- global enableHeightMap
- enableHeightMap = options["Enable Height Randomization"]
- # Define probabilities
- global derelictProbability
- derelictProbability = options["Derelict Probability"]
- if derelictProbability < 1:
- derelictProbability = 10
- global derelictRProbability
- derelictRProbability = options["Derelict Remove Block Probability"]
- if derelictRProbability < 1:
- derelictRProbability = 10
- global lotProbability
- lotProbability = options["Lot Probability"]
- if lotProbability < 1:
- lotProbability = 10
- global hedgeProbability
- hedgeProbability = options["Hedge Probability"]
- if hedgeProbability < 1:
- hedgeProbability = 3
- global flowerProbability
- flowerProbability = options["Flower Probability"]
- if flowerProbability < 1:
- flowerProbability = 2
- global flowerPlaceProbability
- flowerPlaceProbability = options["Flower Placement Probability"]
- if flowerPlaceProbability < 1:
- flowerPlaceProbability = 5
- # Define blocks
- global groundBlock
- groundBlock = options["Ground Block"]
- global grassBlock
- grassBlock = options["Grass Block"]
- global sideWalkBlock
- sideWalkBlock = options["Sidewalk Block"]
- global buildingWallBlock
- buildingWallBlock = options["Building Wall Block"]
- global buildingFloorBlock
- buildingFloorBlock = options["Building Floor Block"]
- global lightingBlock
- lightingBlock = options["Lighting Block"]
- global torchBlock
- torchBlock = options["Torch Block (Up)"]
- global hedgeBlock
- hedgeBlock = options["Hedge Block"]
- global glassBlock
- glassBlock = options["Glass Block"]
- global dirtBlock
- dirtBlock = options["Dirt Block"]
- global xTrueLen
- global yTrueLen
- global zTrueLen
- # Enforce Chunk Conformity
- xTrueLen = int (floor((xLen - 2) / 16) * 16) + 2
- # The following if statement forces enough space into the box for one chunk
- if xTrueLen < 18: # Round 0 to 1
- xTrueLen = 18
- yTrueLen = int (floor((yLen - 4) / 4) * 4) + 4
- # The following if statement forces enough space into the box for one chunk
- if yTrueLen < minHeight: # Round all values below minimum height to minimum height
- yTrueLen = minHeight
- zTrueLen = int (floor((zLen - 2) / 16) * 16) + 2
- # The following if statement forces enough space into the box for one chunk
- if zTrueLen < 18: # Round 0 to 1
- zTrueLen = 18
- # Creates the ground as a cube of dirt
- genCube(0, xTrueLen, 0, groundHeight, 0, zTrueLen, groundBlock.ID, groundBlock.blockData, level)
- # Creates the outer sidewalk and inner grass
- genHollowRectangle(0, xTrueLen, groundHeight, 0, zTrueLen, sideWalkBlock.ID, sideWalkBlock.blockData, level)
- genHollowRectangle(0, xTrueLen, groundHeight + 1, 0, zTrueLen, 0, 0, level)
- genHollowRectangle(0, xTrueLen, groundHeight + 2, 0, zTrueLen, 0, 0, level)
- genCorners(0, xTrueLen, groundHeight + 1, 0, zTrueLen, torchBlock.ID, torchBlock.blockData, level)
- genCorners(1, xTrueLen - 1, groundHeight + 1, 0, zTrueLen, torchBlock.ID, torchBlock.blockData, level)
- genCorners(0, xTrueLen, groundHeight + 1, 1, zTrueLen - 1, torchBlock.ID, torchBlock.blockData, level)
- for x in range(1, xTrueLen - 1):
- for z in range(1, zTrueLen - 1):
- if (x - 1) % 16 == 0 and (z - 1) % 16 == 0:
- # Creates sidewalk around the chunk
- genHollowRectangle(x, x + 16, groundHeight, z, z + 16, sideWalkBlock.ID, sideWalkBlock.blockData, level)
- genHollowRectangle(x, x + 16, groundHeight + 1, z, z + 16, 0, 0, level)
- genHollowRectangle(x, x + 16, groundHeight + 2, z, z + 16, 0, 0, level)
- genCorners(x, x + 16, groundHeight + 1, z, z + 16, torchBlock.ID, torchBlock.blockData, level)
- type = random.randint(1, lotProbability)
- if type != 1:
- # Creates a skyscraper
- if createDerelicts == True and random.randint(1, derelictProbability) == 1:
- genSkyscraper(x, x + 16, groundHeight, z, z + 16, level, True)
- else:
- genSkyscraper(x, x + 16, groundHeight, z, z + 16, level)
- else:
- # Creates an empty lot
- if createDerelicts == True and random.randint(1, derelictProbability) == 1:
- genEmptyLot(x, x + 16, groundHeight, z, z + 16, level, True)
- else:
- genEmptyLot(x, x + 16, groundHeight, z, z + 16, level)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement