Bugfix for tool durability detection.

This commit is contained in:
Andrew Lalis 2018-06-24 09:43:34 +02:00
parent be1274f94e
commit bab6ca719b
2 changed files with 4 additions and 3 deletions

View File

@ -26,10 +26,11 @@ local cyclesPerformed = 0
Mines one block of cobble, checking for a proper tool first.
--]]
local function mineCobble()
local success, msg = robot.durability()
while not success do
local dur = robot.durability()
while not dur do
print("No valid tool. Please place one in the tool slot and press enter.")
io.read()
dur = robot.durability()
end
robot.swing()
end

View File

@ -1 +1 @@
local a=require("robot")local b=0 local function c()local f,g=a.durability()while not f do print("No valid tool. Please place one in the tool slot and press enter.")io.read()end a.swing()end local function d()for f=1,4 do c()a.turnRight()end a.dropDown()print("Cycles done: "..b)b=b+1 end local function e()print("# Andrew's Cobblestone Generator #")print("# Copyright 2018 Andrew Lalis #")print("#--------------------------------#")print("Please enter the number of cycles to perform, or -1 to continue forever.")local f=tonumber(io.read())if(f==nil or f==-1)then print("Beginning infinite cycles.")while true do d()end else print("Beginning "..f.." cycles.")for g=1,f do d()end end print("#------Program completed.--------#")end e()
local a=require("robot")local b=0 local function c()local f=a.durability()while not f do print("No valid tool. Please place one in the tool slot and press enter.")io.read()f=a.durability()end a.swing()end local function d()for f=1,4 do c()a.turnRight()end a.dropDown()print("Cycles done: "..b)b=b+1 end local function e()print("# Andrew's Cobblestone Generator #")print("# Copyright 2018 Andrew Lalis #")print("#--------------------------------#")print("Please enter the number of cycles to perform, or -1 to continue forever.")local f=tonumber(io.read())if(f==nil or f==-1)then print("Beginning infinite cycles.")while true do d()end else print("Beginning "..f.." cycles.")for g=1,f do d()end end print("#------Program completed.--------#")end e()