|
|
|
@ -2,6 +2,9 @@ local robot = require("robot")
|
|
|
|
|
local nav = require("navigator")
|
|
|
|
|
local chest = require("chest")
|
|
|
|
|
local miner = require("miner")
|
|
|
|
|
local component = require("component")
|
|
|
|
|
|
|
|
|
|
local inventory = component.inventory_controller;
|
|
|
|
|
|
|
|
|
|
ORES = {
|
|
|
|
|
'minecraft:iron_ore',
|
|
|
|
@ -14,20 +17,37 @@ ORES = {
|
|
|
|
|
|
|
|
|
|
print("Mining...")
|
|
|
|
|
|
|
|
|
|
-- mine, starts facing east, goes east and scans south
|
|
|
|
|
miner.mine(32)
|
|
|
|
|
-- ends facing "west"
|
|
|
|
|
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
|
|
|
|
|
-- store items
|
|
|
|
|
print("Storing ores")
|
|
|
|
|
chest.store(ORES)
|
|
|
|
|
robot.turnLeft()
|
|
|
|
|
nav.forward(2)
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
print("Storing the rest")
|
|
|
|
|
chest.store()
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
nav.forward(2)
|
|
|
|
|
-- ends facing east
|
|
|
|
|
while true do
|
|
|
|
|
|
|
|
|
|
-- mine, starts facing east, goes east and scans south
|
|
|
|
|
miner.mine(32)
|
|
|
|
|
-- ends facing "west"
|
|
|
|
|
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
|
|
|
|
|
-- store items
|
|
|
|
|
print("Storing ores")
|
|
|
|
|
chest.store(ORES)
|
|
|
|
|
robot.turnLeft()
|
|
|
|
|
nav.forward(2)
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
print("Storing the rest")
|
|
|
|
|
chest.store()
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
nav.forward(2)
|
|
|
|
|
|
|
|
|
|
-- restock
|
|
|
|
|
robot.turnLeft()
|
|
|
|
|
chest.take('minecraft:torch', 1)
|
|
|
|
|
local can_continue = chest.take('minecraft:iron_pickaxe', 2)
|
|
|
|
|
robot.turnRight()
|
|
|
|
|
|
|
|
|
|
if not can_continue then
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
robot.select(2)
|
|
|
|
|
inventory.equip()
|
|
|
|
|
|
|
|
|
|
-- ends facing east
|
|
|
|
|
end
|
|
|
|
|