require("Wheat") local path = "/wheat/config.txt" local hostPC = 30 sleep(1) rednet.open("right") rednet.send(hostPC, "started", "spruceCut") local wheat = Wheat:new() function answer(message, id) sleep(0.1) rednet.send(id, message, "received") sleep(0.1) if(message == "init") then wheat:readConfig(path) wheat:createMatrix() rednet.send(id, "init finished", "confirm") elseif(message == "getMatrix") then rednet.send(id, wheat:getMatrixString(), "confirm") elseif(message == "plantCrop") then wheat:plantAll() rednet.send(id, "plant finished", "confirm") elseif(message == "harvest") then wheat:harvestAll() rednet.send(id, "harvest finished", "confirm") elseif(message == "getFuelLevel") then rednet.send(id, tostring(wheat:getFuelLevel()), "confirm") elseif(message == "refuel") then --wheat: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()