mr_arte

weiche_mine.lua

May 14th, 2022 (edited)
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.26 KB | None | 0 0
  1. -- ##################### Variablen #####################
  2. mon = peripheral.wrap("top")
  3.  
  4.  
  5.  
  6. -- ##################### START Funktionen
  7. function destination( ... )
  8.     mon.clear()
  9.     mon.setTextScale("2")
  10.     mon.setBackgroundcolor(color)
  11.     mon.setCursorPos("1,1")
  12.     mon.write(dest)
  13. end
  14.  
  15.  
  16.  
  17.  
  18. -- ##################### START Hauptprogramm
  19.  
  20. while true do
  21.  
  22.     redstone.setOutput("back", true) -- Cargolinie aktiv
  23.     redstone.setOutput("right", false)
  24.     redstone.setOutput("left", false)
  25.    
  26.     mon.setBackgroundcolor(colours.red)
  27.     mon.setTextScale(1)
  28.     mon.clear()
  29.    
  30.     mon.setCursorPos(1,1)
  31.     mon.write("Base")
  32.     mon.setCursorPos(2,2)
  33.     mon.write("III")
  34.     mon.setCursorPos(2,4)
  35.     mon.write("<--")
  36.  
  37.     for i = 5,0,-1 do
  38.         mon.setCursorPos(6,i)
  39.         mon.write("|")
  40.     end
  41.  
  42.     mon.setCursorPos(8,1)
  43.     mon.write("Base")
  44.     mon.setCursorPos(9,2)
  45.     mon.write("II")
  46.     mon.setCursorPos(9,4)
  47.     mon.write("<--")
  48.    
  49.     for foo = 5,0,-1 do
  50.         mon.setCursorPos(12,foo)
  51.         mon.write("|")
  52.     end
  53.  
  54.     mon.setCursorPos(14,1)
  55.     mon.write("Cargo")
  56.     mon.setCursorPos(15,4)
  57.     mon.write("-->")
  58.  
  59.     local event, side, x, y = os.pullEvent()
  60.        
  61.     if event == "monitor_touch" then
  62.         if x <= 5 then -- Basecamp III
  63.             redstone.setOutput("back", false)
  64.             redstone.setOutput("right", true)
  65.             redstone.setOutput("left", false)
  66.             color = colours.green
  67.             dest1 = "Basecamp"
  68.             dest2 = "III"
  69.             destination()
  70.             sleep(5)
  71.  
  72.  
  73.         elseif x > 5 and x <= 10 then -- Basecamp II
  74.             redstone.setOutput("back", false)
  75.             redstone.setOutput("right", true)
  76.             redstone.setOutput("left", true)
  77.             color = colours.green
  78.             dest = "Basecamp"
  79.             destII  = "II"
  80.             destination()
  81.             sleep(5)
  82.  
  83.  
  84.         elseif x > 10 then -- Cargo
  85.             redstone.setOutput("back", true)
  86.             redstone.setOutput("right", false)
  87.             redstone.setOutput("left", false)
  88.             color = colours.red
  89.             dest1 = "Cargo"
  90.             dest2 = " "
  91.             destination()
  92.             sleep(5)
  93.  
  94.         end
  95.     end
  96.     sleep(0.1)
  97. end
  98.  
Add Comment
Please, Sign In to add comment