@name V8 Thruster Engine
@inputs Active Throttle GPS:vector
@outputs T1 T2 RPM Angle
@persist Angle
@trigger
@model models/mechanics/wheels/wheel_smooth_24.mdl
if( first() | dupefinished()){runOnTick(1)}

Crankshaft = entity()
Angle = Crankshaft:bearing(GPS)
RPM = abs(round(Crankshaft:angVel():yaw()/6))

if (Active) {
    if (~Active) {
        Crankshaft:soundPlay(0,0,"vehicles/airboat/fan_motor_fullthrottle_loop1.wav")
        soundVolume(0,100)
    } 
    
    A = Throttle + 2.5
    Pa = sign(cos(Angle))
    T1 = Pa*A
    T2 = -T1 soundPitch(0,RPM/7)
} else {
    T1 = 0,T2 = 0,T3 = 0,T4 = 0,soundStop(0)
}
