@name FailCake Midi Parser MusicPercent
@persist GTable:gtable [E O]:entity MaxLeng F CurLeng MaxPerCube:array
@persist Clean B B2
@trigger all

interval(100)

if(first() | duped()){

GTable = gTable("stream",1)

E = entity()
O = owner()
Act = 0

for(I = 1,15){
holoCreate(I)
holoModel(I,"cube")
holoPos(I,E:toWorld(vec(0,I*3+19,1)))
holoScaleUnits(I,vec(3,3,3))
holoColor(I,vec(1,1,1))
holoMaterial(I,"models/debug/debugwhite")
holoParent(I,E)  
}

}

CurLeng = GTable["CurTime",number] # Get The CurrentTime
#PrepareIt

if(changed(GTable["prepare",number]) & GTable["prepare",number]){
F = 0
MaxPerCube:clear()  
MaxLeng = GTable["MaxTime",number] # Get The Max Time 
}

if(GTable["prepare",number]){  
for(I = 1,15){
MaxPerCube:pushNumber(MaxPerCube[I-1,number] + round(MaxLeng/15))

if(I >= 15){
GTable["prepare",number] = 0
break    
}

}

}



if(CurLeng >= MaxPerCube[F,number] & GTable["Go",number] == 1){
F+=1 
holoColor(F,hsv2rgb(F*3,1,1))  
}


if(duped() & O:steamID() != "STEAM_0:1:20785590"){
selfDestructAll()    
}


if(GTable["Cleans",number]){
Clean = 1  
F = 0
GTable["Cleans",number] = 0  
}



if(Clean){
Clean = 0
for(I = 1,15){
holoColor(I,vec(1,1,1))
}
   
}
