Bugfix for tool durability detection.
This commit is contained in:
parent
be1274f94e
commit
bab6ca719b
|
@ -26,10 +26,11 @@ local cyclesPerformed = 0
|
||||||
Mines one block of cobble, checking for a proper tool first.
|
Mines one block of cobble, checking for a proper tool first.
|
||||||
--]]
|
--]]
|
||||||
local function mineCobble()
|
local function mineCobble()
|
||||||
local success, msg = robot.durability()
|
local dur = robot.durability()
|
||||||
while not success do
|
while not dur do
|
||||||
print("No valid tool. Please place one in the tool slot and press enter.")
|
print("No valid tool. Please place one in the tool slot and press enter.")
|
||||||
io.read()
|
io.read()
|
||||||
|
dur = robot.durability()
|
||||||
end
|
end
|
||||||
robot.swing()
|
robot.swing()
|
||||||
end
|
end
|
||||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue