@name Robotboy655's controller
@inputs Pod:wirelink Con:wirelink Cam:wirelink Veh:entity
@outputs
@persist Mode Pressed
@trigger 

interval(10)

if(first())
{
    Mode = 2
}

if(owner():keyAttack2() & Mode == 1 & Pressed == 0)
{
    Mode = 2
    Pressed = 1
    timer("rM2",1000)
}
elseif(owner():keyAttack2() & Mode == 2 & Pressed == 0)
{
    Mode = 1
    Pressed = 1
    timer("rM2",1000)
}

Con["Engine",number] = Pod["Active",number]
Con["Throttle",number] = Pod["W",number] - Pod["S",number]
Con["Steering",number] = Pod["D",number] - Pod["A",number]
Con["Lock",number] = 1
Con["Handbrake",number] = Pod["Space",number]

Cam["Activated",number] = Pod["Active",number]
if(Mode == 1)
{
    Cam["Direction",vector] = owner():eye()
    Cam["Position",vector] = Veh:pos() + vec(0,0,2) + 250 * -owner():eye()
}
elseif(Mode == 2)
{
    Cam["Direction",vector] = Veh:eye()
    Cam["Position",vector] = Veh:pos() + vec(0,0,56) - Veh:forward() * 25 - Veh:right() * 18
}
Cam["Parent",entity] = Veh

if(clk("rM2"))
{
    Pressed = 0
}
