From cdebaa4548d09cd39a74237bfa8d03effb8cedb0 Mon Sep 17 00:00:00 2001
From: manuel <manuel@noreply.localhost>
Date: Tue, 3 Jan 2023 18:33:10 +0000
Subject: [PATCH] Upload files to 'turtle'

---
 turtle/woodDaemon.lua | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 turtle/woodDaemon.lua

diff --git a/turtle/woodDaemon.lua b/turtle/woodDaemon.lua
new file mode 100644
index 0000000..ee9c2a6
--- /dev/null
+++ b/turtle/woodDaemon.lua
@@ -0,0 +1,38 @@
+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")
+    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")
+    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