kreezxil

cobblegen miner for computercraft

Sep 24th, 2024
6
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | Gaming | 0 0
  1. -- Function to check if the turtle's inventory is full
  2. function isInventoryFull()
  3.   for slot = 1, 16 do
  4.     if turtle.getItemCount(slot) == 0 then
  5.       return false  -- Found an empty slot
  6.     end
  7.   end
  8.   return true  -- All slots are occupied
  9. end
  10.  
  11. -- Main loop
  12. while true do
  13.   -- Wait until there's space in the inventory
  14.   while isInventoryFull() do
  15.     print("Inventory full. Waiting for space...")
  16.     os.sleep(5)  -- Wait for 5 seconds before checking again
  17.   end
  18.  
  19.   -- Attempt to dig the block in front
  20.   turtle.dig()
  21.   os.sleep(0.5)  -- Short delay to prevent rapid mining
  22. end
  23.  
Add Comment
Please, Sign In to add comment