GE Lua Documentation

Press F to search!

onUiReady

Definition


-- @/lua/ge/extensions/util/richPresence.lua:320

local function onUiReady()
  --log("I","onUiReady","") --usually used when reloading
  local state = 0 --invalid
  if extensions.core_gamestate.state.state then
    local s = extensions.core_gamestate.state.state
    --log("E","onUiReady",dumps(s))
    if string.startswith(s,"menu.") then
      state = 3 --menu
      if Steam then
        Steam.timelineSetStateDescription("Menu",0)
      end
    elseif s == "loading" then
      state = 4 --loadingscreen
      if Steam then
        Steam.timelineSetStateDescription("Loading screen",0)
      end
    elseif string.startswith(s,"scenario-") then
      state = 2 --stagging
    else
      state = 1 --playing
    end
  end
  if Steam then
    Steam.timelineSetGameMode(state)
  end
end

Callers

@/lua/ge/main.lua
  -- calling the mod manager uiReady hook directly to load the mods and not wait for the UI
  core_modmanager.onUiReady()
@/lua/ge/extensions/core/commandhandler.lua

local function onUiReady()
  uiReady = true
@/lua/ge/extensions/core/modmanager.lua

local function onUiReady()
  if getModsDisabledAfterUpdate() then return end
  settings.setValue('disableModsAfterUpdate', false)
  onUiReady()
end