From 4bee1219a1fcf514e183672e6d22d4b2f15053c4 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 11 Jan 2023 18:40:33 +0000 Subject: [PATCH] Delete 'Controller/wheatDaemon.lua' --- Controller/wheatDaemon.lua | 72 -------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 Controller/wheatDaemon.lua diff --git a/Controller/wheatDaemon.lua b/Controller/wheatDaemon.lua deleted file mode 100644 index d96cf9c..0000000 --- a/Controller/wheatDaemon.lua +++ /dev/null @@ -1,72 +0,0 @@ -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 toMatrix(str) - local matrix = {} - assert(type(str) == "string") - assert(str:sub(1,1) == "{", "the string must begin with a \"{\"") - local len = str:len() - assert(str:sub(len,len) == "}", "the string must end with a \"}\"") - local s1, ob = str:gsub("{", "{") - local s2, cb = str:gsub("}", "}") - assert(ob == cb, "the string must have the same amount of opening brackets as closing brackets") - - str = str:sub(2, len - 1) - len = len - 2 - - if(str:sub(1,1) == "{") then - - end -end - -function toArray(str) - local len = str:len() - local comma = str:sub(",") - local arr = {} - while(type(comma)=="number") do - arr[#arr+1] = str:sub(1, comma-1) - str = str:sub(comma + 1, len) - len = str:len() - comma = str:sub(",") - end - return arr -end - -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() \ No newline at end of file