@name CONFETTI
@persist Model:string Col Ch On Count

if( first() )
{
    Count = 10 #particles per tick
    
    Model = "sprites/sent_ball"
    #Model = "effects/select_dot"
    #Model = "effects/select_ring"
    
    particleBounce( 0.9 )
    particleGravity( vec( 0, 0, -450 ) )
    particleCollision( 1 )
    
    ################################
    runOnTick( 1 )
    Ch = 1
}

if( owner():keyUse() )
{
    if(Ch)
    {
        On = !On
        hint( On ? "On" : "Off", 3 )
        Ch = 0
    }
}
else
{
    Ch = 1
}

#particle( nDuration, nStartSize, nEndSize, sPath, vColor, vPos, vVel, nPitch )

if( On & tickClk() )
{
    for( I = 1, Count )
    {
        if( particleCanCreate() )
        {
            Rand = vec(sin(Col), cos(Col), 3) * randint( 0, 100 )
            Rand = round(Rand, 0)
            Pos = entity():pos()
            Vel = entity():up()*100 + Rand
            
            particle( 10, 10, 3, Model, hsv2rgb( vec( Col, 1, 1 ) ), Pos, Vel )
        }
    }
    Col += 2
    if( Col > 360 ){ Col = 0 }
}
