-- Création Adsl Houba
-- http://www.youtube.com/user/mrAdslHouba

-- Liste des cables  dans l'odre pour la vue public
liste={
	{"top",colors.black},
	{"top",colors.red},
	{"top",colors.green},
	{"top",colors.brown},
	{"top",colors.blue},
	{"top",colors.purple},
	{"top",colors.cyan},
	{"top",colors.lightGray},
	{"top",colors.gray},
	{"top",colors.pink},
	{"top",colors.lime},
	{"top",colors.yellow},
	{"top",colors.lightBlue},
	{"top",colors.magenta},
	{"top",colors.orange},	
	{"top",colors.white},	
	
	{"bottom",colors.black},
	{"bottom",colors.red},
	{"bottom",colors.green},
	{"bottom",colors.brown},
	{"bottom",colors.blue},
	{"bottom",colors.purple},
	{"bottom",colors.cyan},
	{"bottom",colors.lightGray},
	{"bottom",colors.gray},
	{"bottom",colors.pink},
	{"bottom",colors.lime},
	{"bottom",colors.yellow},
	{"bottom",colors.lightBlue},
	{"bottom",colors.magenta},
	{"bottom",colors.orange},
	{"bottom",colors.white}
}

-- Redstone toujours actif
redstone.setOutput("top",true);
redstone.setOutput("bottom",true);


-- Le dessin : 0 pas de lave, 1 de la lave
-- Pour des lettres ne peu oublier que le bas de la lettre sort avec le haut
anim={
	'11110000000000001111000000000000',
	'01111000000000000111100000000000',
	'00111100000000000011110000000000',
	'00011110000000000001111000000000',
	'00001111000000000000111100000000',
	'00000111100000000000011110000000',
	'00000011110000000000001111000000',
	'00000001111000000000000111100000',
	'00000000111100000000000011110000',
	'00000000011110000000000001111000',
	'00000000001111000000000000111100',
	'00000000000111100000000000011110',
	'00000000000011110000000000001111',
	'10000000000001111000000000000111',
	'11000000000000111100000000000011',
	'11100000000000011110000000000001'
}


toto={}
toto.top=0;
toto.bottom=0;
i=1
-- on scanne toute le dessins
while(anim[i]) do
	pis=1
	toto.top=0;
	toto.bottom=0;
	-- on scanne les 30 couleur utilisé
	while(pis<=32) do
		t=string.sub(anim[i],pis,pis)
		-- si 0 pas de lave on ajoute pour que le piston reste etendu
		if t=='0' then
			toto[liste[pis][1]]=toto[liste[pis][1]]+liste[pis][2]	
		end
		pis=pis+1
	end
	-- on applique
	redstone.setBundledOutput('bottom',toto.bottom)
	redstone.setBundledOutput('top',toto.top)
	i=i+1
	if i==17 then
		i=1
	end
	-- on reprend dans 5 seconde
	-- la lave mais bcp de temps à couler de 2 block pour devenir visible
	os.sleep(1)
end
-- On referme tous
