@name Holographic Christmas Tree Generator
@inputs 
@outputs Points:array Test:vector Act Go
@persist Tree:entity Go
Act=1
#interval(100)
#ang(0,-76,0)  #this is the angle the tree slopes at
#vec(146,0,-70) #this is the lower edge of the tree from center of mass
#vec(12,0,435) #highest light and radius
Model="models/props_foliage/tree_pine04.mdl"
#if(first()){Tree=propSpawn(Model,entity():pos()+vec(0,0,1),1)}
#runOnLast(1)
#if(last()){Tree:propDelete()}
runOnChat(1)
if(first()){Go=0}
Chat=owner():lastSaid()
if(chatClk()&Chat:find("no tree")){selfDestruct()}
O=owner()
if(O:aimEntity()&chatClk()&Chat:find("this tree")){Go=1 Tree=O:aimEntity()}
HoloModel="icosphere" 
MinHeight=-70-70*2-70
MaxHeight=435-170
MinRadius=12-12
MaxRadius=146
#Material="models/roller/rollermine_glow"
Material="models/alyx/emptool_glow"
Size=1

if(Go){
    for(C=1,150){
        Radius=randint(MinRadius,MaxRadius)
        Z=Tree:massCenter():z()+randint(MinHeight,MaxHeight)
        RandRadius = Radius*(1- Z/MaxHeight)
        RandAng=randint(0,360)
        X = RandRadius*cos(RandAng)
        Y = RandRadius*sin(RandAng)
        Color=randvec(vec(0,0,0),vec(255,255,255))
        #Pos=Tree:massCenter()+vec(X,Y,Z)
        Pos=Tree:massCenter()+vec(X,Y,Z)
        holoCreate(C,Pos,vec(Size,Size,Size),ang(),Color,HoloModel)
        Test=Tree:massCenter()+vec(X,Y,Z)
        #holoAlpha(C,128)
        holoMaterial(C,Material)
        holoParent(C,Tree)
        Points:pushVector(vec(X,Y,Z))
        #printTable(Points)
        
    }
}


