diff --git a/mine/client.lua b/mine/client.lua index 19b71a6..bddda72 100644 --- a/mine/client.lua +++ b/mine/client.lua @@ -6,7 +6,8 @@ turtlestate = { id = os.getComputerID(), fuel = "", state = "init", - job = nil + job = nil, + ores = {} } function noop() end @@ -121,6 +122,12 @@ end function grabOres() local status, block = turtle.inspect() if status and block["name"]:lower():find("ore") then + ore = block["name"]:lower() + if turtlestates["ores"][ore] then + turtlestates["ores"][ore] = turtlestates["ores"][ore] + 1 + else + turtlestates["ores"][ore] = 1 + end turtle.dig() end end @@ -187,7 +194,7 @@ function digShaft() --turtle.placeUp() moveSafe(turtle.down, turtle.inspectDown, turtle.digDown) --turtle.down() - depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, -1) + depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, 3) turtle.turnLeft() digDeep(turtle.up, noop, noop, depth) turtle.turnLeft() @@ -644,7 +651,7 @@ function reportDuty2() end rednet.open("top") id = turtlestate["job"] - fuelconsumed = turtle.getFuelLevel() - startfuel + fuelconsumed = startfuel - turtle.getFuelLevel() turtlestate["fuel"] = fuelconsumed rednet.broadcast(tostring(id), "jobs") sleep(0.6) @@ -660,10 +667,13 @@ function reportDuty2() sleep(1) end end + for k, v in pairs(turtlestate["ores"]) do + print(k,v) + end + exit() --print("Proto: Received thanks") end - function turtleAI2() while true do local job = enqueueForJob2()