Advertisement
todolodo

TurbineONOFF

Apr 7th, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. local turbine = peripheral.wrap("back")
  2. if turbine.getConnected then
  3.   print("Connected to turbine!")
  4.   if redstone.getInput("bottom",true) then
  5.     print("[ON] Engaging coils!")
  6.     turbine.setInductorEngaged(true)
  7.     turbine.setActive(true)
  8.   else
  9.     print("[OFF] Disengaging coils!")
  10.     turbine.setInductorEngaged(false)
  11.     turbine.setActive(false)
  12.   end
  13. else
  14.   print("Error, no turbine connected!")
  15. end
  16. while true do
  17.   local event = os.pullEvent("redstone")
  18.   if redstone.getInput("bottom",true) then
  19.     print("[ON] Engaging coils!")
  20.     turbine.setInductorEngaged(true)
  21.     turbine.setActive(true)
  22.   else
  23.     print("[OFF] Disengaging coils!")
  24.     turbine.setInductorEngaged(false)
  25.     turbine.setActive(false)
  26.   end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement