Exemple #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)
Exemple #2
0
def place_door(level, coords, biome, door_coords):
    minx, minz, miny, maxx, maxz = get_coords(coords)
    door_block = BlockUtils.get_door_block(biome)
    # Place door
    utilityFunctions.setBlock(level, door_block, door_coords[0], miny + 1,
                              door_coords[1])
    utilityFunctions.setBlock(level, door_block, door_coords[0], miny + 2,
                              door_coords[1])