Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scheduleFromFile(path)
- local file = fs.open(path, "r")
- local body = file.readAll()
- file.close()
- return textutils.unserialize(body)
- end
- function scheduleFromStation()
- return peripheral.find("Create_Station").getSchedule()
- end
- local args = {...}
- local filePath = args[1]
- local schedule
- if filePath == nil then
- schedule = scheduleFromStation()
- else
- schedule = scheduleFromFile(filePath)
- end
- local color = schedule.color
- if color == nil then
- color = 2048
- end
- term.setTextColor(colors.white)
- term.setBackgroundColor(colors.black)
- term.clear()
- local i = 1
- for _, entry in ipairs(schedule.entries) do
- if entry.instruction.id == "create:destination" then
- local name = entry.instruction.data.text:gsub("%s%d+$", "")
- term.setCursorPos(4, i)
- term.write(name)
- i = i + 1
- end
- end
- term.setBackgroundColor(color)
- for j=1,i-1 do
- term.setCursorPos(2, j)
- term.write(" ")
- -- if j == 1 or j == i-1 then
- -- term.write("O")
- -- else
- -- term.write("|")
- -- end
- end
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1, i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement