Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Lava Refuel V0.1 by QQII
- --Declerations
- local Arguments = { ... } --Program arguments
- local bucket = 1
- local length = tonumber(Arguments[1]) or 0
- local width = tonumber(Arguments[2]) or length
- --Functions
- local function refuel_lava()
- turtle.placeDown()
- turtle.refuel()
- print(turtle.getFuelLevel())
- turtle.select(bucket+1)
- turtle.placeDown()
- turtle.select(bucket)
- end
- local function forward()
- while not turtle.forward() do
- if not turtle.dig() then
- turtle.attack()
- end
- end
- end
- local function line(l)
- for i = 2, l do
- refuel_lava()
- forward()
- end
- refuel_lava()
- end
- local function rect(l, w)
- for i = 2, w do
- line(l)
- if i % 2 ~= 0 then
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- elseif i% 2 == 0 then
- turtle.turnRight()
- forward()
- turtle.turnRight()
- end
- end
- line(l)
- end
- --User Inputs
- turtle.select(bucket)
- while turtle.getFuelLevel() == 0 do
- io.write("Place some fuel into the turtle then press enter...")
- read()
- shell.run("refuel", "all")
- end
- --Main Script
- rect(length, width)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement