@name FailCake ToniCar Ballon Supreme
@inputs Pod:wirelink Cam:wirelink
@persist E:entity [Ps]:ranger W A S D SHIFT SPACE GEARS:array
@persist Vel Active For Gear
@trigger all
interval(100)

if(first()){

E = entity()    

holoCreate(1)
holoModel(1,"models/props_vehicles/car002a_physics.mdl")    
holoScale(1,vec(1,1,1)/10)
holoPos(1,E:toWorld(vec(0,0,2)))
Gear = 1

## The Gears
GEARS:pushNumber(1) # Gear1
GEARS:pushNumber(3) # Gear 2
GEARS:pushNumber(5) # Gear 3
GEARS:pushNumber(8) # Gear 4
GEARS:pushNumber(12) # Gear 5
}

W = Pod:number("W")
S = Pod:number("S")
D = Pod:number("D")
A = Pod:number("A")
SPACE = Pod:number("Space")
SHIFT = Pod:number("Shift")
Active = Pod:number("Active")

Ps = rangerOffset(3,holoEntity(1):pos(),-holoEntity(1):up())



if(Active){
Vel = holoEntity(1):vel():length()/3 
   
if(Vel >= GEARS[Gear,number]){
if(Gear < GEARS:count()){
Gear+=1
}elseif(Vel <= GEARS[Gear,number]){
if(Gear > 0){
Gear-=1
}
}    
}    


if(W){
holoPos(1,Ps:position()+vec(4,0,2.1))    
}elseif(S){
holoPos(1,Ps:position()+vec(-4,0,2.1))   
}



}




setName(Vel + " - GEAR : "+Gear)
