Guest User

quarryCreate.lua

a guest
Feb 6th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. row = 1;
  2. args = {...}
  3. maxRows = 15  
  4. state = "ropedown" -- can be ropedown, ropeup and shift
  5. finishing = false
  6. looping = true
  7. firstLoop = true
  8.  
  9. function retract()
  10.     print("RESET")
  11.     finishing = true
  12.     rs.setOutput("front", true)
  13.     sleep(0.2)
  14.     rs.setOutput("back", true)
  15.     rs.setOutput("right", true)
  16.     sleep(15)
  17.     rs.setOutput("back", false)
  18.     rs.setOutput("right", false)
  19.     rs.setOutput("front", false)
  20.     looping = false
  21. end
  22.  
  23. function ropedown()
  24.     rs.setOutput("left", true)
  25.     print("Rope Down")
  26.     state = "ropeup"
  27.     sleep(1)
  28. end
  29. function ropeup()
  30.     rs.setOutput("left", false)
  31.     print("Rope Up")
  32.     state = "shift"
  33.     sleep(1)
  34. end
  35. function shift()
  36.     print("Moviendolo hacia alante")
  37.     rs.setOutput("front",true)
  38.     sleep(0.2)
  39.     rs.setOutput("right", true)
  40.     sleep(0.5)
  41.     state = "ropedown"
  42.     row = row + 1
  43.     rs.setOutput("right", false)
  44.     sleep(1.5)
  45.     rs.setOutput("front", false)
  46. end
  47.  
  48. while looping do
  49.     if (firstLoop) then
  50.         firstLoop = false
  51.         ropedown()
  52.     end
  53.     os.pullEvent("redstone")
  54.     if (rs.getInput("bottom") and not finishing) then
  55.         if row == maxRows and state == "shift" then
  56.             retract()
  57.             break
  58.         end
  59.         if     (state == "ropedown") then
  60.            ropedown()
  61.         elseif (state == "ropeup") then
  62.            ropeup()
  63.         elseif (state == "shift") then
  64.            shift()
  65.         end
  66.     end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment