Ajustor icon

ApricornHarvest.lua

Ajustor | PRO | 03/08/25 07:01:09 AM UTC (Edited) | 0 ⭐ | 6984 👁️ | Never ⏰ | []
Lua |

1.04 KB

|

None

|

0 👍

/

0 👎

-- config
local WALL_WIDTH = 8
local WALL_HEIGHT = 8
 
-- main program
function createTimer(time)
    return os.startTimer(time)
end
 
local harvestTimer = createTimer(60)
 
function dropInventory() 
    for i=1,16 do
        turtle.select(i)
        turtle.dropDown()
    end
    turtle.select(1)
end
 
function harvest()
    term.clear()
    term.setCursorPos(1,1)
    term.write("Start harvesting...")
    for i=0,WALL_WIDTH do
        for j=0,WALL_HEIGHT do
            turtle.dig()
            turtle.up()
        end
        for j=0,WALL_HEIGHT do
            turtle.down()
        end
        turtle.turnRight()
        turtle.forward()
        turtle.turnLeft()
    end
    turtle.turnLeft()
    for i=0,WALL_WIDTH do
        turtle.forward()
    end
    turtle.turnRight()
    term.write("Harvesting complete.")
end
 
while true do
    local event, timerId = os.pullEvent()
    if event == "timer" and timerId == harvestTimer then
        harvest()
        dropInventory()
        harvestTimer = createTimer(60)
    end
end
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎