Advertisement
SovietSteve

Untitled

Feb 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local reactor
  2. reactor = peripheral.wrap("bottom")
  3.  
  4. local screen
  5. screen = peripheral.wrap("back")
  6.  
  7. local wirelessModem
  8. wirelessModem = peripheral.wrap("top")
  9. local turbineArray = {}
  10.  
  11. function buildTurbineObject(turbine) do
  12.     return object {
  13.     "getActive" = turbine.getActive(),
  14.     "getRpm" = turbine.getRotorSpeed(),
  15.     "getRft" = turbine.getEnergyProducedLastTick()
  16.     }
  17. end
  18.  
  19. function getTurbines()
  20.     local peripherals = peripheral.getNames()
  21.     local count = 0
  22.     for number,device in ipairs(peripherals) do
  23.       if string.match(device,'(Turbine)') ~= nil then
  24.         turbineArray[count] = peripheral.wrap(device)
  25.         print(buildTurbineObject(turbineArray[count])
  26.         count = count +1
  27.         end
  28.     end
  29.     turbineArray["count"] = count
  30. end
  31.  
  32.  
  33. function setRod(amount, reactor)
  34.     local numberOfRods
  35.     numberOfRods = reactor.getNumberOfControlRods()-1
  36.     for i=0,numberOfRods,1 do
  37.         reactor.setControlRodLevel(
  38.             i,
  39.             reactor.getControlRodLevel(i)+amount
  40.             )
  41.     end
  42. end
  43.  
  44. function updateRods()
  45.     while true do
  46.         event, side, xPos, yPos = os.pullEvent("monitor_touch")
  47.           print(event .. " => Side: " .. tostring(side) .. ", " ..
  48.             "X: " .. tostring(xPos) .. ", " ..
  49.             "Y: " .. tostring(yPos))
  50.     end
  51. end
  52.  
  53. getTurbines()
  54. print(turbineArray[0].getActive())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement