init
This commit is contained in:
commit
12ffbdc45d
76 changed files with 79368 additions and 0 deletions
79
computer/3/mine.lua
Normal file
79
computer/3/mine.lua
Normal file
|
@ -0,0 +1,79 @@
|
|||
im = require("inventorymanager")
|
||||
local height = 0
|
||||
function mineLayer()
|
||||
rednet.broadcast("i can halt now")
|
||||
id, message = rednet.receive(nil, 5)
|
||||
if message == "halt" then
|
||||
print("was ordered to stop")
|
||||
return false
|
||||
end
|
||||
if turtle.getFuelLevel() < 500 then
|
||||
print("too tired to mine")
|
||||
return false
|
||||
end
|
||||
local slots = 0
|
||||
for i = 1,16 do
|
||||
if turtle.getItemCount(i) == 0 then
|
||||
slots = slots +1
|
||||
end
|
||||
end
|
||||
|
||||
if slots < 8 then
|
||||
print("not confident i can pick it all up :(")
|
||||
return false
|
||||
end
|
||||
status = "dropping down"
|
||||
print(status)
|
||||
while turtle.down() do
|
||||
height = height+1
|
||||
end
|
||||
turtle.digDown()
|
||||
turtle.down()
|
||||
height = height+1
|
||||
status = "mining layer:"..height
|
||||
print(status)
|
||||
for i = 1,16 do
|
||||
|
||||
for j = 1,15 do
|
||||
hit, below = turtle.inspectDown()
|
||||
if below.name == "minecraft:water" then
|
||||
im.pull("minecraft:cobblestone")
|
||||
turtle.placeDown()
|
||||
end
|
||||
turtle.dig()
|
||||
turtle.forward()
|
||||
end
|
||||
if( math.mod(i,2) == 0) then
|
||||
turtle.turnLeft()
|
||||
turtle.dig()
|
||||
turtle.placeDown()
|
||||
turtle.forward()
|
||||
turtle.turnLeft()
|
||||
else
|
||||
turtle.turnRight()
|
||||
turtle.dig()
|
||||
turtle.placeDown()
|
||||
turtle.forward()
|
||||
turtle.turnRight()
|
||||
end
|
||||
end
|
||||
turtle.turnLeft()
|
||||
for i = 1,16 do
|
||||
turtle.forward()
|
||||
end
|
||||
turtle.turnRight()
|
||||
return true
|
||||
end
|
||||
function gohome()
|
||||
status = "resurfacing"
|
||||
print(status)
|
||||
for i = 1,height do
|
||||
turtle.up()
|
||||
end
|
||||
turtle.back()
|
||||
end
|
||||
turtle.forward()
|
||||
while mineLayer() do
|
||||
|
||||
end
|
||||
gohome()
|
Loading…
Add table
Add a link
Reference in a new issue