from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel, player_z b = Building() ref_x = 100 ref_y = 14 ref_z = player_z # Alternatively type your unique z value instead of player_z wool = "wool:blue" b.build(ref_x, ref_y, ref_z, wool) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
# ENGINEERING CALCULATIONS tunnel_length = x_max - x_min + 1 wall_z = ref_z - tunnel_width // 2 # x values for tunnel glass and air range_x = range(x_min, x_min + tunnel_length) # y and z values for tunnel glass (external) range_y_ext = range(floor_y, floor_y + tunnel_height) range_z_ext = range(wall_z, wall_z + tunnel_width) # y and z values for tunnel air (internal) range_y_int = range(floor_y + 1, floor_y + tunnel_height - 1) range_z_int = range(wall_z + 1, wall_z + tunnel_width - 1) # x values for torches range_x_torch = range(x_min, x_min + tunnel_length, 4) # BUILD # build a solid cuboid of glass first which is 7 blocks high and 5 blocks wide b.build(range_x, range_y_ext, range_z_ext, wall) # replace the internal glass with air so left with a hollow tunnel b.build(range_x, range_y_int, range_z_int, air) # replace the floor with stone b.build(range_x, floor_y, range_z_int, floor) # place torches b.build(range_x_torch, floor_y + 1, ref_z + 1, torch) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
# z value of side of arch (where wall_z < player_z) wall_z = ref_z - arch_width // 2 # x value for arch location range_x_arch = path_x_min # external dimensions of arch range_y_ext = range(floor_y, floor_y + arch_height) range_z_ext = range(wall_z, wall_z + arch_width) # internal dimensions of arch range_y_int = range(floor_y + 1, floor_y + arch_height - 1) range_z_int = range(wall_z + 1, wall_z + arch_width - 1) # BUILD # clear any existing structure or ground b.build(range(path_x_min, path_x_min + 40), range(floor_y + 1, floor_y + 31), range(ref_z - 4, ref_z + 5), air) # build a solid cuboid of glass first which is 7 blocks high and 5 blocks wide b.build(range_x_arch, range_y_ext, range_z_ext, wall) # replace the internal glass with air so left with a hollow tunnel b.build(range_x_arch, range_y_int, range_z_int, air) # replace the floor with stone b.build(range_x_arch, floor_y, range_z_int, floor) # place a torch in each arch b.build(range_x_arch, floor_y + 1, ref_z + 1, torch) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
tunnel_width = 5 # BUILDING MATERIALS air = "air" wall = "default:glass" # ENGINEERING CALCULATIONS tunnel_length = x_max - x_min + 1 wall_z = ref_z - tunnel_width // 2 # x values for tunnel glass and air range_x = range(x_min, x_min + tunnel_length) # y and z values for glass on exterior of tunnel range_y_ext = range(floor_y, floor_y + tunnel_height) range_z_ext = range(wall_z, wall_z + tunnel_width) # y and z values for air in the interior of tunnel range_y_int = range(floor_y + 1, floor_y + tunnel_height - 1) range_z_int = range(wall_z + 1, wall_z + tunnel_width - 1) # BUILD # build a solid cuboid of glass first which is 7 blocks high and 5 blocks wide b.build(range_x, range_y_ext, range_z_ext, wall) # replace the internal glass with air so left with a hollow tunnel b.build(range_x, range_y_int, range_z_int, air) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
# external dimensions of castle base range_x_castle_ext = range(castle_x_min, castle_x_min + castle_length) range_y_castle_ext = range(floor_y, floor_y + castle_height) range_z_castle_ext = range(wall_z1, wall_z1 + castle_width) # internal dimensions of castle base range_x_castle_int = range(castle_x_min + 1, castle_x_min + castle_length - 1) range_y_castle_int = range(floor_y + 1, floor_y + castle_height) range_z_castle_int = range(wall_z1 + 1, wall_z1 + castle_width - 1) # height of side windows from 2 above floor to height of castle range_y_window = range(floor_y + 2, floor_y + castle_height) # place side windows every 2 blocks starting from second block from door range_x_window = range(castle_x_min + 2, castle_x_min + castle_length - 2, 2) # BUILD # clear any existing structure or ground b.build(range(castle_x_min - 1, castle_x_min + castle_length + 10), range(floor_y + 1, floor_y + 31), range(ref_z - 4, ref_z + 5), air) # the base of the castle b.build(range_x_castle_ext, range_y_castle_ext, range_z_castle_ext, castle) b.build(range_x_castle_int, range_y_castle_int, range_z_castle_int, air) # create a doorway b.build(castle_x_min, [floor_y + 1, floor_y + 2], ref_z, air) # add windows on side walls b.build(range_x_window, range_y_window, (wall_z1, wall_z2), window_z) # add windows on front wall b.build(castle_x_min, floor_y + 4, (ref_z - 1, ref_z, ref_z + 1), window_x) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
b = Building() # position of centre of square cx = 100 cy = 32 z = player_z # array of node types which we will alternate through colour0 = "wool:green" colour1 = "wool:blue" colours = [colour0, colour1] # calculate extents of square width = 9 height = 9 x1 = cx - width // 2 y1 = cy - height // 2 x2 = x1 + width y2 = y1 + height # loop through all positions in square for y in range(y1, y2): for x in range(x1, x2): colour = colours[(y + x) % 2] b.build(x, y, z, colour) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
range_y_roof_ext = range(floor_y + castle_height, floor_y + castle_height + 3) range_z_roof_ext = range(wall_z1 - 1, wall_z1 + castle_width + 1) range_x_roof_int = range_x_castle_ext range_y_roof_int = range(floor_y + castle_height + 1, floor_y + castle_height + 3) range_z_roof_int = range_z_castle_ext # location of crenels and merlons on castle roof crenel_y = floor_y + castle_height + 2 roof_x1 = castle_x_min - 1 roof_x2 = castle_x_min + castle_length roof_z1 = wall_z1 - 1 roof_z2 = wall_z2 + 1 # BUILD # clear any existing structure or ground b.build(range(castle_x_min - 1, castle_x_min + castle_length + 10), range(floor_y + 1, floor_y + 31), range(ref_z - 4, ref_z + 5), air) # the base of the castle b.build(range_x_castle_ext, range_y_castle_ext, range_z_castle_ext, castle) b.build(range_x_castle_int, range_y_castle_int, range_z_castle_int, air) # create a doorway b.build(castle_x_min, [floor_y + 1, floor_y + 2], ref_z, air) # add windows on side walls b.build(range_x_window, range_y_window, (wall_z1, wall_z2), window_z) # add windows on front wall b.build(castle_x_min, floor_y + 4, (ref_z - 1, ref_z, ref_z + 1), window_x) # the roof of the castle b.build(range_x_roof_ext, range_y_roof_ext, range_z_roof_ext, castle) b.build(range_x_roof_int, range_y_roof_int, range_z_roof_int, air) # build the ladder. Has to be against wall for player to climb it easily. b.build(castle_x_min + castle_length - 2, range(floor_y + 1, floor_y + castle_height + 1), ref_z, ladder)
cy = 32 z = player_z # array of node types which we will alternate through colours = ["wool:white", "wool:orange"] # calculate extents of diamond width = 21 height = 21 x1 = cx - width // 2 y1 = cy - height // 2 x2 = x1 + width y2 = y1 + height # clear area first with air b.build(range(x1, x2), range(y1, y2), z, "air") # build diamond for y in range(y1, y2): # calculate x range which will give diamond shape xlo = x1 + abs(y - cy) xhi = x2 - abs(y - cy) for x in range(xlo, xhi): # set each node to an alternate wool colour using same formula as in previous task b.build(x, y, z, colours[(x + y) % 2]) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel, player_z b = Building() ref_z = player_z wool = "wool:red" glass = "default:glass" b.build(100, 13, ref_z - 1, glass) b.build(100, 14, ref_z - 1, glass) b.build(100, 15, ref_z - 1, glass) b.build(100, 13, ref_z, glass) b.build(100, 14, ref_z, wool) b.build(100, 15, ref_z, glass) b.build(100, 13, ref_z + 1, glass) b.build(100, 14, ref_z + 1, glass) b.build(100, 15, ref_z + 1, glass) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel, player_z b = Building() ref_x = 101 ref_y = 14 ref_z = player_z glass = "default:obsidian_glass" for y in (ref_y - 1, ref_y, ref_y + 1): for z in (ref_z - 1, ref_z, ref_z + 1): b.build(ref_x, y, z, glass) print("y", y, "z", z) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
arch_height = 7 # width of arch in number of blocks (external dimension) arch_width = 5 # BUILDING MATERIALS air = "air" wall = "default:glass" # ENGINEERING CALCULATIONS # z value of side of arch (where wall_z < player_z) wall_z = ref_z - arch_width // 2 # x value for arch location range_x_arch = path_x_min # external dimensions of arch range_y_ext = range(floor_y, floor_y + arch_height) range_z_ext = range(wall_z, wall_z + arch_width) # BUILD # clear any existing structure or ground b.build(range(path_x_min, path_x_min + 40), range(floor_y, floor_y + 31), range(ref_z - 4, ref_z + 5), air) b.build(range(path_x_min, path_x_min + 16), floor_y, range(ref_z - 1, ref_z + 2), "default:stone") # build a solid cuboid of glass first which is 7 blocks high and 5 blocks wide b.build(range_x_arch, range_y_ext, range_z_ext, wall) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
# BUILDING MATERIALS air = "air" pole = "default:fence_junglewood" colours = [ "wool:" + colour for colour in "white|grey|dark_grey|black|blue|cyan|green|dark_green|yellow|orange|brown|red|pink|magenta|violet" .split("|") ] # ENGINEERING CALCULATIONS num_colours = len(colours) stripe_width = 2 b.build(pole_x, range(pole_y, flag_y), ref_z, pole) b.build(range(pole_x, pole_x + 26), range(flag_y, flag_y + 26), range(ref_z - 4, ref_z + 5), air) for x in range(pole_x, pole_x + flag_length): for y in range(flag_y, flag_y + flag_height): # pattern centred on centre of flag cx = pole_x + flag_length / 2 cy = flag_y + flag_height / 2 # pattern centred on front bottom corner # cx = pole_x # cy = flag_y # c = x # vertical stripes # c = y # horizontal stripes # c = (x + y) # diagonal stripes # c = (x - y) # other diagonal stripes
from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel, player_z b = Building() ref_x = 100 ref_y = 14 ref_z = player_z wool = "wool:yellow" glass = "default:glass" seq_x = (ref_x - 1, ref_x, ref_x + 1) # or (99, 100, 101) seq_y = (ref_y - 1, ref_y, ref_y + 1) # or (13, 14, 15) seq_z = (ref_z - 1, ref_z, ref_z + 1) b.build(seq_x, seq_y, seq_z, glass) b.build(ref_x, ref_y, ref_z, wool) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
glass = "default:glass" floor = "default:stone" torch = "default:torch" air = "air" # Make the full tunnel in solid glass and stone first for i in range(num_segments): # Cross section of tunnel at position i # x, y, z are coordinates of lower left corner of segment of tunnel x = x1 - i y = y1 - i z = ref_z - tunnel_width // 2 # Build 5 x 7 blocks of glass at position i for walls, roof, and centre range_y_ext = range(y, y + tunnel_height) range_z_ext = range(z, z + tunnel_width) b.build(x, range_y_ext, range_z_ext, glass) # Build 3 x 1 blocks of stone at position i for floor range_z_floor = (z + 1, z + 2, z + 3) b.build(x, y, range_z_floor, floor) # hollow out the tunnel because now we are sure that lava and water can't flow in the ends for i in range(num_segments): # Use air to hollow out the tunnel x = x1 - i y = y1 - i z = ref_z - tunnel_width // 2 range_y_air = range(y + 1, y + tunnel_height - 1) range_z_air = (z + 1, z + 2, z + 3) b.build(x, range_y_air, range_z_air, air) if i % 4 == 0: # Place torches down the right hand side of the tunnel b.build(x, y + 1, ref_z + 1, torch)
x2 = 9 task4_x1 = 93 y1 = 14 z = player_z num_segments = x1 - x2 + 1 # store node types in variables for easier use stair_up_x = {"name": "stairs:stair_stonebrick", "direction": "+x"} rail = 'carts:rail' power_rail = 'carts:powerrail' # sloping section of tunnel for i in range(num_segments): # Add stairs - Don't need stairs on very last block. Hence check i < 60 if i < 60: b.build(x1 - i, y1 - i, z - 1, stair_up_x) # Add power rail b.build(x1 - i, y1 - i + 1, z, power_rail) # flat section of tunnel for x in range(x1, task4_x1 + 1): # Add rail or power rail in pairs if x // 2 % 2 == 0: b.build(x, y1 + 1, z, rail) else: b.build(x, y1 + 1, z, power_rail) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc)
from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel, player_z b = Building() # player_z has been imported from the configuration file you created in first task ref_z = player_z glass = "default:obsidian_glass" for y in (13, 14, 15): b.build(99, y, ref_z - 1, glass) b.build(99, y, ref_z, glass) b.build(99, y, ref_z + 1, glass) print(y) with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt
from ircbuilder import open_irc from ircbuilder.building import Building from minetest_irc import ircserver, mtuser, mtuserpass, mtbotnick, channel b = Building() b.build(100, 14, 20, "wool:green") with open_irc(ircserver, mtuser, mtuserpass, mtbotnick, channel) as mc: b.send(mc) # © Copyright 2018-2021 Triptera Pty Ltd - https://pythonator.com - See LICENSE.txt