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

if (dupefinished()) {reset()}

B = round(toUnit("mph",Chassis:vel():length()))

if (B >= 20) {TURN_ANGLE = 25}

else {TURN_ANGLE = 35}

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

    if (!SLAVE:isPlayerHolding()) {
        TURN += clamp((A-D)*TURN_ANGLE - TURN,-TURN_RATE,TURN_RATE)
        SLAVE:setAng(Chassis:toWorld(ang(0,TURN+90,0)))
        SLAVE:propFreeze(1)
    }
}
