Advertisement
RedoverPlayer

Tardis Main 2

Apr 1st, 2020 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.54 KB | None | 0 0
  1. p = peripheral.wrap("back")
  2. monitor = peripheral.wrap("monitor_1")
  3. monitor.setTextScale(0.5)
  4. monitor.clear()
  5. monitor.setCursorPos(1,1)
  6. s = peripheral.wrap("speaker_0")
  7. c = 0
  8. t = 0
  9. hads = 1
  10. eject = 0
  11. components = 1
  12. importantComponents = 1
  13. modem = peripheral.wrap("bottom")
  14.  
  15. tardisTabletId = 5
  16. tardisHomex = -150
  17. tardisHomey = 72
  18. tardisHomez = 245
  19. tardisHomeDimensionID = 0
  20.  
  21. fuelingstate = false
  22.  
  23. function tardis()
  24. if p.isInFlight() then
  25.         redstone.setOutput("left",false)
  26.         redstone.setOutput("right",true)
  27.         if p.isDoorsOpened() == true then
  28.             if eject == 0 then
  29.                 p.setDoors(false)
  30.             else
  31.                 p.setDoors(true)
  32.             end
  33.         end
  34.  
  35.     monitor.setCursorPos(1,1)
  36.     monitor.write("Tardis Status : In Flight")
  37.     monitor.setCursorPos(1,1)
  38.     monitor.setCursorPos(1,2)
  39.     monitor.write("Tardis fuel : ".. p.getArtron())
  40.     monitor.setCursorPos(18,2)
  41.     monitor.write("/256                        ")
  42.  
  43. else
  44.  
  45.     redstone.setOutput("left",true)
  46.     redstone.setOutput("right",false)
  47.     monitor.setCursorPos(1,1)
  48.     monitor.write("Tardis Status : Landed    ")
  49.     monitor.setCursorPos(1,1)  
  50.        
  51.         if p.getArtron() == 256 then
  52.             if fuelingstate == true then
  53.                 p.setFueling(false)
  54.                 fuelingstate = false
  55.             end
  56.  
  57.             monitor.setCursorPos(1,2)
  58.             monitor.write("Tardis fuel : 256/256               ")
  59.             monitor.setCursorPos(1,2)
  60.              
  61.         else
  62.             if fuelingstate == false then
  63.                 p.setFueling(true)
  64.                 fuelingstate = true
  65.             end
  66.  
  67.             monitor.setCursorPos(1,2)
  68.             monitor.write("Tardis is now fueling "..p.getArtron())
  69.             monitor.setCursorPos(26,2)
  70.             monitor.write("/256                     ")
  71.                              
  72.           end  
  73.                                                
  74.     end    
  75.          
  76.             if p.getHealthComponent(0) < 0.40 then
  77.                 monitor.setCursorPos(1,8)
  78.                 monitor.write("Components Damaged ! " .. p.getSystemName(0))
  79.                 components = 0              
  80.  
  81.             elseif p.getHealthComponent(1) < 0.40 then
  82.                 monitor.setCursorPos(1,8)
  83.                 monitor.write("Components Damaged ! " .. p.getSystemName(1))
  84.                 components = 0
  85.  
  86.             elseif p.getHealthComponent(2) < 0.40 then
  87.                 monitor.setCursorPos(1,8)
  88.                 monitor.write("Components Damaged ! " .. p.getSystemName(2))
  89.                 components = 0
  90.  
  91.             elseif p.getHealthComponent(3) < 0.40 then
  92.                 monitor.setCursorPos(1,8)
  93.                 monitor.write("Components Damaged ! " .. p.getSystemName(3))
  94.                 components = 0
  95.  
  96.             elseif p.getHealthComponent(4) < 0.40 then
  97.                 monitor.setCursorPos(1,8)
  98.                 monitor.write("Components Damaged ! " .. p.getSystemName(4))
  99.                 components = 0
  100.  
  101.             elseif p.getHealthComponent(5) < 0.40 then
  102.                 monitor.setCursorPos(1,8)
  103.                 monitor.write("Components Damaged ! " .. p.getSystemName(5))
  104.                 components = 0
  105.  
  106.             elseif p.getHealthComponent(6) < 0.40 then
  107.                 monitor.setCursorPos(1,8)
  108.                 monitor.write("Components Damaged ! " .. p.getSystemName(6))
  109.                 components = 0
  110.  
  111.             elseif p.getHealthComponent(7) < 0.40 then
  112.                 monitor.setCursorPos(1,8)
  113.                 monitor.write("Components Damaged ! " .. p.getSystemName(7))
  114.                 components = 0
  115.  
  116.             elseif p.getHealthComponent(8) < 0.40 then
  117.                 monitor.setCursorPos(1,8)
  118.                 monitor.write("Components Damaged ! " .. p.getSystemName(8))
  119.                 components = 0
  120.  
  121.             else
  122.                 monitor.setCursorPos(1,8)
  123.                 monitor.write("                                                ")
  124.                 components = 1
  125.                 importantComponents = 1
  126.             end
  127.  
  128.             if components == 0 then
  129.                 s.playNote("Bell", 2, 0.5)
  130.                 sleep(1)
  131.             end                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  132.      
  133.     if p.getDimension() ~= 0 then
  134.         t = t + 1
  135.     else
  136.         t = 0
  137.     end
  138.        
  139.     if hads == 1 then                                                                                                                                                                                                        
  140.     if t > 3000 then
  141.         if p.isInFlight() == false then
  142.             if p.getArtron() == 256 then
  143.                 monitor.setCursorPos(1,5)
  144.                 monitor.write("This is security protocol 712")
  145.                 monitor.setCursorPos(1,6)
  146.                 monitor.write("The echelon circuit has been activated")
  147.                 monitor.setCursorPos(1,7)
  148.                 monitor.write("Please stow any hand luggage and prepare for departure")
  149.                 p.setDoors(false)
  150.                 p.setTardisDestination(tardisHomex,tardisHomey,tardisHomez,tardisHomeDimensionID)
  151.                 p.startFlight()
  152.                 sleep(20)
  153.                 t = 0
  154.                 monitor.clear()
  155.             end
  156.         end
  157.     end
  158.     end
  159.  
  160.  
  161.     monitor.setCursorPos(1,3)
  162.     x,y,z = p.getTardisPos()
  163.     monitor.write("Tardis location : "..x.." "..y.." "..z.."             ")
  164.     monitor.setCursorPos(1,4)
  165.     monitor.write("Travel time : "..p.getTravelTime().."         ")
  166.  
  167.     modem.open(2)
  168.     local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  169.     if message == "open" then
  170.         p.setDoors(true)
  171.         modem.transmit(3, 1, "Doors opened")
  172.  
  173.     elseif message == "close" then
  174.         p.setDoors(false)
  175.         modem.transmit(3, 1, "Doors closed")
  176.  
  177.     elseif message == "hads off" then
  178.         hads = 0
  179.         modem.transmit(3, 1, "HADS off")
  180.  
  181.     elseif message == "hads on" then
  182.         hads = 1
  183.         modem.transmit(3, 1, "HADS on")
  184.  
  185.     elseif message == "home" then
  186.         if importantComponents == 1 then
  187.             if p.isInFlight() == false then
  188.                 if p.getArtron() == 256 then
  189.                     modem.transmit(3, 1, "Takeoff !")  
  190.                     p.setDoors(false)
  191.                     p.setTardisDestination(tardisHomex,tardisHomey,tardisHomez,tardisHomeDimensionID)
  192.                     p.startFlight()
  193.                 else
  194.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")    
  195.                 end
  196.             else
  197.                 modem.transmit(3, 1, "The tardis is already in flight !")
  198.             end
  199.         else
  200.             modem.transmit(3, 1, "Components health too low")    
  201.         end
  202.  
  203.     elseif message == "nether" then
  204.         if importantComponents == 1 then
  205.             if p.isInFlight() == false then
  206.                 if p.getArtron() == 256 then
  207.                     modem.transmit(3, 1, "Takeoff !")  
  208.                     p.setDoors(false)
  209.                     p.setTardisDestination(-196,82,192,-1)
  210.                     p.startFlight()
  211.                 else
  212.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")    
  213.                 end
  214.             else
  215.                 modem.transmit(3, 1, "The tardis is already in flight !")
  216.             end
  217.         else
  218.             modem.transmit(3, 1, "Components health too low")    
  219.         end
  220.  
  221.     elseif message == "ender" then
  222.         if importantComponents == 1 then
  223.             if p.isInFlight() == false then
  224.                 if p.getArtron() == 256 then
  225.                     modem.transmit(3, 1, "Takeoff !")  
  226.                     p.setDoors(false)
  227.                     p.setTardisDestination(-22,59,-10,1)
  228.                     p.startFlight()
  229.                 else
  230.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")    
  231.                 end
  232.             else
  233.                 modem.transmit(3, 1, "The tardis is already in flight !")
  234.             end
  235.         else
  236.             modem.transmit(3, 1, "Components health too low")    
  237.         end
  238.  
  239.     elseif message == "base2" then
  240.         if importantComponents == 1 then
  241.             if p.isInFlight() == false then
  242.                 if p.getArtron() == 256 then
  243.                     modem.transmit(3, 1, "Takeoff !")  
  244.                     p.setDoors(false)
  245.                     p.setTardisDestination(-910,59,233,0)
  246.                     p.startFlight()
  247.                 else
  248.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")    
  249.                 end
  250.             else
  251.                 modem.transmit(3, 1, "The tardis is already in flight !")
  252.             end
  253.         else
  254.             modem.transmit(3, 1, "Components health too low")    
  255.         end
  256.  
  257.     elseif message == "farm" then
  258.         if importantComponents == 1 then
  259.             if p.isInFlight() == false then
  260.                 if p.getArtron() == 256 then
  261.                     modem.transmit(3, 1, "Takeoff !")  
  262.                     p.setDoors(false)
  263.                     p.setTardisDestination(-549,76,224,0)
  264.                     p.startFlight()
  265.                 else
  266.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")    
  267.                 end
  268.             else
  269.                 modem.transmit(3, 1, "The tardis is already in flight !")
  270.             end
  271.         else
  272.             modem.transmit(3, 1, "Components health too low")    
  273.         end
  274.  
  275.     elseif message == "eject" then      
  276.         if importantComponents == 1 then
  277.             if p.isInFlight() == false then
  278.                 if p.getArtron() == 256 then
  279.                     p.setDoors(true)
  280.                     modem.transmit(3, 1, "Takeoff !")
  281.                     p.setDoors(true)
  282.                     p.setTardisDestination(tardisHomex,tardisHomey,tardisHomez,tardisHomeDimensionID)
  283.                     eject = 1
  284.                     p.startFlight()
  285.                     sleep(12)
  286.                     eject = 0
  287.                     p.setDoors(false)
  288.                 else
  289.                     modem.transmit(3, 1, "The tardis doesn't have enough fuel")
  290.                 end
  291.             else
  292.                 modem.transmit(3, 1, "The tardis is already in flight !")
  293.             end
  294.         else
  295.             modem.transmit(3, 1, "Components health too low")
  296.         end
  297.     end
  298. end
  299.  
  300.  
  301. while true do
  302.     tardis()
  303. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement