Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Elevator Control Program
- -- Meant to be used in Minecraft with the ComputerCraft and Create mods
- locationLighthouse = false -- If true, the elevator is in the lighthouse.
- locationLobby = false -- If true, the elevator is in the lobby.
- locationMoving = false -- If true, the elevator is moving.
- -- Top: In-Elevator Toggle Button (Redstone Link)
- -- Bottom: Gearshift
- -- Left: Lighthouse Call Button (Redstone Link)
- -- Right: Lobby Call Button (Redstone Link)
- -- Front: Lighthouse Redstone Contact (Redstone Link)
- -- Back: Lobby Redstone Contact (Redstone Link)
- print("ELEVATOR CONTROL PROGRAM")
- while true do
- local event = os.pullEventRaw()
- if event == "terminate" then
- print("Alrighty, going into maintenance mode!")
- reboot()
- elseif event == "redstone" then
- print("Caught redstone event!")
- else
- os.pullEvent("redstone") -- wait until we get a redstone event
- end
- if locationMoving == true then
- if rs.getInput("front") == true then
- sleep(30) -- Ensure that all elevator passengers have time to exit the elevator
- locationMoving = false
- locationLighthouse = true
- elseif rs.getInput("back") == true then
- sleep(30) -- Ensure that all elevator passengers have time to exit the elevator
- locationMoving = false
- locationLobby = true
- end
- else
- if rs.getInput("left") == true then
- if locationLobby == true then
- locationMoving = true
- locationLobby = false
- rs.setOutput("bottom", not rs.getOutput("bottom"))
- end
- elseif rs.getInput("right") == true then
- if locationLighthouse == true then
- locationMoving = true
- locationLighthouse = false
- rs.setOutput("bottom", not rs.getOutput("bottom"))
- end
- elseif rs.getInput("top") == true then
- if locationLighthouse == true then
- locationMoving = true
- locationLighthouse = false
- elseif locationLobby == true then
- locationMoving = true
- locationLobby = false
- end
- rs.setOutput("bottom", not rs.getOutput("bottom"))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment