Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local width = 0 -- Width of EnderEnder spawning layers
- local pads = 0 -- Number of spawning layers
- local x = 0 -- Local GPS Coordinates
- local y = 0
- local z = 0
- local d = 0 -- Direction Facing
- local xx,yy,zz,dd = 0 -- Backup Coordinates
- local chestD = 4 -- Direction Supply Chest is in
- local invTotal = 0 -- Total blocks in inventory matching slot 1
- local function cls(a,b) -- Clear Screen and variable positioning
- if not a then a = 1 end
- if not b then b = 1 end
- term.clear()
- term.setCursorPos(a,b)
- end
- -- Syntax Check --
- cls()
- --print(args[1] .. "," .. args[2])
- --read()
- if args[1] then
- if args[2] then
- width = args[1]
- pads = args[2]
- else
- print("Usage: EnderEnder [width, pads]")
- end
- else
- print("Enter desired width:")
- width = read()
- print("How many spawning layers?")
- print("(4 blocks per layer):")
- pads = read()
- end
- -- Fuel Check --
- local function fuel()
- if not (turtle.getFuelLevel() == "infinite") then
- if turtle.getFuelLevel() == 0 then
- while not turtle.refuel(1) do
- cls()
- print("Out of fuel! Please add more fuel!")
- for i=1,4 do turtle.turnRight() end
- end
- end
- end
- end
- -- GPS --
- local function GPS(val)
- if (val == 1) then
- if (d == 0) then z = z + 1
- elseif (d == 1) then x = x + 1
- elseif (d == 2) then z = z - 1
- elseif (d == 3) then x = x - 1
- end
- elseif (val == 2) then
- d = d + 1
- if (d == 4) then d = 0 end
- elseif (val == 3) then
- d = d - 1
- if (d == -1) then d = 3 end
- end
- --print("X:" .. x .. ", Y:" .. y .. ", Z:" .. z .. ", D:" .. d)
- end
- -- Inventory Manager --
- local function countInv()
- invTotal = 0
- for i=16,1,-1 do
- if (turtle.getItemCount(i) > 0) then
- turtle.select(i)
- if turtle.compareTo(1) then
- invTotal = invTotal + turtle.getItemCount(i)
- end
- end
- end
- turtle.select(1)
- end
- local function inv()
- if (turtle.getItemCount(1) <= 1) then
- countInv()
- if (invTotal <= 1) then
- while (invTotal <= 1) do
- for s=1,4 do tr() end
- cls() print("Out of items! Please add more items!")
- countInv()
- end
- else
- for s=2,16 do
- if (turtle.getItemCount(s) > 0) then
- turtle.select(s)
- turtle.transferTo(1)
- end
- end
- end
- end
- turtle.select(1)
- end
- -- Movement Functions --
- local function mf() while not turtle.forward() do turtle.attack() turtle.dig() end GPS(1) fuel() end
- local function mu() while not turtle.up() do turtle.attackUp() turtle.digUp() end y = y + 1 fuel() end
- local function md() while not turtle.down() do turtle.attackDown() turtle.digDown() end y = y - 1 fuel() end
- local function tr() turtle.turnRight() GPS(2) end
- local function tl() turtle.turnLeft() GPS(3) end
- local function pu() if turtle.detectUp() then turtle.digUp() end turtle.placeUp() inv() end
- local function pf() if turtle.detect() then turtle.dig() end turtle.place() inv() end
- local function pd() if turtle.detectDown() then turtle.digDown() end turtle.placeDown() inv() end
- -- Block Check --
- for i=1,4 do
- tr()
- if (chestD == 4) then
- if turtle.suck(1) then
- chestD = d
- cls()
- print("Found chest in direction " .. chestD .. ".")
- --turtle.drop(1)
- while turtle.suck() do end
- end
- end
- end
- if (chestD == 4) then
- cls()
- print("Please place a chest with extra building materials next to the turtle.")
- return
- end
- if (chestD == 0) then
- cls()
- print("Please move chest from in front of turtle or rotate turtle.")
- return
- end
- -- Placement Check --
- cls()
- print("Turtle will build to the right.")
- print("Please press [enter] if turtle is placed correctly,")
- print("or hold [Ctrl+T] to cancel and reposition.")
- read()
- -- Build Landing Pad and Falling Chute --
- fuel()
- mf() tr() mu()
- pd() for m=1,width do mf() pd() end -- Landing Pad
- mf() pd() mu() pd() mu() pd() tr() tr() pu() mf() tr() tr() pf() tr() tr() -- RH Pillar
- for r=1,12 do -- 13 "Ribs" on the Falling Chute
- for m=1,width do tr() pf() tl() tl() pf() tr() mf() end -- Building the Ribs
- pd() mu() pd() mu() pd() mu() pd() tr() tr() pu() mf() tr() tr() pf() tr() tr() -- Moving to the Next Rib
- end
- for r=1,3 do -- "Fall Brake" to standardize fall damage
- for m=1,width do tr() pf() tl() tl() pf() tr() mf() end -- Building the walls
- pd() mu() pd() tr() tr() pu() mf() tr() tr() pf() tr() tr() -- Moving to the Next Wall
- end
- tl() mu() mf() tl() mf() tl()
- for r=1,pads do -- Spawning Pads
- mf() pu() mf() pu() mf() tl() mu()
- for b=1,width do mf() pd() end
- mf() md() tl() mf() pu() mf() pu() mf() pu() mf() mu() tl()
- for b=1,width do mf() pd() end
- mf() tl() pf() -- Finished redstone/tripwire ring
- mu() mu() mf()
- for h=1,2 do -- Spawning Rings
- for b=1,2 do
- pd() mf()
- end
- tl()
- for b=1,width+1 do
- pd() mf()
- end
- tl()
- end
- mu()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement