@name Dragon Tail Test
@persist MaxEnts A:array E:entity Tmr N O:angle
@model models/hunter/blocks/cube05x05x05.mdl
interval(100)

if(first())
{
    E = holoCreate(9001)
    holoAlpha(9001,0)
    holoParent(9001,entity())
    MaxEnts = 50
    for(I=1,MaxEnts)
    {
        holoCreate(I,E:toWorld(vec(-2+(-I*20),0,0)))
        holoModel(I,"models/hunter/blocks/cube025x025x025.mdl")
        holoScale(I,vec(20/8,(MaxEnts+1-I)/MaxEnts,(MaxEnts+1-I)/MaxEnts))
        holoColor(I,vec(100,0,100))
        holoMaterial(I,"models/shiny")
        holoParent(I,I-1)
    }
    holoUnparent(1)
    holoParent(1,E)
    Tmr = 10
    timer("update",Tmr)
}

N++
holoAng(9001,entity():toWorld(ang(-2+sin(N*2)*2,cos(N)*5,0)))

O = clamp(ang(entity():velL():z(),-entity():velL():y(),0)/20,ang(-90),ang(90))

if(clk("update"))
{
    stoptimer("update")
    timer("update",Tmr)
    
    A:unshiftAngle(E:angles()-O)
    
    for(I=1,MaxEnts)
    {
        holoAng(I,A[I,angle]+(ang(0.25,cos(N)*0.25,0)*I))
    }
    
    if(A:count()>MaxEnts)
    {
        A:remove(MaxEnts+1)
    }
}

