@name Hovering With applyForce
@inputs Pod:wirelink 
@outputs 
@persist E:entity Force:vector Gyro:angle 
@trigger 
runOnTick(1)

if(first()){
    E = entity():isWeldedTo()
    EE = entity():isConstrainedTo()
}

Force=((-E:vel()*E:mass())+10*vec(1,1,1))+vec(0,0,153.2)
E:applyForce(Force)

P = E:angles():pitch()
Y = 0
R = E:angles():roll()

Gyro = angnorm(ang(0,0,0) - ang(P,Y,R))*E:mass()*62.5

E:applyAngForce(Gyro + $Gyro*5)
E:applyAngForce(-E:angVel()*E:mass())

local Seat = Pod["Entity",entity]
local Driver = Seat:driver()
local W = Driver:keyForward()
local A = Driver:keyLeft()
local S = Driver:keyBack()
local D = Driver:keyRight()
local R = Driver:keyReload()
local Mouse1 = Driver:keyAttack1()
local Mouse2 = Driver:keyAttack2()
local Shift = Driver:keySprint()
local Space = Driver:keyJump()
local Active = Driver:isPlayer()
local On = Active

if (W) {
    E:applyForce(E:forward()*E:inertia()*400*E:mass())
}

if (S) {
    E:applyAngForce(ang(-400,0,0)*E:mass())
}

if (D) {
    E:applyAngForce(ang(0,-30,0)*3*E:mass())
}

if (A) {
    E:applyAngForce(ang(0,30,0)*3*E:mass())
}

if (Space) {
    E:applyForce(vec(0,0,100)*E:mass())
}
if (Shift) {
    E:applyForce(vec(0,0,-100)*E:mass())
}

findByClass("prop_vehicle_prisoner_pod")
findSortByDistance(entity():pos())
if(find():model() == "models/nova/airboat_seat.mdl" & find():owner() == owner()) {
    EE = find()
    EE:setPos(E:toWorld(vec(0,0,10)))
    EE:setAng(E:angles()+ang(0,-90,0))
    timer("parent",20)
}
if(clk("parent")) {
    stoptimer("parent")
    EE:parentTo(E)
    rangerFilter(array(E,EE))
}
