Upload files to 'turtle'
This commit is contained in:
parent
3b0f2489f6
commit
cdebaa4548
38
turtle/woodDaemon.lua
Normal file
38
turtle/woodDaemon.lua
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user