VE Lua Documentation

Press F to search!

workload

Definition


-- @/lua/vehicle/extensions/gameplayStatisticModules/watchBurnout.lua:15

local function watchBurnout()
  local prevTrigger = curTrigger
  velocity = obj:getGroundSpeed() * 1.5
  curTrigger = false
  if initialWheelCount ~= wheels.wheelCount then return end --if we lose a wheel
  for _, wIndex in ipairs(wheelsBurnout) do
    wd = wheels.wheels[wIndex]
    if wd.isBroken == false and wd.wheelSpeed > 2 and wd.wheelSpeed > velocity and (wd.lastSlip * min(wd.downForce * 0.1, 1))>4 and wd.contactMaterialID1 ~=-1 and wd.contactMaterialID2 ~=-1 then
      curTrigger = true
      break
    end
  end

  if curTrigger then
    if not prevTrigger then
      startTime = obj:getSimTime()
    end
  else
    if prevTrigger then
      local burnOutTime = obj:getSimTime() - startTime
      if burnOutTime > 0.1 then
        gameplayStatistic.metricAdd("vehicle/airtime.time", burnOutTime, true)
      end
    end
  end
end

Callers