Clem105

Computer Turbine

May 30th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. local modem = peripheral.wrap("back")
  2. local Data = {}
  3. local Pos = {"rcsteamturbinetile_5" = {1,"right"},"rcsteamturbinetile_4"= {1,"left"},"rcsteamturbinetile_3"= {2,"right"},"rcsteamturbinetile_6"= {2,"left"},"rcsteamturbinetile_7" = {3,"right"},"rcsteamturbinetile_2"= {3,"left"},"rcsteamturbinetile_8" = {4,"right"},"rcsteamturbinetile_1"= {4,"left"},"rcsteamturbinetile_9" = {5,"right"},"rcsteamturbinetile_0"= {5,"left"}}
  4. modem.open(666)
  5.  
  6. function Maj()
  7.     for i =1,#peripheral.getNames() do
  8.         if  peripheral.getNames()[i] ~= "back" and peripheral.getNames()[i] ~= "turtle_0" then
  9.             Data[i] = {}
  10.             Data[i]["Side"] = peripheral.getNames()[i]
  11.             Data[i]["Etat"] = peripheral.call(Data[i]["side"],"getTurbineRotorSatus")
  12.             if Data[i]["Etat"] == nil then
  13.                 for o = 1,#Pos do
  14.                     if Data[i]["Side"] == Pos[o] then
  15.                         modem.transmit(666,105,textutils.serialize(Pos[Data[i]["Side"]]))
  16.                     end
  17.                 end
  18.             end
  19.         end
  20.     end
  21. end
  22.  
  23. while true do
  24.     Maj()
  25.     sleep(3)
  26. end
Advertisement
Add Comment
Please, Sign In to add comment