Advertisement
jared314

ICBM Controls

Aug 9th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.94 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2.  
  3. function default()
  4. term.clear()
  5. term.setCursorPos(7,1)
  6. term.setTextColor(colors.red)
  7. term.write("Launch Controls")
  8. term.setTextColor(colors.white)
  9. term.setCursorPos(1,3)
  10. term.write("Silo 1 - Rejuvenation Missile")
  11. term.setCursorPos(1,4)
  12. term.write("Silo 2 - Thermobaric Missile")
  13. term.setCursorPos(1,5)
  14. term.write("Silo 3 - Incendiary Missile")
  15. term.setCursorPos(1,6)
  16. term.write("Silo 4 - Custom Missiles")
  17. term.setCursorPos(1,8)
  18. term.setTextColor(colours.red)
  19. term.write("Enter Silo Number to Launch:")
  20. term.setTextColor(colours.white)
  21. term.setCursorPos(1,9)
  22.  
  23. local input = read()
  24.  
  25. if input == "debug" then
  26. error()
  27. else if input == "1" then
  28. silo1confirm()
  29. else if input == "2" then
  30. silo2confirm()
  31. else if input == "3" then
  32. silo3confirm()
  33. else if input == "4" then
  34. silo4confirm()
  35. else
  36. term.setTextColor(colors.red)
  37. term.write("Invalid Choice")
  38. term.setTextColor(colors.white)
  39. sleep(1)
  40. default()
  41. end
  42. end
  43. end
  44. end
  45. end
  46. end
  47.  
  48. function silo1confirm()
  49. term.clear()
  50.  
  51. term.setCursorPos(1,1)
  52. term.write("Rejuvenation Missiles will restore chunks to ")
  53. term.setCursorPos(1,2)
  54. term.write("their original state. Fixing damage from")
  55. term.setCursorPos(1,3)
  56. term.write("previous attacks.")
  57.  
  58. term.setCursorPos(1,5)
  59. term.setTextColor(colours.red)
  60. term.write("**Ensure Target Co-ordinates have been entered!**")
  61. term.setTextColor(colours.white)
  62. term.setCursorPos(1,7)
  63. term.write("Enter Log Entry for Launch:")
  64. term.setCursorPos(1,8)
  65. local input1 = read()
  66. rednet.open("back")
  67. rednet.send(119, input1)
  68. silo1launch()
  69. end
  70.  
  71. function silo1launch()
  72. term.clear()
  73. term.setCursorPos(1,1)
  74. term.setTextColor(colors.green)
  75. term.write("Missile Online.")
  76. sleep(1)
  77. term.setTextColor(colors.white)
  78. term.setCursorPos(1,4)
  79. term.write("Enter Launch Code:")
  80. term.setCursorPos(1,5)
  81. local input2 = read("*")
  82. if input2 == "000000" then
  83. term.setTextColor(colors.green)
  84. term.write("Confirmed. Launching Missile 1...")
  85. term.setTextColor(colors.white)
  86. rednet.open("back")
  87. rednet.broadcast("launch1000000")
  88. sleep(4)
  89. default()
  90. else
  91. term.setTextColor(colors.red)
  92. term.setCursorPos(1,6)
  93. term.write("Invalid Code")
  94. sleep(1)
  95. term.setCursorPos(1,7)
  96. term.write("Disarming Missile...")
  97. term.setTextColor(colors.white)
  98. sleep(2)
  99. default()
  100. end
  101. end
  102.  
  103.  
  104.  
  105. function silo2confirm()
  106. term.clear()
  107.  
  108. term.setCursorPos(1,1)
  109. term.write("The thermobaric missile is an explosive that uses")
  110. term.setCursorPos(1,2)
  111. term.write("the power of heat to incinerate an entire area")
  112. term.setCursorPos(1,4)
  113. term.write("**Will produce significant block damage!**")
  114.  
  115. term.setCursorPos(1,6)
  116. term.write("Have Target Co-ordinates been set in Silo 2")
  117. term.setCursorPos(1,7)
  118. term.write("Launch Controller? (y/n)")
  119. term.setCursorPos(1,8)
  120. local input1 = read()
  121. if input1 == "y" then
  122. silo2launch()
  123. else if input1 == "n" then
  124. term.setTextColor(colors.red)
  125. term.write("Please set co-ordinates and return.")
  126. sleep(3)
  127. term.setTextColor(colors.white)
  128. default()
  129. else
  130. term.setTextColor(colors.red)
  131. term.write("Invalid Choice")
  132. term.setTextColor(colors.white)
  133. sleep(1)
  134. silo2confirm()
  135. end
  136. end
  137. end
  138.  
  139. function silo2launch()
  140. term.clear()
  141. term.setCursorPos(1,1)
  142. term.write("Confirming...")
  143. sleep(1)
  144. term.setCursorPos(1,2)
  145. term.setTextColor(colors.green)
  146. term.write("Missile Online.")
  147. sleep(1)
  148. term.setTextColor(colors.white)
  149. term.setCursorPos(1,4)
  150. term.write("Enter Launch Code:")
  151. term.setCursorPos(1,5)
  152. local input2 = read("*")
  153. if input2 == "000000" then
  154. term.setTextColor(colors.green)
  155. term.write("Confirmed. Launching Missile 2...")
  156. term.setTextColor(colors.white)
  157. rednet.open("back")
  158. rednet.broadcast("launch2000000")
  159. sleep(4)
  160. default()
  161. else
  162. term.setTextColor(colors.red)
  163. term.setCursorPos(1,6)
  164. term.write("Invalid Code")
  165. sleep(1)
  166. term.setCursorPos(1,7)
  167. term.write("Disarming Missile...")
  168. term.setTextColor(colors.white)
  169. sleep(2)
  170. default()
  171. end
  172. end
  173.  
  174.  
  175.  
  176.  
  177. function silo3confirm()
  178. term.clear()
  179.  
  180. term.setCursorPos(1,1)
  181. term.write("Incendiary Missiles light target area on fire.")
  182. term.setCursorPos(1,2)
  183. term.write("No block damage will be caused. ")
  184.  
  185. term.setCursorPos(1,4)
  186. term.write("Have Target Co-ordinates been set in Silo 3")
  187. term.setCursorPos(1,5)
  188. term.write("Launch Controller? (y/n)")
  189. term.setCursorPos(1,6)
  190. local input1 = read()
  191. if input1 == "y" then
  192. silo3launch()
  193. else if input1 == "n" then
  194. term.setTextColor(colors.red)
  195. term.write("Please set co-ordinates and return.")
  196. sleep(3)
  197. term.setTextColor(colors.white)
  198. default()
  199. else
  200. term.setTextColor(colors.red)
  201. term.write("Invalid Choice")
  202. term.setTextColor(colors.white)
  203. sleep(1)
  204. silo3confirm()
  205. end
  206. end
  207. end
  208.  
  209. function silo3launch()
  210. term.clear()
  211. term.setCursorPos(1,1)
  212. term.write("Confirming...")
  213. sleep(1)
  214. term.setCursorPos(1,2)
  215. term.setTextColor(colors.green)
  216. term.write("Missile Online.")
  217. sleep(1)
  218. term.setTextColor(colors.white)
  219. term.setCursorPos(1,4)
  220. term.write("Enter Launch Code:")
  221. term.setCursorPos(1,5)
  222. local input2 = read("*")
  223. if input2 == "000000" then
  224. term.setTextColor(colors.green)
  225. term.write("Confirmed. Launching Missile 3...")
  226. term.setTextColor(colors.white)
  227. rednet.open("back")
  228. rednet.broadcast("launch3000000")
  229. sleep(4)
  230. default()
  231. else
  232. term.setTextColor(colors.red)
  233. term.setCursorPos(1,6)
  234. term.write("Invalid Code")
  235. sleep(1)
  236. term.setCursorPos(1,7)
  237. term.write("Disarming Missile...")
  238. term.setTextColor(colors.white)
  239. sleep(2)
  240. default()
  241. end
  242. end
  243.  
  244.  
  245.  
  246.  
  247. function silo4confirm()
  248. term.clear()
  249.  
  250. term.setCursorPos(1,1)
  251. term.write("Place any T3 or below missile in silo to launch.")
  252.  
  253. term.setCursorPos(1,3)
  254. term.write("Have Target Co-ordinates been set in Silo 4")
  255. term.setCursorPos(1,4)
  256. term.write("Launch Controller? (y/n)")
  257. term.setCursorPos(1,5)
  258. local input1 = read()
  259. if input1 == "y" then
  260. silo4launch()
  261. else if input1 == "n" then
  262. term.setTextColor(colors.red)
  263. term.write("Please set co-ordinates and return.")
  264. sleep(3)
  265. term.setTextColor(colors.white)
  266. default()
  267. else
  268. term.setTextColor(colors.red)
  269. term.write("Invalid Choice")
  270. term.setTextColor(colors.white)
  271. sleep(1)
  272. silo4confirm()
  273. end
  274. end
  275. end
  276.  
  277. function silo4launch()
  278. term.clear()
  279. term.setCursorPos(1,1)
  280. term.write("Confirming...")
  281. sleep(1)
  282. term.setCursorPos(1,2)
  283. term.setTextColor(colors.green)
  284. term.write("Missile Online.")
  285. sleep(1)
  286. term.setTextColor(colors.white)
  287. term.setCursorPos(1,4)
  288. term.write("Enter Launch Code:")
  289. term.setCursorPos(1,5)
  290. local input2 = read("*")
  291. if input2 == "000000" then
  292. term.setTextColor(colors.green)
  293. term.write("Confirmed. Launching Missile 4...")
  294. term.setTextColor(colors.white)
  295. rednet.open("back")
  296. rednet.broadcast("launch4000000")
  297. sleep(4)
  298. default()
  299. else
  300. term.setTextColor(colors.red)
  301. term.setCursorPos(1,6)
  302. term.write("Invalid Code")
  303. sleep(1)
  304. term.setCursorPos(1,7)
  305. term.write("Disarming Missile...")
  306. term.setTextColor(colors.white)
  307. sleep(2)
  308. default()
  309. end
  310. end
  311.  
  312.  
  313.  
  314. default()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement