Skip to content

Instantly share code, notes, and snippets.

@LotuxPunk
Last active January 15, 2019 13:45
Show Gist options
  • Save LotuxPunk/6a45b7076c05d1bb15c690a9c4a38623 to your computer and use it in GitHub Desktop.
Save LotuxPunk/6a45b7076c05d1bb15c690a9c4a38623 to your computer and use it in GitHub Desktop.
Better than ever
--By LotuxPunk
--Variables
local y = 0
--Screen stuff
function resetScreen()
term.clear()
term.setTextColor(colors.cyan)
y = 0
end
--Peripheral
local t = peripheral.wrap("left")
--functions
function ableToFly()
return t.canFly() and t.getFuel() > 0.8 and t.getHull() == 1
end
function nextLine()
y = y + 1
term.setCursorPos(1,y)
end
function show(message)
nextLine()
term.write(message)
end
resetScreen()
while true do
show("# of waypoint")
nextLine()
local index = io.read()
index = tonumber(index)
local x, y, z, dim = t.getWaypoint(index - 1)
t.setTardisDestination(x,y,z,dim)
t.setDoors(false)
local able = ableToFly()
if not able then
show("Not enough fuel or hull, recharging and reparing...")
t.setFueling(true)
t.setRepairing(true)
while (not able) do
sleep(5)
end
end
t.startFlight()
local travelTime = t.getTravelTime()
show(travelTime.."s")
sleep(travelTime + 2)
while t.isInFlight() do
sleep(5)
end
t.setFueling(true)
show("Landed")
sleep(10)
resetScreen()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment