@name all in one tank chip by dakota
@inputs Pod:wirelink CamController:wirelink Gun:entity Seat:entity W A S D
@outputs [HitPosition]:vector Throttle Gear Lgear Rgear Lclutch Rclutch
@persist Speed Active Dualclutch Dualgearbox
@trigger 

#instructions
#Wire Pod to the advanced pod controller
#Wire CamController to the cam controller
#Wire Gun to the gun
#Wire Seat to the advanced pod controller
#Wire Throttle on the engine to Throttle
#Wire Gear on the left gearbox to Lgear
#Wire Gear on the right gearbox to Rgear
#Wire Gear on the dual clutch gearbox to Gear
#Wire clutch and brake on the left gearbox to Lclutch
#Wire clutch and brake on the right gearbox to Rclutch
#Wire W,A,S,D to W,A,S,D on the advanced pod controller
#In this e2 select if you are using a dual clutch or dual gearbox set up
#If you have dual clutch wire Lgear or Rgear, if you have dual gearbox don't wire Gear
#tips
#for crosshairs use an advanced hud indicator and link worldpos to HitPosition on the e2
#the gears shift automatically, but you have to find the speed in which you want them to shift
#once you find a good speed modify the values
#for dual clutch the value for gear1-2 is on line 72, gear 2-3 is on line 76
#for dual gearbox the value for gear1-2 is on line 110, gear 2-3 is on line 115
#is it dual clutch or dual gearbox?
Dualclutch = 1 #1 if dual clutch 0 if not
Dualgearbox = 0 #1 if dual gearbox 0 if not












interval(1)

Throttle=0
Speed = entity():vel():length() / 17.6

Active = Pod["Active",number]
Seat = Pod["Entity",entity]

Driver = Seat:driver()

CamController["Position",vector] = entity():isWeldedTo():pos() + vec(-250,0,150):rotate(Driver:eye():toAngle())
CamController["Angle",angle] = Driver:eye():toAngle()
CamController["Activated",number] = Active
CamController["Parent",entity] = entity():isWeldedTo()

if(Dualclutch==1){

if(Speed<10)
{
        if (W)
    {
        Gear = 1
    }
}
if (S&Speed<10000)
{
    Gear = 4
}
if(Speed>15&!S)
{
    Gear = 2
}
if(Speed>25&!S)
{
    Gear = 3
}

if(W|A|S|D){Throttle=100}

if(A){Rclutch = 10}else{Rclutch = 0}   
if(D){Lclutch = 10}else{Lclutch = 0}  
}
if(Dualgearbox==1){  
if(Speed<10)
{
    if(A)
    {
        Lgear=4
        Rgear=1
    }
        elseif (D)
    {
        Lgear=1
        Rgear=4
    }
        elseif (W)
    {
        Lgear = 1
        Rgear = 1
    }
}
if (S&Speed<10000)
{
    Lgear = 4
    Rgear = 4
} 
if(Speed>15&!S)
{
    Lgear = 2
    Rgear = 2
}
if(Speed>25&!S)
{
    Lgear = 3
    Rgear = 3
}

if(W|A|S|D){Throttle=100}

if(A&Speed>10){Rclutch = 10}else{Rclutch = 0}   
if(D&Speed>10){Lclutch = 10}else{Lclutch = 0}  
}

if(Active)  
    {
        Gun:applyAngForce(angnorm(-Gun:angles() +Seat:driver():eyeAngles() - Gun:angVel() / 10) * shiftL(ang(Gun:inertia())) * 300)
    }      

rangerHitEntities(0)
HitPosition =  rangerOffset(1000000,Gun:pos(), Gun:forward()):position()

if(dupefinished()){
    reset()
}
