all=0 --to cho we sobrali
ids=31 --id static display
function monik() --statistics are displayed on the screen
term.clear()
term.setCursorPos(1,1)
print("Your ID is: ", os.getComputerID())
print("This is turtle statistics terminal")
print("This turtle get wheat")
write("Sugar = ") print(all)
term.setCursorPos(1,7)
term.write("turtle Fuel = ") term.write(turtle.getFuelLevel())
rednet.open("left")
--local al2=tostring(all)
local alla="s = "..all
rednet.send(ids, alla)
rednet.close("left")
--дописать нормальный вывод на черепашке и вывод на монитор рядом стоящего компьютера
end
function chest() --_unload invenotry
_for i=1,15 do
turtle.select(i)
all = all + turtle.getItemCount(i)
while turtle.getItemCount()>0 do turtle.dropDown() end
end monik()
for i=1,60 do
term.setCursorPos(1,5)
term.clearLine()
term.write("sleep ") term.write(60-i) term.write(" sec")
sleep(1)
end term.clearLine() left=0
end
function coal() --_eat charcoal
if turtle.getItemCount(14)>0 then turtle.select(14) turtle.dropDown() end
while ((turtle.getFuelLevel())<10000) do
turtle.select(14) turtle.suckUp() turtle.refuel()
turtle.select(16)
end --najralis fuel
end
function searchchest() --–looking chest
turtle.select(16)
while true do
if not turtle.forward() then
if not turtle.dig() then
if turtle.compareDown() then chest() coal() break end
turtle.dig()
if turtle.detect() then turtle.turnLeft() end end end
end
end
left=0 --chetchik povotota 0 - left, 1 - right
function sbor()
turtle.select(16)
while true do
term.setCursorPos(1,7)
term.clearLine()
term.write("Turtle fuel = ") term.write(turtle.getFuelLevel())
rednet.open("left")
rednet.send(31,turtle.getFuelLevel().."")
rednet.close("left")
if not turtle.forward() then
if not turtle.dig() then
if turtle.detect() then
if left==0 then turtle.turnLeft()
--print("lol")
if turtle.detect() then break end
while not turtle.forward() do turtle.dig() end
while not turtle.forward() do turtle.dig() end
turtle.turnLeft() left=1
else left=0 turtle.turnRight()
if turtle.detect() then break end
while not turtle.forward() do turtle.dig() end
while not turtle.forward() do turtle.dig() end
turtle.turnRight() left=0
end end end end
end
searchchest()
end
while true do
turtle.select(16)
if not turtle.compareDown() then searchchest() else
if turtle.compareDown() and turtle.detect() then turtle.turnLeft() end end
monik() coal() sbor() end