Esempio n. 1
0
 def construct(self, level, coords, door_coords, surface):
     # This is assumes box is already the size of the house
     minx = surface.to_real_x(coords[0][0])
     minz = surface.to_real_z(coords[0][1])
     maxx = surface.to_real_x(coords[1][0])
     maxz = surface.to_real_z(coords[1][1])
     block = surface.surface_map[coords[0][0]][coords[0][1]]
     door_coords = (surface.to_real_x(door_coords[0]),
                    surface.to_real_z(door_coords[1]))
     miny = block.height
     biome = block.biome_id
     wall_block = BlockUtils.get_wall_block(biome)
     door_block = BlockUtils.get_door_block(biome)
     pillar_block = BlockUtils.get_beam_block(biome)
     height_offset = RandUtils.rand_range(minx, miny, 10, 5)
     pillar_height = miny + height_offset
     level_coords = ((minx, minz, miny), (maxx, maxz, pillar_height))
     remove_blocks_in_box(level, level_coords)
     construct_pillars(level, level_coords, biome, pillar_height)
     construct_walls(level, level_coords, biome, pillar_height)
     construct_floor_and_flat_roof(level, level_coords, biome,
                                   pillar_height)
     construct_pointed_roof(level, level_coords, biome, pillar_height)
     place_door(level, level_coords, biome, door_coords)
     place_windows(level, level_coords, biome, height_offset)
     coords = shrink_building_lot(coords, miny)
     minx = surface.to_real_x(coords[0][0])
     minz = surface.to_real_z(coords[0][1])
     maxx = surface.to_real_x(coords[1][0])
     maxz = surface.to_real_z(coords[1][1])
     inside_coords = ((minx, minz, miny), (maxx, maxz))
     place_furniture(level, inside_coords, biome)
Esempio n. 2
0
def construct_walls(level, coords, biome, height):
    minx, minz, miny, maxx, maxz = get_coords(coords)
    wall_block = BlockUtils.get_wall_block(biome)
    # walls
    for y in range(height, miny, -1):
        for x in range(minx, maxx):
            for z in range(minz, maxz):
                # Skip columns since they should be a different block
                if (x == minx and z == minz) or (x == maxx-1 and z == minz) or \
                        (x == minx and z == maxz-1) or (x == maxx-1 and z == maxz-1):
                    continue
                if x == maxx - 1 or z == maxz - 1 or x == minx or z == minz:
                    utilityFunctions.setBlock(level, wall_block, x, y, z)
Esempio n. 3
0
def construct_farm(level, coords, biome):
    minx, minz, miny, maxx, maxz = get_coords(coords)
    water_block = blocks["Still Water"]
    crop_block = BlockUtils.get_crop_block(biome)
    soil_block = BlockUtils.get_soil_block(biome)
    wall_block = BlockUtils.get_wall_block(biome)

    for x in range(minx, maxx):
        for z in range(minz, maxz):
            if (z == minz or z == maxz - 1 or x == minx or x == maxx - 1):
                utilityFunctions.setBlock(level, wall_block, x, miny, z)
                utilityFunctions.setBlock(level, wall_block, x, miny - 1, z)
            else:
                if (z % 2 == 0):
                    utilityFunctions.setBlock(level, crop_block, x, miny + 1,
                                              z)
                    utilityFunctions.setBlock(level, soil_block, x, miny, z)
                else:
                    utilityFunctions.setBlock(level, water_block, x, miny, z)
                utilityFunctions.setBlock(level, soil_block, x, miny - 1, z)