Advertisement
chronicrv

Startup peripherals

Aug 5th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. local function findPeripheral( periphType )
  2. for _, side in pairs( rs.getSides() ) do
  3. if peripheral.isPresent(side) and peripheral.getType(side) == periphType then
  4. return side
  5. end
  6. end
  7.  
  8. print("Cannot find "..periphType.." attached to this computer")
  9. return 0
  10. end
  11.  
  12.  
  13. local modem = peripheral.wrap(findPeripheral("modem"))
  14.  
  15. modem.open(10)
  16.  
  17. if modem.isOpen(10) then
  18. print("modem is open in channel 10")
  19. end
  20.  
  21. if (findPeripheral("BigReactors-Reactor")==0) then
  22. local energyPylon = peripheral.wrap(findPeripheral("draconic_rf_storage"))
  23. print("energyPylon is wrapped")
  24. else
  25. local energyPylon = peripheral.wrap(findPeripheral("BigReactors-Reactor"))
  26. print("Reactor is wrapped")
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement