richie3366

wither (côté computer)

Aug 23rd, 2013
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. tID = 90 -- ID de la turtle a controler
  2.  
  3. --m = peripheral.wrap("right")
  4.  
  5. p = peripheral.wrap("left")
  6.  
  7. function getStoredPercent()
  8. --  print(textutils.serialize(p.getMethodsRemote("MFFSCapacitor_0")))
  9.   percent_ = p.callRemote("MFFSCapacitor_0", "getStoredForceEnergy")
  10.   return (percent_/100000)
  11. end
  12.  
  13.  
  14. if not rednet.isOpen("right") then
  15.   rednet.open("right")
  16. end
  17.  
  18. sleep(2)
  19.  
  20.  
  21. while true do
  22.  
  23.   while getStoredPercent() <= 16 do
  24.     sleep(5)
  25.   end
  26.  
  27.   rednet.send(tID, "place_base")
  28.  
  29.   while true do
  30.     id, message = rednet.receive()
  31.    
  32.     if id == tID then
  33.       if message == "place_done" then
  34.         break
  35.       end
  36.     end
  37.   end
  38.  
  39.   redstone.setOutput("front", true)
  40.  
  41.   rednet.send(tID, "place_head")
  42.  
  43.   while true do
  44.     id, message = rednet.receive()
  45.      
  46.     if id == tID then
  47.       if message == "disable_mffs" then
  48.         redstone.setOutput("front", false)
  49.       end
  50.      
  51.       if message == "star_picked" then
  52.         break
  53.       end
  54.     end
  55.   end
  56.  
  57.   sleep(1)
  58.  
  59. end
Advertisement
Add Comment
Please, Sign In to add comment