@name ACF Engine and GearBox Control
@inputs Pod:wirelink Engine:wirelink Gearbox:wirelink
@outputs LS RS Current_Speed Gear
@persist Add:number Power:number Throttle:number Gear:number Clutch:number Brake:number
runOnTick(1)

Active       =    Pod["Active",number]
Space        =    Pod["Space",number]
Mouse2       =    Pod["Mouse2",number]
W            =    Pod["W",number]
A            =    Pod["A",number]
S            =    Pod["S",number]
D            =    Pod["D",number]

Engine["Active",number]     =  Power
Engine["Throttle",number]   =  Throttle
Torque                      =  Engine["Torque",number]

Gearbox["Gear",number]      = Gear
Gearbox["Clutch",number]    = Clutch
Gearbox["Brake",number]     = Brake

Throttle=Throttle+W
Throttle=Throttle-S
Brake=Space
Throttle = clamp(Throttle,-10,100)
Gear=round(Throttle/12.2)

if (Mouse2==1) {Throttle=0}
if (Active==1) {Power=1}
if (Active+Active==0) {Power=0}

if (A==1)   {LS=20 RS=40}
if (D==1)   {LS=40 RS=20}
if (A+D==0) {LS=30 RS=30}
