Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local blocksInFront = 4
- local blocksBehind = 10
- local tpBackUp = true
- local checkBlockBelow = true
- local jumps = {}
- for i=0,1 do
- for j=-5,5 do
- for k=-5,5 do
- local jump = vector.new(j,i,k)
- local jumpL = jump:length()
- if jumpL <= 5 and jumpL > 1.5 then
- table.insert(jumps,jump)
- end
- end
- end
- end
- local function crossingPath(b,p)
- for i=2,#p do
- if (b-p[i]):length() <= 5.1 then
- return true
- end
- end
- return false
- end
- local blocks = {}
- local catcher = vector.new(0,-30,0)
- local detecter = vector.new(0,2,0)
- local catcherRad = ",27]"
- local startP = vector.new(commands.getBlockPosition()) - catcher / 2
- local tpCircle
- local paraFuncs = {
- function()
- repeat
- local newB
- while #blocks <= blocksInFront or not newB do
- repeat
- newB = (blocks[1] or startP) + jumps[math.random(#jumps)]
- until not crossingPath(newB,blocks)
- table.insert(blocks,1,newB)
- commands.setblock(newB.x,newB.y,newB.z,
- "minecraft:wool",math.random(0,15))
- end
- local tplayer = "@p["..tostring(blocks[blocksInFront] + detecter) .. ",1]"
- tpCircle = "@p[" ..tostring(blocks[blocksInFront] + catcher) ..catcherRad
- repeat
- until commands.testfor(tplayer)
- if #blocks > blocksInFront + blocksBehind + 2 then
- local last = blocks[#blocks]
- commands.setblock(last.x,last.y,last.z,"minecraft:air")
- table.remove(blocks)
- end
- if blocks[1].y >= 250 then
- blocksInFront = blocksInFront - 1
- end
- until blocksInFront <= 0
- print("Reached the top of the map")
- end,
- function()
- print("Press any char to exit")
- os.pullEvent("char")
- print("Programm manuell program exit")
- end}
- if tpBackUp then
- paraFuncs[3]=function()
- while true do
- if commands.testfor(tpCircle) then
- local checkP = blocks[blocksInFront+1]
- commands.tp(tpCircle,checkP.x,checkP.y+2,checkP.z)
- end
- end
- end
- end
- if checkBlockBelow then
- table.insert(paraFuncs,function()
- local cur
- repeat
- sleep(1)
- cur = blocks[blocksInFront+1] or vector.new(commands.getBlockPosition())
- until commands.testforblock(cur.x,cur.y,cur.z,"minecraft:air")
- print("Block below was broken")
- end)
- end
- parallel.waitForAny(unpack(paraFuncs))
- commands.tp("@a["..tostring(blocks[1])..catcherRad,commands.getBlockPosition())
- for i,j in ipairs(blocks) do
- commands.setblock(j.x,j.y,j.z,"minecraft:air")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement