@name Contraption Viewer
@inputs Up Down Left Right ResetPos Reset Mode Holo ExplodeScale
@outputs 
@persist NumLeft First:entity RA:array Loopy  Good  Scale ExplodeScale
@trigger all

interval(50)
if(first()) {
   First = ranger(1000000):entity()
if(First:mass() !=0){
   RA = First:getConstraints()
   RA:unshiftEntity(First)
   NumLeft = RA:count()
   Scale = 1
   ExplodeScale = 1
Good = 1
}
    
}
if(Good){
if(NumLeft >0){ #WHEE MAKESHIFT 'FOR' LOOP

    createHolo(RA:count() -NumLeft +1)
    holoPos(RA:count() -NumLeft +1,(RA:entity(RA:count() -NumLeft +1):pos()- entity():pos()) )#*ExplodeScale *Scale)
    holoScale(RA:count() -NumLeft +1,vec(Scale,Scale,Scale))
    holoShadow(RA:count() -NumLeft +1,0)
    holoCustomModel(RA:count() -NumLeft +1,RA:entity(RA:count() -NumLeft +1):model(),1)
    holoAng(RA:count() -NumLeft +1,RA:entity(RA:count() -NumLeft +1):angles())
    NumLeft -=1
}
}
if(NumLeft <= 0){
Loopy += 1
    holoPos(RA:count() -Loopy +1,((RA:entity(RA:count() -Loopy +1):pos() *ExplodeScale)- entity():pos() *ExplodeScale) )#*ExplodeScale *Scale)
    holoAng(RA:count() -Loopy +1,RA:entity(RA:count() -Loopy +1):angles())
    if(Loopy > RA:count()){
        Loopy = 0
    }
}

    
