@name SETANG STEERING SLAVE
@inputs Wirelink:wirelink CHASSIS:entity
@outputs Constant Damping FLength RLength Throttle Gear Brake Activate
@persist SLAVE:entity [TURN_RATE TURN_ANGLE TURN] BRAKESTRENGTH
@model models/hunter/blocks/cube025x025x025.mdl
# I don't know who made the origional copy of this E2 but
# I (Non-stop Joker) made it customizable and added stuff 
# for ACF to it.

# Wire Wirelink to Pod Controller Wirelink!

Active = Wirelink:number("Active")

 if(Active){
    W = Wirelink:number("W")
    A = Wirelink:number("A")
    S = Wirelink:number("S")
    D = Wirelink:number("D")
    Space = Wirelink:number("Space")
}

if( ->CHASSIS & dupefinished() ){ reset() }

if (first())    {
    interval(10)
    
    TURN_RATE = 3 #The speed of the steering
    TURN_ANGLE = 30 #Max angle that the front wheels steer
    
    SLAVE = entity()
} elseif (clk())    {
    interval(10)

    if (!SLAVE:isPlayerHolding())    {
        TURN += clamp((A-D)*TURN_ANGLE - TURN, -TURN_RATE, TURN_RATE)
        SLAVE:setAng( CHASSIS:toWorld(ang(0, TURN, 0)) )
# Add a number to TURN on line 23 if the front wheels aren't at 
# the right angle example: 0, -90+TURN, 0 or 0, 90+TURN, 0.
        SLAVE:propFreeze(1)
    }
}

if( dupefinished() ){ reset() }

if (first())    {
# Hydraulic Settings #
    Constant = 50000 #The strength of the hydraulics up to 50000
    Damping = 2000 #springyness of the hydraulics
    FLength = 25 #Front hydraulic length
    RLength = 25 #Rear hydraulic length
}

# Throttle #
    if(W==1&S==0){Throttle = 100}
    if(W==0&S==0){Throttle = 0}
    if(W==0&S==1){Throttle = 100}
    #! Don't change these !#

# Reverse and forward easy shifting #
    if(W==0&S==1){Gear = 6}
    if(W==1&S==1){Gear = 1}
        # To use this press S to go into reverse gear and 
        # W + S to switch back to first gear.

# Brakes #
    if(Active==1){Activate = 0}
    if(Active==0){Activate = 1}
    if(Space==1){Brake = BRAKESTRENGTH}
    if(Space==0){Brake = 0}

    BRAKESTRENGTH = 2 # Raise/lower this if you want 
                      # stronger/weaker brakes.


# The braking part is new.
# Use a weld latch in wire from the wheels to your base plate 
# and wire Activate from the weld latch to Activate on this E2
# for parking brakes when nobody is in your vehicle.
# Wire Brake from your gearbox(s) to Brake on this E2 for
# regular brakes while driving.
