Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Awake
- print("Mining client awake: Hello World!")
- -- Setup wireless
- local modem = peripheral.wrap("right")
- -- 5 Server -> Client
- -- 6 Client -> Server
- modem.open(11)
- modem.open(12)
- print("Channel 11 and 12 are open")
- function IsTurtle()
- local success, data = turtle.inspect()
- if success then
- return data.name == "computercraft:turtle_advanced"
- else
- return false
- end
- end
- -- Setup receiving wireless messages
- function WaitForMessage(messageCompare)
- while true do
- local a,b,c,d,e,f = os.pullEvent("modem_message")
- print("Message received: ")
- print(e)
- if(e == messageCompare) then
- print("Message accepted")
- break
- end
- end
- end
- -- Setup sending wireless messages
- function SendMessage(message)
- modem.transmit(12, 11, message)
- end
- -- Forward shorthand
- function Forward()
- while not turtle.forward() do
- if (turtle.detect() and not IsTurtle()) then turtle.dig() end
- turtle.attack()
- end
- end
- -- Main loop
- while true do
- print("Waiting to start next cycle")
- WaitForMessage("_StartNextCycle")
- print("Starting next cycle...")
- Forward()
- Forward()
- Forward()
- Forward()
- print(">>")
- print(">>")
- print(">>")
- end
- print("Goodbye >>")
- read()
Add Comment
Please, Sign In to add comment