local active = true
launchrpm = 3000
local rpmStep = 30
local launchrpmmax = 6200

function script.update(dt)
  data = ac.accessCarPhysics()
  local handbrake = data.handbrake
  speed = data.speedKmh
  rpm = data.rpm
  clutch = 1 - data.clutch
  throttle = data.gas
  gear = data.requestedGearIndex - 1
  if handbrake == 1 then
    launchrpm = launchrpm + rpmStep
    if launchrpm > launchrpmmax then
      launchrpm = 2500
    end
  end

  if speed < 1 and clutch > 0.5 and rpm < launchrpm + 300 then
    launchMode()
  end
end

function launchMode()
  if rpm > launchrpm then 
    data.rpm = launchrpm
  end
end