@name Army of Bots
@inputs 
@outputs [BOTS Alive]:array
@persist Self:entity On [Alive BOTS]:array CUse
@trigger all
if(ops()>4800){exit()}
runOnTick(1)
Own=entity():owner()
if(first()){Self=Own On=0}
Aim=Own:aimEntity()
Player=Aim:isPlayer()
#[Pl=players()
if(first()){
    for(C=1,Pl:count()){
        if(Pl[C,entity]:steamID()=="BOT"){BOTS:pushEntity(Pl[C,entity])}
    }
}]#
ID=Aim:steamID()
Use=Own:keyUse()
Crouched=Own:isCrouch()
CUse=changed(Use)

if(CUse&Aim){
    if(Crouched){
        if(Player&Use&ID=="BOT"){
            #Botlist=BOTS:concat("<")
            
    	       #AIM=array()
            #AIM:pushEntity(Aim)
            
            
           #Botremove=Botlist:find(Aim:name())
            
           if(1){
                BOTS:pushEntity(Aim) 
                On=1
            }
        }
        
        if(!Player&Use){On=0}
    }
}
for(Bot=1,BOTS:count()){
    Self=BOTS:entity(Bot)

    Target=Own:aimPos()
    Offset=vec(0,0,0)
    Ang=(Target-Self:shootPos()+Offset):toAngle()

    if(On){Self:setEyeAngle(Ang)}
}
#[
for(C=1,BOTS:count()){
    Alive[C,number]=BOTS[C,entity]:isAlive()
    if(Alive[C,number]&changed(Alive[C,number])){
        print("stripping "+BOTS[C,entity]:name())
        concmd("ulx strip "+BOTS[C,entity]:name())
        entitySpawn("weapon_smg1",BOTS[C,entity]:pos(),0)
    }
}]#
