VE Lua Documentation

Press F to search!

setDeviceMode

Definition


-- @/lua/vehicle/powertrain.lua:837

local function setDeviceMode(name, mode)
  local device = powertrainDevices[name]
  if not device then
    return
  end

  previousDeviceModes[name] = mode
  device:setMode(mode)
  guihooks.message(device.uiName .. " Mode: " .. mode, 5, "vehicle.powertrain.diffmode." .. device.name)
end

Callers

@/lua/vehicle/powertrain.lua

  setDeviceMode(name, newMode)
  return newMode
@/lua/vehicle/controller/4wd.lua
  if rangeBox then
    powertrain.setDeviceMode(rangeBox.name, mode)
  end
  if shaft and not shaft.isPhysicallyDisconnected then
    powertrain.setDeviceMode(shaft.name, mode)
  end
@/ui/modules/apps/PowerTrainDebug/app.js
          var newMode = node.modes[(curNum + 1) % (node.modes.length)]
          var cmd = 'powertrain.setDeviceMode("' + node.name + '","' + newMode + '")'
          //console.log('switching node: ' + node.name + ' to mode ' + newMode)