GE Lua Documentation

Press F to search!

updateStaticFromRace

Definition


-- @/lua/ge/extensions/core/lapTimes.lua:544

-- Update static data from race state
local function updateStaticFromRace(race, playerId)
  if not race then
    return
  end

  -- Update meta information
  totalLaps = race.lapCount or totalLaps
  local segments = 0
  if race.path and race.path.pathnodes and race.path.pathnodes.sorted then
    segments = #race.path.pathnodes.sorted
  end
  totalSegments = segments
  closedCircuit = race.path and race.path.config and race.path.config.closed or false

  -- Populate static stream data directly
  table.clear(staticStreamData)

  staticStreamData.totalLaps = totalLaps
  staticStreamData.totalSegments = totalSegments
  staticStreamData.closedCircuit = closedCircuit

  -- Set flag for onUpdate to send the stream
  needStaticStream = true
end

Callers

@/lua/ge/extensions/gameplay/race/race.lua
      -- Update static stream on race start
      core_lapTimes.updateStaticFromRace(self, be:getPlayerVehicleID(0))
    end
        if core_lapTimes.updateStaticFromRace then
          core_lapTimes.updateStaticFromRace(self, id)
        end
      if core_lapTimes.updateStaticFromRace then
        core_lapTimes.updateStaticFromRace(self, id)
      end
@/lua/ge/extensions/gameplay/crawl/utils.lua
      core_lapTimes.updateFastFromRace(state.raceData, crawlerId)
      core_lapTimes.updateStaticFromRace(state.raceData, crawlerId)
    end