onPreVehicleSpawned
Definition
-- @/lua/ge/extensions/core/vehicles.lua:2532
local function onPreVehicleSpawned(vehId)
local veh = getObjectByID(vehId)
if not veh then return end
M.vehsCouplerCache[vehId], M.vehsCouplerTags[vehId], M.vehsCouplerOffset[vehId] = {}, {}, {}
local couplerCache, couplerTags, couplerOffset = M.vehsCouplerCache[vehId], M.vehsCouplerTags[vehId], M.vehsCouplerOffset[vehId]
local vehData = core_vehicle_manager.getVehicleData(vehId)
if not vehData or not vehData.vdata then return end
local vdata = vehData.vdata
if not vdata.nodes then return end
local refPos = vdata.nodes[vdata.refNodes[0].ref].pos
for _, n in pairs(vdata.nodes) do
if n.couplerTag or n.tag then
local cid = n.cid
couplerTags[cid] = n.couplerTag
local data = shallowcopy(n)
couplerCache[cid] = data
local pos = vdata.nodes[cid].pos
couplerOffset[cid] = vec3(pos.x - refPos.x, pos.y - refPos.y, pos.z - refPos.z)
end
end
M.vehiclePlayersMap[vehId] = {}
end
Callers