Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t=turtle
- r=1
- x=0
- y=0
- z=0
- d=0
- function calc()
- zm=z
- if z<0 then zm = -z end
- clcrd=zm+x+y
- clc=(t.getItemCount(1)*80)
- if (clc-clcrd)<100 then target(0,0,0)
- while (clc-t.getItemCount(1)*100)<100 do
- print('Food plz...')
- sleep(4)
- end
- end
- end
- function rfl(s)
- if t.getFuelLevel() <= 10 then
- t.select(s)
- t.refuel(1)
- end
- calc()
- end
- function trn(rtn)
- while not(r==rtn) do
- if r==1 then r=4 t.turnLeft() else
- t.turnLeft() r=r-1 end
- end
- end
- function mv2(zk)
- t=turtle
- if zk>z then
- while not(z==zk) do
- rfl(1)
- while t.detectUp() do
- t.digUp()
- sleep(0.1)
- end
- t.up()
- z=z+1
- end
- else
- if zk<z then
- while not(z==zk) do
- rfl(1)
- while t.detectDown() do
- if not(t.digDown()) then
- target(0,0,0)
- trn(3)
- drop(1)
- print('BedRock')
- exit()
- end
- end
- t.digUp()
- t.down()
- z=z-1
- end
- end
- end
- end
- function drop(tr)
- xp = x
- yp = y
- zp = z
- rp = r
- if t.getItemCount(12) > 0 then
- target(0,0,0)
- trn(3)
- for i=2,16 do
- t.select(i)
- t.drop()
- end
- t.select(2)
- if not(tr==1) then
- target(xp,yp,zp)
- trn(rp)
- end
- end
- end
- function mv1(n)
- for i=1,n do
- rfl(1)
- while t.detect() do
- ktv=0
- while not(t.dig()) do
- ktv=ktv+1
- if ktv==14 then
- target(0,0,0)
- trn(3)
- drop(1)
- exit()
- end
- sleep(0.2)
- t.dig()
- end
- ktv=0
- end
- while t.detectUp() do
- t.digUp()
- sleep(0.2)
- end
- while t.detectDown() do
- t.digDown()
- sleep(0.2)
- end
- kl=0
- while not(t.forward()) do
- kl=kl+1
- t.dig()
- if kl==14 then
- target(0,0,0)
- trn(3)
- for i=2,16 do
- t.select(i)
- t.drop()
- end
- t.select(2)
- exit()
- end
- end
- kl=0
- crd(r)
- end
- end
- function crd(direct)
- if direct == 1 then x=x+1 else
- if direct == 2 then y=y+1 else
- if direct == 3 then x=x-1 else
- if direct == 4 then y=y-1 end end end end
- end
- function target(x1, y1, z1)
- mv2(z1)
- if x1>x then trn(1) mv1(x1-x) else
- if x1<x then trn(3) mv1(x-x1)
- end
- end
- if y1>y then trn(2) mv1(y1-y) else
- if y1<y then trn(4) mv1(y-y1)
- end
- end
- end
- print('Diametr?')
- h=-2
- d=tonumber(read())-1
- print('Now height coord?')
- min=tonumber(read())-2
- mv2(h)
- for i=1,min do
- drop()
- for i=1,d do
- drop()
- if x==0 then
- target(d,i,h)
- else
- target(0,i,h)
- end
- end
- if x==0 then
- target(d,d,h)
- else
- target(0,d,h)
- end
- h=h-3
- target(0,0,h)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement