Added modules.lua and check fuel
The app now checks, if it has enough fuel, before doing any movement.
This commit is contained in:
		@@ -1,21 +1,24 @@
 | 
				
			|||||||
--[[Tree Chopping program by Sascha
 | 
					--[[Tree Chopping program by Sascha
 | 
				
			||||||
Chops down the tree in front of turtle.]]
 | 
					Chops down the tree in front of turtle.]]
 | 
				
			||||||
 | 
					os.loadAPI('modules.lua') -- Load the modules module
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print('Chopping tree...')
 | 
					print('Chopping tree...')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if not turtle.dig() then -- chop base of tree
 | 
					if not turtle.dig() then -- chop base of tree
 | 
				
			||||||
  error('Turtle needs a digging tool!')
 | 
					  error('Turtle needs a digging tool!')
 | 
				
			||||||
end  
 | 
					end
 | 
				
			||||||
  
 | 
					
 | 
				
			||||||
os.sleep(5) -- Wait until everything droppen from the tree
 | 
					os.sleep(3) -- Wait until everything droppen from the tree
 | 
				
			||||||
for j = 1, 4 do
 | 
					for j = 1, 4 do
 | 
				
			||||||
    for i = 1, 4 do
 | 
					  for i = 1, 4 do
 | 
				
			||||||
        turtle.suck() -- Suck up everything
 | 
					    turtle.suck() -- Suck up everything
 | 
				
			||||||
	turtle.turnLeft()
 | 
					    turtle.turnLeft()
 | 
				
			||||||
    end
 | 
					  end
 | 
				
			||||||
    turtle.forward()
 | 
					  check_fuel()
 | 
				
			||||||
 | 
					  turtle.forward()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for i = 1, 4 do
 | 
					for i = 1, 4 do
 | 
				
			||||||
    turtle.back()
 | 
					  check_fuel()
 | 
				
			||||||
 | 
					  turtle.back()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user