Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.wrap("back")
- illuminators = {}
- for i = 0,255 do
- local l = peripheral.wrap("glowstone_illuminator_"..tostring(i))
- table.insert(illuminators,l)
- end
- local index = function(x,y)
- if x%2 == 1 then
- return 16*(x-1)+(16-y)+1
- else
- return 16*(x-1)+y
- end
- end
- local display = function(image)
- for r = 1,16 do
- for c = 1,16 do
- illuminators[index(c,r)].setColor(tonumber(image[r]:sub(1+8*(c-1),8+8*(c-1)),16))
- end
- end
- end
- -- Returns HEX representation of num
- -- posted in snipplr.com by ukpyr
- function num2hex(num)
- local hexstr = '0123456789abcdef'
- local s = ''
- while num > 0 do
- local mod = math.fmod(num, 16)
- s = string.sub(hexstr, mod+1, mod+1) .. s
- num = math.floor(num / 16)
- end
- if s == '' then s = '00' end
- if #s < 2 then s = '0'..s end
- return s
- end
- local loadimg = function(name)
- img = {}
- local f = fs.open(name..".txt","r")
- line = f.readLine()
- while line ~= nil do
- table.insert(img,line)
- line = f.readLine()
- end
- f.close()
- return img
- end
- fader = {}
- local run = function(self,steps,dt)
- for i = 1,steps do
- local current = {}
- for r = 1,16 do
- line = ""
- for c = 1,16 do
- local s_px = self.start[r]:sub(1+8*(c-1),8+8*(c-1))
- local e_px = self.final[r]:sub(1+8*(c-1),8+8*(c-1))
- local s_r, s_g, s_b = tonumber(s_px:sub(3,4),16), tonumber(s_px:sub(5,6),16), tonumber(s_px:sub(7,8),16)
- local e_r, e_g, e_b = tonumber(e_px:sub(3,4),16), tonumber(e_px:sub(5,6),16), tonumber(e_px:sub(7,8),16)
- local d_r = ((e_r-s_r)/(steps-1))*(i-1)
- local d_g = ((e_g-s_g)/(steps-1))*(i-1)
- local d_b = ((e_b-s_b)/(steps-1))*(i-1)
- local c_r, c_g, c_b = s_r + d_r, s_g + d_g, s_b + d_b
- line = line.."0x"..num2hex(c_r)..num2hex(c_g)..num2hex(c_b)
- end
- table.insert(current,line)
- end
- display(current)
- sleep(dt)
- end
- end
- fader.run = run
- images = {}
- table.insert(images,loadimg("sFTBlogo"))
- table.insert(images,loadimg("pickaxe_diamond"))
- table.insert(images,loadimg("compcraft"))
- table.insert(images,loadimg("mobcreeper"))
- table.insert(images,loadimg("mobskeleton"))
- table.insert(images,loadimg("mobpigman"))
- table.insert(images,loadimg("mobzombie"))
- table.insert(images,loadimg("endereye"))
- table.insert(images,loadimg("furnace"))
- banner = {}
- for i=1,29 do
- table.insert(banner,loadimg("banner"..tostring(i)))
- end
- display(banner[29])
- os.pullEvent("redstone")
- sleep(0.7)
- display(images[1])
- sleep(2)
- for i = 1,#images-1 do
- fader.start = images[i]
- fader.final = images[i+1]
- fader:run(12,0.1)
- sleep(1)
- end
- fader.start = fader.final
- fader.final = banner[1]
- fader:run(12,0.1)
- for i = 2,29 do
- display(banner[i])
- sleep(0.15)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement