@name Tobi VTOL
@persist [E P]:entity FC FM
if(first())
{
    runOnTick(1)
    
    E = entity():isConstrainedTo()
    if(E:isValid())
    {
        E:setMass(50000)
        
        if(E:isVehicle())
        {
            selfDestruct()
        }else
        {
            P = E:isConstrainedTo()
        }
    }else
    {
        selfDestruct()
    }
    
    FC = 9
    
}

Dri = P:driver()
Active = P:driver():isValid()
if(Active)
{
    W = Dri:keyForward()
    A = Dri:keyLeft()
    S = Dri:keyBack()
    D = Dri:keyRight()
    R = Dri:keyReload()
    Spc = Dri:keyJump()
    Shift = Dri:keySprint()
    M1 = Dri:keyAttack1()
    M2 = Dri:keyAttack2()
    
    FM+=0.0025
}else
{
    FM-=0.0025
}
FM = clamp(FM,0,1)

if(changed(R) & R){holoEntity(1):soundPlay(1,0,"music/hl2_song20_submix0.mp3")}

E:applyForce((E:up()*(FC+((Spc-Shift)*4))-(E:vel()*vec(0.0025,0.0025,0.005)))*E:mass()*FM)
E:applyAngForce((ang((D-A)*30,(M1-M2)*60,(S-W)*30)-(E:angles()*ang(1.5,0,1.5))-E:angVel()*0.75)*E:mass()*FM)
