require("spruceCut") require("Wood") local path = "/treeAlpha2/properties.txt" local hostPC = 30 sleep(1) rednet.open("right") rednet.send(hostPC, "started", "spruceCut") local tree = Wood:new() function answer(message, id) sleep(0.1) rednet.send(id, message, "received") sleep(0.1) if(message == "init") then tree:readConfig(path) tree:autoHome() rednet.send(id, "init finished", "confirm") elseif(message == "checkTree") then rednet.send(id, tree:checkTree(), "confirm") elseif(message == "plantTree") then tree:plantTree() rednet.send(id, "plant finished", "confirm") elseif(message == "cutTree") then tree:cutTree() rednet.send(id, "cut finished", "confirm") elseif(message == "sort") then local hasMore = tree:sort() if hasMore then rednet.send(id, "sort finished, more in chest", "confirm") else rednet.send(id, "sort finished, chest empty", "confirm") end elseif(message == "getFuelLevel") then rednet.send(id, tostring(tree:getFuelLevel()), "confirm") elseif(message == "refuel") then tree:refuel() rednet.send(id, "refueled", "confirm") end rednet.send(id, "could not resolve message", "error") end local function main() while true do local id, message = rednet.receive() answer(message, id) end end main()