@name Turret Tank
@inputs Active Seat:entity
@outputs 
@persist 
@trigger 

if(chatClk(owner()) & owner():lastSaid():lower():left(6) == "!reset")
{
    reset()
}

if(dupefinished())
{
    reset()
}

E=entity():isWeldedTo()

if(first()){
    function entity:turnTo(Tarang:angle){
        V = This:toLocal(rotationVector(quat(Tarang)/quat(This))+This:pos())
        This:applyTorque((100*V - 30*This:angVelVector())*This:inertia()/1.5
    )
    }
}

interval(10)
if(Active){E:turnTo(Seat:driver():eyeAngles())}
