diff --git a/programs/goo.lua b/programs/goo.lua index 4639233..0d87f8e 100644 --- a/programs/goo.lua +++ b/programs/goo.lua @@ -1,4 +1,4 @@ -local _VERSION = '0.1.1'; +local _VERSION = '0.1.2'; local args = table.pack(...); local command = args[1]; @@ -70,6 +70,14 @@ if not turtle then error('goo must be run on a turtle'); end +local function hasPickaxeEquipped() + local left = turtle.getEquippedLeft(); + local right = turtle.getEquippedRight(); + + return (left and string.match(left.name or '', '_pickaxe$') ~= nil) + or (right and string.match(right.name or '', '_pickaxe$') ~= nil); +end + local function turnAround() turtle.turnRight(); turtle.turnRight(); @@ -499,6 +507,10 @@ end print('goo started. Place the turtle directly below the goo block.'); +if not hasPickaxeEquipped() then + error('goo requires a turtle with a pickaxe equipped'); +end + ensureStartFuel(); while true do