@name Robotboy655's Wire Gate: Increment
@inputs Step Max Clk Reset
@outputs Out
@model models/jaanus/wiretool/wiretool_gate.mdl

if(Clk > 0)
{
    if(Max != 0)
    {
        if(Out != Max)
        {
            Out += Step
        }
    }
    else
    {
         Out += Step
    }
}

if(Reset > 0)
{
    Out = 0
}

if(Out > Max & Max != 0)
{
    Out = Max
}
