@name Setang steering2
@inputs A D Chassis:entity
@persist SLAVE:entity [TURN_RATE TURN_ANGLE TURN]
@model models/sprops/rectangles/size_2_5/rect_18x18x3.mdl

if (dupefinished()) {reset()}

if (first()) {
    interval(20)
    
    SLAVE = entity()
} 
elseif (clk()) {
    interval(20)

    if (!SLAVE:isPlayerHolding()) {
        
        if(A|D){
            TURN = clamp(TURN+(A-D)*6,-45,45)
        }else{
            TURN /= clamp(Chassis:vel():length()/100,1.01,1.07)
        }
        SLAVE:setAng(Chassis:toWorld(ang(0,TURN+90,0)))
        SLAVE:propFreeze(1)
    }
}
