insertVehicle
Definition
-- @/lua/ge/extensions/gameplay/parking.lua:522
local function insertVehicle(id) -- inserts a new vehicle into the parked cars table
local obj = getObjectByID(id)
if obj then
if not vehPool then
vehPool = core_vehicleActivePooling.createPool()
vehPool.name = "parkedCars"
end
obj.uiState = 0
obj.playerUsable = false
obj:setDynDataFieldbyName("ignoreTraffic", 0, "true")
obj:setDynDataFieldbyName("isParked", 0, "true")
gameplay_walk.addVehicleToBlacklist(id)
table.insert(parkedVehIds, id)
vehPool:insertVeh(id)
local psId = getCurrentParkingSpot(id)
if psId then
sites.parkingSpots.objects[psId].vehicle = id -- saves the vehicle id to this spot
end
parkedVehData[id] = {
parkingSpotId = psId, -- current parking spot id
activeRadius = 50, -- radius that keeps the vehicle active if player is near
randomPaint = true -- randomizes paint after respawning
}
end
end
Callers
@/lua/ge/extensions/editor/aiTests.lua
local function insertVehicle(id) -- adds an AI vehicle to use for the tests
local obj = getObjectByID(id or 0)
local id = v:getId()
insertVehicle(id)
end
@/lua/ge/extensions/gameplay/parking.lua
for _, id in ipairs(vehIds) do
insertVehicle(id)
end