@name Fog of war
@inputs 
@outputs 
@persist Density Spread On Size Z Length Color:vector
@trigger 
if(first()){
 print(owner():pos():z())
 entity():setPos(vec(0,0,-200))
 runOnTick(1)
 runOnChat(1)
#PREFRENCES#####
 Length = 50
 Color = vec(100)
 Density = 255
 Size = 1000
 Spread = 15000
 Z = 200
################
 for(I=1,7){
 holoCreate(I)  
 holoAlpha(I,0) 
}   
}

if(chatClk(owner())){
 if(owner():lastSaid():lower():find("fow")){
    hideChat(1)
    On = !On
}
}

if(On){
    holoPos(1,vec(random(-Spread,Spread),random(-Spread,Spread),Z))
    holoPos(2,vec(random(-Spread,Spread),random(-Spread,Spread),Z))
    holoPos(3,vec(random(-Spread,Spread),random(-Spread,Spread),Z))
    holoPos(4,vec(random(-Spread,Spread),random(-Spread,Spread),Z))
    holoPos(5,vec(random(-Spread,Spread),random(-Spread,Spread),Z))   
    holoPos(6,vec(random(-Spread,Spread),random(-Spread,Spread),Z))   
    holoPos(7,vec(random(-Spread,Spread),random(-Spread,Spread),Z))   
}

if(changed(On)&On){
    holoEntity(1):setTrails(Size,Size,Length,"trails/smoke",Color,Density)
    holoEntity(2):setTrails(Size,Size,Length,"trails/smoke",Color,Density)
    holoEntity(3):setTrails(Size,Size,Length,"trails/smoke",Color,Density)
    holoEntity(4):setTrails(Size,Size,Length,"trails/smoke",Color,Density)
    holoEntity(5):setTrails(Size,Size,Length,"trails/smoke",Color,Density) 
    holoEntity(6):setTrails(Size,Size,Length,"trails/smoke",Color,Density)
    holoEntity(7):setTrails(Size,Size,Length,"trails/smoke",Color,Density)  
}

if(changed(On)&!On){
    holoEntity(1):removeTrails()
    holoEntity(2):removeTrails()
    holoEntity(3):removeTrails()
    holoEntity(4):removeTrails()
    holoEntity(5):removeTrails()
    holoEntity(6):removeTrails()
    holoEntity(7):removeTrails()
} 
