@name Flame Thrower
@inputs Ignite:wirelink Thruster:wirelink
@outputs Thrust 
@persist On
@trigger 
@model models/props_junk/PopCan01a.mdl
#attach to an igniter and then a thruster, place both on the bottom of the igniter
O=owner()
G=Ignite:entity()
entity():setMass(0)
Thruster:entity():setMass(0)
Thruster:entity():setAlpha(10)
Ignite:entity():setAlpha(10)
entity():setAlpha(0)
runOnTick(1)
if(O:lastSaid()=="FF off"){On=0}
if(O:lastSaid()=="FF on"){On=1}
if(first()){On=1}
if(On){
    Dir=G:pos()-O:aimPos()
    Q = quat(Dir:toAngle())*qRotation(vec(0,1,0),-90)
    G:applyTorque((150*G:toLocal(rotationVector(Q/quat(G))+G:pos()) - 12*G:angVelVector())*G:inertia())
    
    PAng=O:eyeAngles():yaw()-45
    PAngP=O:eyeAngles():pitch()
    R=25
    XYZ=O:shootPos()+vec(R*cos(PAng),R*sin(PAng),-20)
    Speed=100*(G:mass()/2)
    G:applyForce(Speed*(XYZ-G:pos())-G:vel()*G:mass())
}



if(O:keyUse()&O:weapon():type()=="weapon_physcannon"){
    Thrust=-1
    if(!O:aimEntity():isOnFire()){
    Ignite["A",number]=1
    Ignite["Length",number]=132
    }
}else{
    Thrust=0
    Ignite["A",number]=0
    Ignite["Length",number]=1

}
