Advertisement
cc-editor

Aufzug Türen

Feb 24th, 2025
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. settings.load()
  2.  
  3. local contact_side = settings.get("elevator.contactSide")
  4. local door_side = settings.get("elevator.doorSide")
  5. local sensor_side = settings.get("elevator.sensorSide")
  6.  
  7. local is_person_waiting = false
  8.  
  9. while true do
  10.     os.pullEvent("redstone")
  11.     print("########")
  12.  
  13.     local sensor_input = redstone.getInput(sensor_side)
  14.     if sensor_input and sensor_input ~= is_person_waiting then
  15.         is_person_waiting = true
  16.         print("person is waiting - calling elevator")
  17.         redstone.setOutput(contact_side, true)
  18.         sleep(0.2)
  19.         redstone.setOutput(contact_side, false)
  20.         sleep(0.4)
  21.     elseif not sensor_input then
  22.         is_person_waiting = false
  23.     end
  24.  
  25.     local contact_input = redstone.getInput(contact_side)
  26.     if contact_input then
  27.         print("elevator is here - opening doors")
  28.         redstone.setOutput(door_side, true)
  29.     else
  30.         print("elevator is not here - closing doors")
  31.         redstone.setOutput(door_side, false)
  32.     end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement