@name Bot Trapper
@inputs 
@outputs Bots:array Spawn Undo
@persist 
@trigger 
runOnTick(1)
findInSphere(entity():pos(),20000)
findSortByDistance(entity():pos())
findIncludeClass("player")
findIncludeClass("props")
Dump=findToArray()
Bots=array()

if(first()){
    entity():setAlpha(0)
    entity():isConstrainedTo():setAlpha(0)
}

#sort out bots
for(C=1,Dump:count()){
    Bot=Dump[C,entity]:steamID()=="BOT"
    #Bot=1
    if(Dump[C,entity]:isPlayer()&Bot){
        Bots:pushEntity(Dump[C,entity])
    }
}
Props=array()
for(C=1,Dump:count()){
    if(Dump[C,entity]:type()=="prop_physics"){
        Props:pushEntity(Dump[C,entity])
    }
}

Speed=2000
XYZ=Bots[1,entity]:pos()+Bots[1,entity]:vel()*0.015
Self=entity():isConstrainedTo()
Self:applyForce(Speed*(XYZ-Self:pos())-Self:vel()*Self:mass())

if(Self:pos():distance(XYZ)<60){Spawn=1 Undo=0}else{Spawn=0 Undo=1}


