VE Lua Documentation

Press F to search!

initSystems

Definition


-- @/lua/vehicle/main.lua:144

function initSystems()
  profilerPushEvent("3.1 init - compat")
  backwardsCompatibility.init()
  profilerPopEvent("3.1 init - compat")

  profilerPushEvent("3.2.X init - materials (sum)")
  material.init()
  profilerPopEvent("3.2.X init - materials (sum)")

  profilerPushEvent("3.2 init - first stage")
  bdebug.init()
  electrics.init()
  damageTracker.init()
  beamstate.init() -- needs to go before powertrain and first controller init, needs to go after damageTracker
  protocols.init()
  wheels.init()
  powertrain.init()
  energyStorage.init()
  input.init()
  controller.init() -- needs to go after input first stage
  profilerPopEvent("3.2 init - first stage")

  profilerPushEvent("3.3 init - second stage")
  wheels.initSecondStage()
  controller.initSecondStage()
  drivetrain.init()
  profilerPopEvent("3.3 init - second stage")

  profilerPushEvent("3.4 init - groupA")
  sensors.reset()
  thrusters.init()
  hydros.init()
  profilerPopEvent("3.4 init - groupA")

  profilerPushEvent("3.5 init - audio")
  sounds.init()
  profilerPopEvent("3.5 init - audio")

  profilerPushEvent("3.6 init - groupB")
  props.init()
  input.initSecondStage() -- needs to go after sounds & electrics
  recovery.init()
  sensors.init()
  fire.init()
  wheels.initSounds()
  powertrain.initSounds()
  controller.initSounds()
  guihooks.message("", 0, "^vehicle\\.") -- clear damage messages on vehicle restart
  profilerPopEvent("3.6 init - groupB")

  profilerPushEvent("3.7 init - extensions")
  extensions.hook("onInit")
  profilerPopEvent("3.7 init - extensions")

  profilerPushEvent("3.8 init - last stage")
  mapmgr.init()

  electrics.initLastStage()
  controller.initLastStage() --meant to be last in init
  powertrain.sendTorqueData()

  -- be sensitive about global writes from now on
  detectGlobalWrites()
  updateCorePhysicsStepEnabled()
  profilerPopEvent("3.8 init - last stage")
end

Callers

@/lua/vehicle/main.lua
  profilerPushEvent("3.X init systems (sum)")
  initSystems()
  profilerPopEvent("3.X init systems (sum)")