Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hologram = peripheral.find("hologram")
- local date
- local config = {
- dateColor = 0xFFFFFF,
- holoScale = 2
- }
- local symbols = {
- ["0"] = {
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- ["1"] = {
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- },
- ["2"] = {
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 0 },
- { 0, 1, 1, 1, 0 },
- },
- ["3"] = {
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- ["4"] = {
- { 0, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- },
- ["5"] = {
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 0 },
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- ["6"] = {
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 0 },
- { 1, 0, 0, 0, 0 },
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- ["7"] = {
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 0 },
- },
- ["8"] = {
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- ["9"] = {
- { 0, 1, 1, 1, 0 },
- { 1, 0, 0, 0, 1 },
- { 1, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- { 0, 0, 0, 0, 1 },
- { 0, 0, 0, 0, 1 },
- { 0, 1, 1, 1, 0 },
- },
- [":"] = {
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 1, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 1, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- },
- ["."] = {
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0 },
- { 0, 0, 1, 0, 0 },
- }
- }
- local function drawSymbolOnProjector(x, y, z, symbol)
- local xPos = x
- for j = 1, #symbols[symbol] do
- for i = 1, #symbols[symbol][j] do
- if symbols[symbol][j][i] == 1 then
- hologram.set(xPos, y, z, 1)
- else
- hologram.set(xPos, y, z, 0)
- end
- xPos = xPos + 1
- end
- xPos = x
- y = y - 1
- end
- end
- local function drawText(x, y, text)
- for i = 1, string.len(text) do
- local symbol = string.sub(text, i, i)
- drawSymbolOnProjector(i * 6 + 4, 16, 24, symbol)
- end
- end
- local function centerText(text)
- local textWidth = string.len(text) * 6
- local holoWidth = 48
- drawText(math.floor(textWidth - (holoWidth / 2)), 1, text)
- end
- hologram.clear()
- hologram.setTranslation(0, 0, 0)
- hologram.setPaletteColor(1, config.dateColor)
- hologram.setScale(config.holoScale)
- while true do
- local time = os.time()
- local hour = math.floor(time)
- local min = math.floor((time - hour) * 60)
- centerText(("%02d:%02d"):format(hour, min))
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement