VE Lua Documentation

Press F to search!

updateObjType

Definition


-- @/lua/vehicle/sounds.lua:1350

local function updateObjType()
  local newObjType = playerInfo.anyPlayerSeated and 0 or (ai.mode == "traffic" and 2 or 1)
  if newObjType == M.objType then
    return
  end
  M.objType = newObjType

  for wi, wh in pairs(wheelsSounds or {}) do
    if wh.rigidRoll then
      wh.rigidRoll:setParameter("c_objType", newObjType)
    end
    if wh.rigidSkid then
      wh.rigidSkid:setParameter("c_objType", newObjType)
    end
    if wh.looseRoll then
      wh.looseRoll:setParameter("c_objType", newObjType)
    end
    if wh.looseSkid then
      wh.looseSkid:setParameter("c_objType", newObjType)
    end
  end
end

Callers

@/lua/vehicle/ai.lua
    stateChanged()
    sounds.updateObjType()
  end
@/lua/vehicle/main.lua
  ai.stateChanged()
  sounds.updateObjType()
  extensions.hook("onPlayersChanged", playerInfo.anyPlayerSeated) -- backward compatibility
@/lua/vehicle/sounds.lua

  M.updateObjType()
end

  M.updateObjType()
end