Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- WarpDrive Force Field Projector control
- Listens on channel for Enable/Disable messages from base power monitor script
- ]]--
- local wlan_channel = 3
- local wlan = peripheral.wrap('right')
- local modem = peripheral.wrap('top')
- -- Find the first connected Big Reactor
- local connected = modem.getNamesRemote()
- for i=1, #connected do
- if string.match(peripheral.getType(connected[i]),"warpdriveForceFieldProjector") then
- print ("found reactor "..connected[i])
- reac = connected[i]
- break
- end
- end
- reactor = peripheral.wrap(reac)
- wlan.open(wlan_channel)
- print('Listening on channel '..wlan_channel)
- print ('Loop...')
- while true do
- local event, modemSide, senderChan, replyChan, msg, senderDist = os.pullEvent("modem_message")
- print("MSG: "..msg)
- if string.match(msg,"REACTOR_ON") then
- print("REACTOR_ON")
- --reactor.setActive(true)
- end
- if string.match(msg,"REACTOR_OFF") then
- print("REACTOR_OFF")
- --reactor.setActive(false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement