Advertisement
jaklsfjlsak

护盾红石开关 (配套设置)

Jul 12th, 2023
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local shield = peripheral.find("warpdriveForceFieldProjector")
  2. local state = true
  3.  
  4. -- initial message
  5. print("Redstone Control Online, Press C to Configure")
  6.  
  7. while true do
  8.     os.sleep(0.5)
  9.     local event = os.pullEvent()
  10.     if event == "redstone" then
  11.         if state == true then
  12.             shield.enable(true)
  13.             state = false
  14.         else
  15.             shield.enable(false)
  16.             state = true
  17.         end
  18.     elseif event == "key" then
  19.         local _, key = os.pullEvent("key")
  20.         -- keys are represented by numbers, the number for 'C' is 46
  21.         if key == 46 then
  22.             print("C key pressed, running 'conf' script...")
  23.             shell.run("conf")
  24.         end
  25.     end
  26. end
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement