Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- colors = {
- colors.white, colors.orange, colors.magenta,
- colors.lightBlue, colors.yellow,
- colors.lime, colors.pink, colors.gray,
- colors.lightGray, colors.cyan, colors.purple,
- colors.blue, colors.brown, colors.green,
- colors.red, colors.black
- }
- function getNumTNT()
- term.clear()
- term.setCursorPos(1, 1)
- write("Number of TNT: ")
- input = math.ceil(tonumber(read()))
- if (input >= 1 and input <= 64) then
- write("success!")
- return input
- else
- write("you entered a number too big or small")
- sleep(3)
- return false
- end
- end
- function placeLaunchedTNT()
- rs.setOutput("right", true)
- sleep(0.1)
- rs.setOutput("right", false)
- end
- function placePropulsionTNT(input)
- inputCables = input/4
- sum = 0
- for i = 1, inputCables do
- sum = sum + colors[i]
- end
- -- Places the TNT for the propulsion.
- rs.setBundledOutput("back", sum)
- sleep(0.1)
- rs.setBundledOutput("back", 0)
- end
- function activateTNT()
- rs.setOutput("left", true)
- sleep(0.1)
- rs.setOutput("left", false)
- end
- function restart()
- main()
- end
- -- Where the magic happens.
- function main()
- numTNT = getNumTNT()
- if (numTNT) then
- placeLaunchedTNT()
- placePropulsionTNT(numTNT)
- activateTNT()
- else
- restart()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement