local filesToDownload = { "behavior.lua", "libs/status.lua", "libs/logger.lua", "libs/turtleutils.lua" } local baseURL = "https://git.fisher.network/cc/turtle/raw/main/" -- Helper to download a file local function downloadFile(filename) local url = baseURL .. filename local res = http.get(url) if not res then error("Failed to download " .. filename) end local content = res.readAll() res.close() local file = fs.open(filename, "w") file.write(content) file.close() print("Downloaded " .. filename) end -- Download each file if not fs.exists("libs") then fs.makeDir("libs") end for _, filename in ipairs(filesToDownload) do -- remove each file first if fs.exists(filename) then print("Removing existing file: " .. filename) fs.delete(filename) end downloadFile(filename) end local tutil = require("libs.turtleutils") local status = require("libs.status") local behavior = require("behavior") -- Run behavior and status reporting in parallel parallel.waitForAny( behavior.run, function() status.reportStatus(behavior.getStatus) end )