View difference between Paste ID: tc9HiGuA and aKeHnPWz
SHOW: | | - or go back to the newest paste.
1
--[[
2
3-
Big Reactor control 
3+
WarpDrive Force Field Projector control
4
5-
Listens on channel for REACTOR_ON/REACTOR_OFF messages from base power monitor script
5+
Listens on channel for Enable/Disable messages from base power monitor script
6
7
]]--
8
9
local wlan_channel = 3
10
11
local wlan = peripheral.wrap('right')
12
local modem = peripheral.wrap('top')
13
14
-- Find the first connected Big Reactor
15
local connected = modem.getNamesRemote()
16
for i=1, #connected do
17-
  if string.match(peripheral.getType(connected[i]),"Reactor") then
17+
  if string.match(peripheral.getType(connected[i]),"warpdriveForceFieldProjector") then
18
    print ("found reactor "..connected[i])
19
    reac = connected[i]
20
    break
21
  end
22
end
23
reactor = peripheral.wrap(reac)
24
25
wlan.open(wlan_channel)
26
print('Listening on channel '..wlan_channel)
27
print ('Loop...')
28
29
while true do
30
  local event, modemSide, senderChan, replyChan, msg, senderDist = os.pullEvent("modem_message")
31
  print("MSG: "..msg)
32
33
  if string.match(msg,"REACTOR_ON") then
34
    print("REACTOR_ON")
35-
    reactor.setActive(true)
35+
    --reactor.setActive(true)
36
  end
37
38
  if string.match(msg,"REACTOR_OFF") then
39
    print("REACTOR_OFF")
40-
    reactor.setActive(false)
40+
    --reactor.setActive(false)
41
  end
42
end