@name FailCake Snow V2
@outputs RRS
@persist Back S:array Height I X Y E:entity A Z Range 

if(first()){
Weld = entity():isWeldedTo()
E = entity()  
E:setColor(255,255,255,0)
E:setMaterial("models/debug/debugwhite")
Weld:setColor(255,255,255,255)
Weld:setMaterial("models/debug/debugwhite")

hint("Made by Failcake & Jack",7)   
 
    ######### SETTINGS #########
    Range = 300
    Height = 300
    ######### SETTINGS #########
    
    runOnTick(1)
    A = 0
}



Back+=0.1

if(Back == 2){
E:soundPlay(1,999,"music/portal_self_esteem_fund.mp3")  
soundPitch(1,100)  
}
if(Back >= 300){
Back = 0
soundStop(1)   
}


if(A < 30)
{
    timer("spawn",500)
}

if(clk("spawn"))
{
    X = random(E:pos():x() - Range,E:pos():x() + Range)
    Y = random(E:pos():y() - Range,E:pos():y() + Range)
    A++
    RRS = randint(3,7)
    holoCreate(A)
    holoModel(A,"hqicosphere")
    holoScaleUnits(A,vec(RRS,RRS,RRS))
    holoPos(A,vec(X,Y,E:pos():z() + Height))
    holoColor(A,vec(255,255,255))
    holoAlpha(A,200)
    holoMaterial(A,"models/debug/debugwhite")
    S:pushEntity(holoEntity(A))  
}

for(I = 1,S:count())
{
    Z = S[I,entity]:pos():z() - 0.5
    holoPos(I,vec(S[I,entity]:pos():x(),S[I,entity]:pos():y(),Z))
    if(Z < E:pos():z()) {holoPos(I,vec(S[I,entity]:pos():x(),S[I,entity]:pos():y(),E:pos():z() + Height))}

}
if(duped()){selfDestructAll()}


####################################################################
## Do not rename the E2 or remove the hint("Made by Failcake & Jack",7)##
####################################################################
