SHARE
TWEET

ICBM-missile-launcher

LuaCrawler Mar 5th, 2014 214 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[ Wireless ICBM missile launcher by LuaCrawler
  2.  
  3. YOU MUST CHANGE THE FILE NAME TO STARTUP FOR AUTOMATIC BOOT ON A COMPUTER!!
  4.                                  -------
  5.  
  6.  -----     ____     |---\   |----
  7. /        /      \   |    |  |
  8. \        \      /   |    |  |====
  9.  -----     ----     |___/   |____
  10.  
  11.  ]]
  12. -- License
  13. --[[
  14. ICBM missile launcher. Remotely launches missiles from the ICBM mod for Minecraft.
  15. Copyright (C) 2014  LuaCrawler
  16.  
  17. This program is free software: you can redistribute it and/or modify
  18. it under the terms of the GNU General Public License as published by
  19. the Free Software Foundation, either version 3 of the License, or
  20. any later version.
  21.  
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  25. GNU General Public License for more details.
  26.  
  27. You should have received a copy of the GNU General Public License
  28. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  29. ]]
  30.  
  31. -- Variables
  32. local modem = peripheral.wrap("top")
  33. local cName
  34. local file = fs.exists("etc/ID/cName.txt")
  35. local f = fs.open("etc/ID/cName.txt", "r")
  36. local rChannel = tonumber(os.getComputerID())
  37. local sChan = 11
  38. local icbm = peripheral.wrap("left")
  39. local function startup()
  40.     term.clear()
  41.     term.setCursorPos(1,1)
  42.     print("Launch handler console:")
  43.     if file == false then
  44.         fs.makeDir("etc/ID")
  45.         h = fs.open("etc/ID/cName.txt", "w")
  46.         print("Give a name/ID for the launcher:")
  47.         cName = tostring(read())
  48.         h.write( cName )
  49.         os.setComputerLabel( cName )
  50.         h.close()
  51.         modem.transmit(sChan, rChannel, cName )
  52.         sleep(3)
  53.         term.clearLine() --Unneeded line... I think...
  54.     elseif file == true then
  55.         print(tostring(f.readAll()))
  56.         print("Transmitted ID to server")
  57.         modem.transmit(sChan, rChannel, cName)
  58.     else
  59.         print("could not send ID")
  60.     end
  61. end
  62.  
  63.  
  64. startup()
  65.  
  66. while true do
  67.   modem.open(rChannel)
  68.   local evt, p1, p2, p3, p4, p5 = os.pullEvent("modem_message")
  69.   if p4 == "launch" then
  70.     term.setTextColor(colors.red)
  71.     icbm.launch()
  72.   else
  73.     break
  74.   end
  75. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top