Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get d0MzjBzU turt
- -- Assumptions
- -- +Z is towards the sky.
- -- +Y is the starting direction.
- -- The area is totally clear of blocks, mobs, and players.
- -- The Turtle starts above a chest or ender chest outside of the structure at (x,y,z) (+1,-1,+2)
- -- The chests are aligned on the X axis with the corresponding item index in the chest
- -- Fuel goes in the first chest.
- -- The Turtle always places downwards.
- -- For consistency it always faces +y when placing a block.
- -- The Turtle inventory is preloaded with slots 1 through 16 and never runs out from the chest.
- -- Slot 1 is fuel. Index 1 is reserved for fuel.
- --XOOOOO
- --XOOOOO
- --XOOOOO
- --XOOOOO
- --XXXXXXX
- --XTCCCCCC
- --Next features:
- -- 1: X/Z Flip
- -- 2: Threaded Builders
- -- 3: Better Handling of Fuel Requirements
- -- 4: Better Handling of Resource Pickup
- XHOME = 1
- YHOME = -1
- ZHOME = 2
- VERTFLIP = 0
- local xPos = XHOME
- local yPos = YHOME
- local zPos = ZHOME
- local xDir = 0
- local yDir = 1
- local blockToPlace = 0
- local debugFlag = 1
- local slowMode = 0
- Array2d = {}
- --------- Stuff you need to edit ----------
- -- Test Object
- blockOrientationMatters = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
- Array2d[1] = {
- {"3","0","2"},
- {"3","0","0"},
- {"2","0","3"},
- }
- Array2d[2] = {
- {"3","0","0"},
- {"3","2","2"},
- {"0","3","3"},
- }
- Array3d = {1,2}
- XSTRETCH = 2
- YSTRETCH = 2
- ZSTRETCH = 2
- VERTFLIP = 1
- -- Wednesday Frog
- --[[
- --34 x
- --27 y
- blockOrientationMatters = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
- Array2d[1] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","3","3","3","3","3","3","3","3","3","3","3","3","3","3","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","3","3","3","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","3","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","3","0","0"},
- {"0","0","0","0","0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","0","0"},
- {"0","0","0","0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","3","3","0"},
- {"0","0","0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","3","0"},
- {"0","0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","3","0"},
- {"0","0","0","0","3","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","2","2","3","3"},
- {"0","0","0","0","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","2","2","2","2","2","2","2","2","2","2","2","3"},
- {"0","0","0","3","3","2","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","2","2","2","2","2","2","2","2","2","2","3"},
- {"0","0","0","3","2","2","2","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","3","2","2","2","2","2","2","2","2","2","3"},
- {"0","0","0","3","2","2","2","2","2","2","2","2","3","2","2","3","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","2","3"},
- {"0","0","3","3","2","2","2","2","3","2","2","2","2","2","2","3","2","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","3"},
- {"0","0","3","2","2","2","2","3","2","2","2","2","2","2","2","3","3","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","3","3"},
- {"0","3","3","2","2","2","2","3","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","3","3","2","2","2","2","2","2","3","0"},
- {"0","3","2","3","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","3","2","2","2","3","2","2","2","2","2","2","3","3","0"},
- {"3","3","2","2","3","2","2","2","2","2","2","2","2","2","2","2","2","2","3","3","2","2","2","2","3","2","2","2","2","2","3","3","0","0"},
- {"3","2","2","2","2","3","3","3","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","3","3","2","2","2","2","3","3","0","0","0"},
- {"3","2","2","3","2","3","0","3","3","3","3","3","3","3","3","2","2","2","2","2","2","2","2","3","2","2","2","2","3","3","0","0","0","0"},
- {"3","3","3","3","3","3","0","0","0","0","0","3","2","2","2","2","2","2","2","2","3","3","3","3","3","3","3","3","3","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","3","3","3","3","3","3","3","3","3","3","0","3","2","2","2","3","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","2","2","2","3","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","3","3","2","2","2","3","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","3","3","2","2","2","2","3","3","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","2","2","2","2","2","3","3","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","3","3","2","2","3","3","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","3","3","3","3","0","0","0","0","0","0","0","0","0","0"},
- }
- Array3d = {1}
- XSTRETCH = 1
- YSTRETCH = 1
- ZSTRETCH = 1
- --]]
- -- Slime Island
- --[[
- blockOrientationMatters = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
- --25 x
- --19 y
- --Slime is
- -- 15 x
- -- 16 y
- -- Top
- Array2d[1] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","3","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","3","3","3","3","3","3","3","2","2","2","2","2","2","2","0","0"},
- {"0","2","2","2","2","2","2","2","3","3","0","0","0","0","0","3","3","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","3","3","0","0","0","0","0","0","0","3","3","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","3","3","0","0","0","0","0","0","0","0","0","3","3","2","2","2","2","2","0"},
- {"0","2","2","2","2","3","3","0","0","0","5","0","0","0","5","0","0","0","3","3","2","2","2","2","0"},
- {"0","2","2","2","2","3","0","0","0","5","0","5","0","5","0","5","0","0","0","3","2","2","2","2","0"},
- {"0","2","2","2","2","3","0","0","0","5","0","5","0","5","0","5","0","0","0","3","2","2","2","2","0"},
- {"0","2","2","2","2","3","0","0","4","0","5","0","0","0","5","0","4","0","0","3","2","2","2","2","0"},
- {"0","0","2","2","2","3","3","0","4","4","0","0","0","0","0","4","4","0","3","3","2","2","2","0","0"},
- {"0","0","2","2","2","2","3","3","3","4","4","4","4","4","4","4","3","3","3","2","2","2","2","0","0"},
- {"0","0","0","2","2","2","2","2","3","3","3","3","3","3","3","3","3","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Top Minus 1
- Array2d[2] = {
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","3","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","3","3","3","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","3","3","3","3","3","3","3","2","2","2","2","2","2","2","2","0"},
- {"2","2","2","2","2","2","2","2","3","3","0","0","0","0","0","3","3","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","3","3","0","0","0","0","0","0","0","3","3","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","3","3","0","0","0","0","0","0","0","0","0","3","3","2","2","2","2","2","2"},
- {"2","2","2","2","2","3","3","0","0","0","5","0","0","0","5","0","0","0","3","3","2","2","2","2","2"},
- {"2","2","2","2","2","3","0","0","0","5","0","5","0","5","0","5","0","0","0","3","2","2","2","2","2"},
- {"2","2","2","2","2","3","0","0","0","5","0","5","0","5","0","5","0","0","0","3","2","2","2","2","2"},
- {"2","2","2","2","2","3","0","0","4","0","5","0","0","0","5","0","4","0","0","3","2","2","2","2","2"},
- {"0","2","2","2","2","3","3","0","4","4","0","0","0","0","0","4","4","0","3","3","2","2","2","2","0"},
- {"0","2","2","2","2","2","3","3","3","4","4","4","4","4","4","4","3","3","3","2","2","2","2","2","0"},
- {"0","0","2","2","2","2","2","2","3","3","3","3","3","3","3","3","3","2","2","2","2","2","2","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"}
- }
- -- Top Minus 2, same as top minus 1 without center changes, repeats twice.
- Array2d[3] = {
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"}
- }
- -- Top Minus 4, same as top without center changes
- Array2d[4] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Top Minus 5
- Array2d[5] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Top Minus 6
- Array2d[6] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Top Minus 7
- Array2d[7] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Top Minus 8
- Array2d[8] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0"},
- {"0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","2","2","2","2","2","2","2","2","2","2","2","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- -- Empty
- Array2d[9] = {
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"},
- {"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"}
- }
- --Array3d = {9,9,9,9,9,9,9,9,9,9,9,9,8,7,6,5,4,3,3,2,1}
- --top2 for now
- Array3d = {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,2,1}
- XSTRETCH = 1
- YSTRETCH = 1
- ZSTRETCH = 1
- --]]
- --------- End stuff you need to edit ----------------
- local XSIZE = table.getn(Array2d[1][1])
- local YSIZE = table.getn(Array2d[1])
- local ZSIZE = table.getn(Array3d)
- --123456789abcdefg
- --0 denotes empty.
- function convertString(str)
- if (str == "0") then
- ret = 0
- elseif (str == "1") then
- ret = 1
- elseif (str == "2") then
- ret = 2
- elseif (str == "3") then
- ret = 3
- elseif (str == "4") then
- ret = 4
- elseif (str == "5") then
- ret = 5
- elseif (str == "6") then
- ret = 6
- elseif (str == "7") then
- ret = 7
- elseif (str == "8") then
- ret = 8
- elseif (str == "9") then
- ret = 9
- elseif (str == "a") then
- ret = 10
- elseif (str == "b") then
- ret = 11
- elseif (str == "c") then
- ret = 12
- elseif (str == "d") then
- ret = 13
- elseif (str == "e") then
- ret = 14
- elseif (str == "f") then
- ret = 15
- elseif (str == "g") then
- ret = 16
- else
- ret = 0
- end
- return ret
- end
- function debugPrint(str)
- if (debugFlag==1) then
- print(str)
- end
- end
- -- Dervied from: http://www.computercraft.info/wiki/Excavate
- local function turnLeft()
- turtle.turnLeft()
- xDir, yDir = -yDir, xDir
- end
- local function turnRight()
- turtle.turnRight()
- xDir, yDir = yDir, -xDir
- end
- function goTo(x,y,z)
- goToFacing(x,y,z,xDir,yDir)
- end
- function goToFacing( x, y, z, xd, yd )
- debugPrint("Starting at " .. xPos .. " " .. yPos .. " " .. zPos)
- debugPrint("Going to " .. x .. " " .. y .. " " .. z)
- -- This function moves on the z-axis first.
- while zPos > z do
- if turtle.down() then
- debugPrint("Went Down")
- zPos = zPos - 1
- else
- debugPrint("Can't go Down")
- sleep( 0.5 )
- end
- end
- while zPos < z do
- if turtle.up() then
- debugPrint("Went Up")
- zPos = zPos + 1
- else
- debugPrint("Can't go Up")
- sleep( 0.5 )
- end
- end
- if xPos > x then
- while xDir ~= -1 do
- if (xDir == 0 and yDir == -1) then
- debugPrint("Turning Right xPos > x")
- turnRight()
- else
- debugPrint("Turning Left xPos > x")
- turnLeft()
- end
- end
- while xPos > x do
- if turtle.forward() then
- debugPrint("Went Forward xPos > x")
- xPos = xPos - 1
- else
- debugPrint("Can't go Forward xPos > x")
- sleep( 0.5 )
- end
- end
- elseif xPos < x then
- while xDir ~= 1 do
- if (xDir == 0 and yDir == 1) then
- debugPrint("Turning Right xPos < x")
- turnRight()
- else
- debugPrint("Turning Left xPos < x")
- turnLeft()
- end
- end
- while xPos < x do
- if turtle.forward() then
- debugPrint("Went Forward xPos < x")
- xPos = xPos + 1
- else
- debugPrint("Can't go Forward xPos < x")
- sleep( 0.5 )
- end
- end
- end
- if yPos > y then
- while yDir ~= -1 do
- if ( xDir == 1 and yDir == 0) then
- debugPrint("Turning Right yPos > y")
- turnRight()
- else
- debugPrint("Turning Left yPos > y")
- turnLeft()
- end
- end
- while yPos > y do
- if turtle.forward() then
- debugPrint("Went Forward yPos > y")
- yPos = yPos - 1
- else
- debugPrint("Can't go Forward yPos > y")
- sleep( 0.5 )
- end
- end
- elseif yPos < y then
- while yDir ~= 1 do
- if ( xDir == -1 and yDir == 0) then
- debugPrint("Turning Right yPos < y")
- turnRight()
- else
- debugPrint("Turning Left yPos < y")
- turnLeft()
- end
- end
- while yPos < y do
- if turtle.forward() then
- debugPrint("Went Forward yPos < y")
- yPos = yPos + 1
- else
- debugPrint("Can't go Forward yPos < y")
- sleep( 0.5 )
- end
- end
- end
- while yDir ~= yd or xDir ~= xd do
- if (xd == yDir and yd == -xDir) then
- debugPrint("Returning Facing Right")
- turnRight()
- else
- debugPrint("Returning Facing Left")
- turnLeft()
- end
- end
- end
- -- Refill the inventory from the chest
- function refill()
- --Refill fuel
- turtle.select(1)
- turtle.suckDown()
- turtle.suckDown()
- refuel()
- --Go to the specific chest to refill
- if (blockToPlace ~= 0) then
- goTo(blockToPlace + XHOME - 1,YHOME,ZHOME)
- turtle.select(blockToPlace)
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- turtle.suckDown()
- end
- end
- function refuel()
- turtle.select(1)
- if(turtle.refuel(63)) then
- debugPrint("Refueled")
- else
- debugPrint("Could not Refuel")
- end
- fuel=turtle.getFuelLevel()
- debugPrint("Fuel is " .. fuel)
- end
- function returnHome()
- -- Goes to 0,0 first.
- goTo(XHOME,YHOME,zPos)
- goTo(XHOME,YHOME,ZHOME)
- end
- function returnHomeFacing01()
- -- Goes to 0,0 first.
- goTo(XHOME,YHOME,zPos)
- goToFacing(XHOME,YHOME,ZHOME,0,1)
- end
- debugPrint("XSIZE, YSIZE, ZSIZE " .. table.getn(Array2d[1][1]) .. " " .. table.getn(Array2d[1]) .. " " .. ZSIZE)
- debugPrint("XSTRETCH, YSTRETCH, ZSTRETCH, " .. XSTRETCH .. " " .. YSTRETCH .. " " .. ZSTRETCH)
- refill()
- XSTRETCHSIZE=XSIZE*XSTRETCH
- YSTRETCHSIZE=YSIZE*YSTRETCH
- ZSTRETCHSIZE=ZSIZE*ZSTRETCH
- if VERTFLIP == 1 then
- XSTRETCHSIZE = XSIZE*XSTRETCH
- YSTRETCHSIZE = ZSIZE*ZSTRETCH
- ZSTRETCHSIZE = YSIZE*YSTRETCH
- end
- for zLoopIndex =1,ZSTRETCHSIZE do
- for yLoopIndex=1,YSTRETCHSIZE do
- for xLoopIndex=1,XSTRETCHSIZE do
- if(slowMode==1) then
- sleep(2)
- end
- xIdx= xLoopIndex
- yIdx= yLoopIndex
- zIdx= zLoopIndex
- -- Weave back and forth
- if yIdx % 2 == 0 then
- xIdx = XSTRETCHSIZE + 1 - xIdx
- end
- --FIXME
- if VERTFLIP == 0 then
- xBlockIndex = math.ceil(xIdx/XSTRETCH)
- yBlockIndex = math.ceil((YSTRETCHSIZE + 1 - yIdx)/YSTRETCH) -- Keep in mind that y block index is opposite polarity of yIdx
- zBlockIndex = math.ceil(zIdx/ZSTRETCH)
- if (xBlockIndex > XSIZE or xBlockIndex < 1) then
- debugPrint("xBlockIndexError: " .. xBlockIndex)
- sleep(2)
- end
- if (yBlockIndex > YSIZE or yBlockIndex < 1) then
- debugPrint("yBlockIndexError: " .. yBlockIndex)
- sleep(2)
- end
- if (zBlockIndex > ZSIZE or zBlockIndex < 1) then
- debugPrint("zBlockIndexError: " .. zBlockIndex)
- sleep(2)
- end
- else
- xBlockIndex = math.ceil(xIdx/XSTRETCH)
- yBlockIndex = math.ceil((ZSTRETCHSIZE + 1 - zIdx)/ZSTRETCH)
- zBlockIndex = math.ceil(yIdx/YSTRETCH)
- if (xBlockIndex > XSIZE or xBlockIndex < 1) then
- debugPrint("xBlockIndexError: " .. xBlockIndex)
- sleep(2)
- end
- if (yBlockIndex > YSIZE or yBlockIndex < 1) then
- debugPrint("yBlockIndexError: " .. yBlockIndex)
- sleep(2)
- end
- if (zBlockIndex > ZSIZE or zBlockIndex < 1) then
- debugPrint("zBlockIndexError: " .. zBlockIndex)
- sleep(2)
- end
- end
- debugPrint("BlockIndex Pre-Stretch: " .. xBlockIndex .. " " .. yBlockIndex .. " " .. zBlockIndex)
- if VERTFLIP == 0 then
- blockToPlace = convertString(Array2d[Array3d[zBlockIndex]][yBlockIndex][xBlockIndex]);
- else
- blockToPlace = convertString(Array2d[Array3d[zBlockIndex]][yBlockIndex][xBlockIndex]);
- end
- fuel=turtle.getFuelLevel()
- debugPrint("Prepare to Place " .. blockToPlace .. " at " .. xIdx .. " " .. yIdx .. " " .. " " .. zIdx)
- -- If we don't have the material or are low on fuel, return home, refill, come back to the z-axis.
- if (blockToPlace ~= 0) then
- --If we still need to go refill, then go
- if (turtle.getItemCount(blockToPlace) < 2 or fuel < 500) then
- debugPrint("Returning Home")
- returnHome()
- debugPrint("Refilling")
- refill()
- end
- if(blockOrientationMatters[blockToPlace]~=0) then
- -- Go to and face +y
- debugPrint("goToFacing " .. xIdx .. " " .. yIdx .. " " .. zIdx + 1 .. " - - 0 1")
- goToFacing( xIdx, yIdx, zIdx+1, 0, 1 )
- else
- -- Go to
- debugPrint("goTo " .. xIdx .. " " .. yIdx .. " " .. zIdx + 1)
- goTo( xIdx, yIdx, zIdx+1)
- end
- debugPrint("Select Block")
- turtle.select(blockToPlace)
- flag = false
- while flag == false do
- if turtle.placeDown() then
- flag = true
- else
- debugPrint("Could not place block down")
- sleep (5)
- end
- end
- end
- end
- end
- end
- returnHomeFacing01()
- debugPrint("Done")
Add Comment
Please, Sign In to add comment