VE Lua Documentation

Press F to search!

getVehicleState

Definition


-- @/lua/vehicle/beamstate.lua:1501

local function getVehicleState(...)
  -- fake delay, to be used only during development, to emulate possible framerate issues in slower computers and prevent abuse this API
  log("W", "", "getVehicleState delay")
  local timer, fakeDelay = HighPerfTimer(), 1
  while fakeDelay > 0 do
    fakeDelay = fakeDelay - timer:stopAndReset() / 1000
  end

  local pos = obj:getPosition()
  local front = obj:getDirectionVector()
  local up = obj:getDirectionVectorUp()
  local vehicleState = {objId = obj:getId(), partsCondition = partCondition.getConditions(), itemId = v.config.itemId, pos = pos, front = front, up = up}
  return vehicleState, ...
end

Callers

@/lua/vehicle/extensions/tech/techCore.lua

local function getVehicleState()
  local vehicleState = {
  local resp = {type = 'VehicleUpdate'}
  local vehicleState = getVehicleState()
  resp['state'] = vehicleState