Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local teleinfo = {
- {"Noah Void Base", colors.blue},
- {"Elissa Void Base", colors.magenta},
- {"John Void Base", colors.white},
- {"Emily Void Base", colors.lime},
- {"End", colors.gray},
- {"Nether", colors.lightBlue},
- {"Quarry", colors.pink},
- {"Overworld", colors.lightGray},
- {"Hungry Node", colors.purple},
- }
- local yoffset = 2
- local mon = peripheral.wrap("right")
- local bc = "bottom"
- local y = nil
- local function newline() y=y+1; mon.setCursorPos(1, y) end
- local function flashBundled(color)
- rs.setBundledOutput(bc, color)
- sleep(.1)
- rs.setBundledOutput(bc, 0)
- end
- local lastTele = nil
- local function closeTele()
- lastTele = nil
- flashBundled(colors.orange)
- end
- local function redraw()
- mon.setCursorPos(1, 1)
- y = 1
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.clear()
- mon.write("Teleporter Dialer")
- newline()
- newline()
- for i,v in pairs(teleinfo) do
- if lastTele == i then
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(v[2])
- else
- mon.setTextColor(v[2])
- mon.setBackgroundColor(colors.black)
- end
- mon.write(" " .. i .. " " .. v[1])
- newline()
- end
- end
- -- returns true if the teleporter was opened
- local function teleporter(index)
- if not teleinfo[index] then
- closeTele()
- return false
- end
- print("Starting up " .. teleinfo[index][1])
- color = teleinfo[index][2]
- flashBundled(color)
- lastTele = index
- return true
- end
- local autocloseTimer = nil
- while true do
- redraw()
- local ev = {os.pullEvent()}
- if ev[1] == "monitor_touch" then
- if teleporter(ev[4] - yoffset) then
- autocloseTimer = os.startTimer(30)
- else
- autocloseTimer = nil
- end
- elseif ev[1] == "redstone" then
- autocloseTimer = os.startTimer(10)
- elseif ev[1] == "timer" then
- if ev[2] == autocloseTimer then
- closeTele()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement