Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Debug versions of movement/place
- function log(s) print("[DEBUG] " .. s) end
- -- Basic placement helpers
- function selectNextSlot()
- for i=1,16 do
- local slot=(turtle.getSelectedSlot()%16)+1
- turtle.select(slot)
- if turtle.getItemCount()>0 then return true end
- end
- return false
- end
- function placeF()
- log("place at ("..turtle.getPosition()..") facing") -- pseudo: log
- turtle.place()
- end
- function forwardSafe() while not turtle.forward() do turtle.dig() end end
- function upSafe() while not turtle.up() do turtle.digUp() end end
- -- Test walls for 3x3x3
- function testWalls()
- local length, width, height = 3,3,3
- local wallH = height - 2
- upSafe() -- go to layer 2
- log("Reached wall base layer")
- for layer=1, wallH do
- log("Building side loop at wall layer "..layer)
- for side=1,4 do
- log("Side "..side)
- local distance = (side%2==1) and length or width
- for i=1, distance do
- log("i="..i)
- placeF()
- if i<distance then forwardSafe() ; log("forward") end
- end
- turtle.turnRight(); log("turn right")
- end
- if layer<wallH then upSafe() end
- end
- end
- -- Run test
- testWalls()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement