Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- settings.load()
- local contact_side = settings.get("elevator.contactSide")
- local door_side = settings.get("elevator.doorSide")
- local sensor_side = settings.get("elevator.sensorSide")
- local is_person_waiting = false
- while true do
- os.pullEvent("redstone")
- print("########")
- local sensor_input = redstone.getInput(sensor_side)
- if sensor_input and sensor_input ~= is_person_waiting then
- is_person_waiting = true
- print("person is waiting - calling elevator")
- redstone.setOutput(contact_side, true)
- sleep(0.2)
- redstone.setOutput(contact_side, false)
- sleep(0.4)
- elseif not sensor_input then
- is_person_waiting = false
- end
- local contact_input = redstone.getInput(contact_side)
- if contact_input then
- print("elevator is here - opening doors")
- redstone.setOutput(door_side, true)
- else
- print("elevator is not here - closing doors")
- redstone.setOutput(door_side, false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement