Advertisement
JaMaNi133

DuperBottom

Aug 19th, 2024 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. flyer = "left"
  2. flyerFeedback = "bottom"
  3. duperPower = "back"
  4. networkSide = "right"
  5.  
  6. powers = {0,2,2,6,6,8,8,10,12}
  7. -- -1s : 2 4 6
  8.  
  9. function sendFlying()
  10.     redstone.setOutput(flyer,true)
  11.     sleep(0.05)
  12.     redstone.setOutput(flyer,false)
  13. end
  14.  
  15. function waitForFlyer()
  16.     timeout = 1200
  17.     while timeout>=0 do
  18.         timeout = timeout - 1
  19.         if redstone.getInput(flyerFeedback) then
  20.             rednet.broadcast({command="base.flyer.arrived"})
  21.             return
  22.         end
  23.         sleep(0.05)
  24.     end
  25.     print("flyer wait timed out")
  26.     rednet.broadcast({command="base.flyer.timeout"})
  27. end
  28.  
  29.  
  30.  
  31. rednet.open(networkSide)
  32. while rednet.isOpen() do
  33.     senderID,message,distance,protcol = rednet.receive()
  34.     if message.command == "payload.duper.setCount" then
  35.         redstone.setAnalogOutput(duperPower,powers[message.count+1])
  36.     end
  37.     if message.command == "base.flyer.start" then
  38.         sendFlying()
  39.     end
  40.     if message.command == "base.flyer.catch" then
  41.         waitForFlyer()
  42.     end
  43. end
  44. print("rednet closed... terminating")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement