@name BFG 9001
@inputs [Boom1 Boom2 Boom3 Boom4 Boom5 Boom6 Boom7 Boom8 Boom9 Boom0]:wirelink
@outputs Pos:vector Vel:vector Ang:vector
@persist BFGBall:entity Scan:ranger UseC
@trigger 

runOnTick(1)
O=owner()



function array snapshot(){
    findInCone(O:pos(),O:eye(),10000,45)
    findIncludeClass("player")
    findIncludeClass("npc")
    return findToArray()
}
function entity:movepos(XYZ:vector){
    Bomb=This
   Speed=100*(Bomb:mass()/3)
    Bomb:applyForce(Speed*(XYZ-Bomb:pos())-Bomb:vel()*Bomb:mass()) 
    
}

function entity:hurt(Sight:array,Hurt:number){
    for(C=1, Sight:count()){
        Sight[C,entity]:takeDamage(randint(15,120))
    }
}

if(O:weapon():type():find("physcannon"))
{
    UseC=changed(O:keyUse())
    if(O:keyUse()&UseC)
    {
        Ang=O:eye()
        Pos=O:shootPos()+Ang*20
        Vel = Ang*5
        print(Vel)
        BFGBall = holoCreate(1,Pos)
        
    }
}

if(BFGBall:isValid())
{
    holoPos(1, Pos)
    Pos+=Vel
    Scan=rangerOffset(1,Pos,Ang)
        
    if(Scan:hit() || Scan:entity():isValid())
    {
        holoDelete(1)
    }
}
