@name Spook
@inputs 
@outputs LastSaid
@persist Spin Angle:angle Rotate:angle Scale:vector
@persist RotateBy:angle Distance Speed Z Target:entity Color:vector
@trigger 

if(first()){
    for(I=1,9){
        holoCreate(I, vec(random(255),random(255),random(255)))
        holoCustomModel(I, "models/props_junk/TrafficCone001a.mdl", 1)
    }
    Scale = vec(1,1,1)
    Distance = 80
    Speed = 1
    Z = 30
    Target = entity()
    Color = vec(255,255,255)
}

runOnTick(1)

for(I=1,9){
    holoPos(I, Target:pos() + vec( sin(I*40 + Spin)*Distance, cos(I*40+ Spin)*Distance, Z))
    holoAng(I, Rotate + Angle +ang(0, -(I*40 + Spin),0))
    
}

Spin += Speed
Rotate += RotateBy

Speech = entity():owner():lastSaid():explode("|")
LastSaid = entity():owner():lastSaidWhen() - curtime()
if(entity():owner():lastSaidWhen() - curtime() > -0.2)
{
if(Speech:string(1) == "Angle"){
    Angle = ang( Speech:string(2):toNumber(), Speech:string(3):toNumber(), Speech:string(4):toNumber())
    Rotate = ang( 0, 0, 0)
}

if(Speech:string(1) == "Scale"){
    for(I=1,9){
    holoScale(I, vec(Speech:string(2):toNumber(), Speech:string(3):toNumber(), Speech:string(4):toNumber()))
}
}

if(Speech:string(1) == "Model"){
    for(I=1,9){
        holoCustomModel(I, Speech:string(2), 1)
    }
}

if(Speech:string(1) == "Distance"){
    Distance = Speech:string(2):toNumber()
}

if(Speech:string(1) == "Speed"){
    Speed = Speech:string(2):toNumber()
}

if(Speech:string(1) == "Rotation"){
    RotateBy = ang(Speech:string(2):toNumber(), Speech:string(3):toNumber(), Speech:string(4):toNumber())
}
    
if(Speech:string(1) == "Z"){
    Z = Speech:string(2):toNumber()
}
if(Speech:string(1) == "Target"){
    Target = entity():owner():aimEntity()
}
if(Speech:string(1) == "Name"){
    Target = findPlayerByName(Speech:string(2))
}
if(Speech:string(1) == "Color"){
    for(I=1,9){
    holoColor(I, vec(Speech:string(2):toNumber(), Speech:string(3):toNumber(), Speech:string(4):toNumber()))
}
}
}
