GE Lua Documentation

Press F to search!

onScenarioUIReady

Definition


-- @/lua/ge/extensions/scenario/scenarios.lua:1279

-- callback from the UI
local function onScenarioUIReady(state)
  log('D', logTag, 'onScenarioUIReady('..tostring(state) .. ')')
  if not scenario then return end

  if state == 'start' and scenario.state == 'pre-start' then

    if isMultiseatScenario() then
      initMultiseatPlayers()
    end

    showIntroPrefab(true)

    -- initial UI update
    guihooks.trigger('ScenarioChange', scenario)

    -- init camera paths
    delayCameraPath = 10

    local democam = scenetree.findObject('democam')
    if democam and democam.className == 'SimPath' then
      guihooks.trigger("scenarioStart:showStartButton", false)
    end

    scenario.extraTime = 0

    -- start the race subsystem
    changeState('pre-running')
  end
  log('D', logTag, 'should run: ' .. tostring(state == 'play' and scenario.state == 'pre-running') .. '; state: ' .. tostring(scenario.state))

  if state == 'play' and scenario.state == 'pre-running'then
    log('D', logTag, 'trying to start scenario')
    changeState('running')
  elseif state == 'play' and scenario.state == 'physicsPaused' and scenarioStateAtPauseEvent == 'pre-running' then
    scenarioStateAtPauseEvent = 'deferredRunning'
  end

  guihooks.trigger('ScenarioChange', scenario)
end

Callers

@/ui/modules/scenariocontrol/scenariocontrol.js
    } else {
      // console.debug('[ScenarioStartController] sending to engineLua: %s', 'scenario_scenarios.onScenarioUIReady("play")')
      bngApi.engineLua('extensions.hook("onScenarioUIReady", "play")')
    } else {
      // console.debug('[ScenarioStartController] sending to engineLua: %s', 'scenario_scenarios.onScenarioUIReady("play")')
      bngApi.engineLua('extensions.hook("onScenarioUIReady", "play")')
@/lua/ge/extensions/flowgraph/nodes/ui/startScreen.lua

function C:onScenarioUIReady(state)
  if self._active then
@/lua/ge/extensions/flowgraph/nodes/ui/vehicleSelector.lua

function C:onScenarioUIReady(state)
  if self._active then
@/lua/ge/extensions/scenario/scenarios.lua
local function onScenarioUIReady(state)
  log('D', logTag, 'onScenarioUIReady('..tostring(state) .. ')')
  if not scenario then return end