Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fails = 0
- wither = 0
- sides = peripheral.getNames()
- modemhere = false
- function eventListener()
- local event, p1, p2, p3 = os.pullEvent()
- if event == "rednet_message" and p3 == "ControlComp" then
- if p2[1] == "wither" then wither() end
- end
- end
- function wither()
- if wither == 0 then
- wither = 1
- redstone.setOutput("bottom", true)
- redstone.setOutput("back", true)
- elseif wither == 1 then
- wither = 0
- redstone.setOutput("bottom", false)
- redstone.setOutput("back", false)
- end
- end
- for i = 1, #sides do
- thistype = peripheral.getType(sides[i])
- if thistype == "modem" then
- print("Modem found on " .. sides[i] .. ", connecting...")
- rednet.open(sides[i])
- modemhere = true
- end
- end
- if not modemhere then error("No Modem found ! Please connect one !") end
- ControlComp = rednet.lookup("ControlComp","ControlComp")
- while ControlComp == nil do
- fails = fails+1
- print("Can't find Control Computer. Waiting ! ("..fails.." tries)")
- os.sleep(10)
- ControlComp = rednet.lookup("ControlComp","ControlComp")
- end
- print("Found Control Computer ! Running...")
- while true do
- eventListener()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement