mr_arte

BII_C.lua

Jun 6th, 2022 (edited)
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1. --[[
  2.     * BII_C Weichenmanager
  3.     * Personen-Cargo-Verteil-Programm
  4.     * FOR Minecraft-Mod: cc-tweaked-1.18.2-1.100.4
  5.     * in LUA
  6.     * © Robin Nahrstedt 2022
  7. ]]
  8.  
  9. -- ##### Variablen #####
  10. strecke_sc = 0
  11. strecke_af = 0
  12. strecke_ef = 0
  13.  
  14. -- ##### Funktionen #####
  15.  
  16.  
  17.  
  18. -- ##### Hauptprogramm #####
  19. rednet.open("top")
  20.  
  21. while true do
  22.     id, message = rednet.receive(nil,1)
  23.     if not id then
  24.         sleep(0.1)
  25.     else
  26.         print("ID: ", id)
  27.         print("Nachricht", message)
  28.     end
  29.  
  30.     if redstone.getInput("right") and strecke_af == 0 then
  31.         strecke_af = 1
  32.         print("right, 0")
  33.         -- rednet.send(PC, "0")
  34.     elseif redstone.getInput("right") and strecke_af == 1 then
  35.         strecke_af = 0
  36.         print("right, 1")
  37.         -- rednet.send(PC, "1")
  38.     end
  39.  
  40.     if redstone.getInput("back") and strecke_sc == 0 then
  41.         strecke_sc = 1
  42.         print("left, 0")
  43.     elseif redstone.getInput("back") and strecke_sc == 1 then
  44.         strecke_sc = 0
  45.         print("left, 1")
  46.     end
  47.  
  48.     if strecke_sc == 1 then
  49.         redstone.setOutput("left", false)
  50.     elseif strecke_sc == 0 then
  51.         redstone.setOutput("left", true)
  52.     end
  53.  
  54.     if message == 1 then
  55.         redstone.setOutput("bottom", false)
  56.     elseif message == 0 then
  57.         redstone.setOutput("bottom", true)
  58.     end
  59.     sleep(0.1)
  60. end
Advertisement
Add Comment
Please, Sign In to add comment