Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- WarpDrive Wireless Force Field Projector control.
- Listens on channel for Enable/Disable messages from Server.
- Copyright InfiniteBlock. 2020 [THC]
- ]]--
- -- Modem Details.
- local wlan_channel = 3
- local wlan = peripheral.wrap('top')
- -- Find the Force Field's.
- sides = peripheral.getNames()
- forcefieldprojectors = {}
- for _, side in pairs(sides) do
- os.sleep(0)
- local componentType = peripheral.getType(side)
- if componentType == "warpdriveForceFieldProjector" then
- table.insert(forcefieldprojectors, peripheral.wrap(side))
- print(componentType .. " Linked!")
- end
- end
- print("")
- -- Open Modem.
- wlan.open(wlan_channel)
- print('Listening on channel '..wlan_channel)
- print ('Awaiting Commands....')
- while true do
- local event, modemSide, senderChan, replyChan, msg, senderDist = os.pullEvent("modem_message")
- print("MSG: "..msg)
- if string.match(msg,"eq4324324EWEW2213") then
- print("Shield Enabled")
- for _, forcefieldprojector in pairs(forcefieldprojectors) do
- forcefieldprojector.enable(false)
- forcefieldprojector.enable(true)
- end
- end
- if string.match(msg,"WQEWEfdfsd3423423") then
- print("Shield Disabled")
- for _, forcefieldprojector in pairs(forcefieldprojectors) do
- forcefieldprojector.enable(false)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement