Make Retrieve() Work With InventoryID

This commit is contained in:
snoutie 2025-03-06 18:09:31 +01:00
parent 0802e82456
commit 014cc7dc20

View File

@ -28,17 +28,15 @@ local function spawnVehicle(inventoryId, callback)
end end
end end
local function Retrieve() local function Retrieve(inventoryId)
local fav_veh_id = career_modules_inventory.getFavoriteVehicle()
extensions.core_jobsystem.create( extensions.core_jobsystem.create(
function(job) function(job)
spawnVehicle(fav_veh_id, function() spawnVehicle(inventoryId, function()
local veh = be:getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(fav_veh_id)) local veh = be:getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(inventoryId))
local location = { pos = veh:getPosition(), rot = quat(0, 0, 1, 0) * quat(veh:getRefNodeRotation()) } local location = { pos = veh:getPosition(), rot = quat(0, 0, 1, 0) * quat(veh:getRefNodeRotation()) }
local garage = career_modules_inventory.getClosestGarage(location.pos) local garage = career_modules_inventory.getClosestGarage(location.pos)
job.sleep(1) job.sleep(1)
career_vehicleSaveSystem.LoadVehicle(fav_veh_id) career_vehicleSaveSystem.LoadVehicle(inventoryId)
freeroam_facilities.teleportToGarage(garage.id, veh, false) freeroam_facilities.teleportToGarage(garage.id, veh, false)
end) end)
end end
@ -47,12 +45,15 @@ end
local function onComputerAddFunctions(menuData, computerFunctions) local function onComputerAddFunctions(menuData, computerFunctions)
if menuData.computerFacility.functions["vehicleInventory"] then if menuData.computerFacility.functions["vehicleInventory"] then
local favouriteVehicleId = career_modules_inventory.getFavoriteVehicle()
local computerFunctionData = { local computerFunctionData = {
id = "retrieve_damaged", id = "retrieve_damaged",
label = "Retrieve Favourite Damaged", label = "Retrieve Favourite Damaged",
callback = Retrieve, callback = function() Retrieve(favouriteVehicleId) end,
order = 1 order = 1
} }
if menuData.tutorialPartShoppingActive or menuData.tutorialTuningActive then if menuData.tutorialPartShoppingActive or menuData.tutorialTuningActive then
computerFunctionData.disabled = true computerFunctionData.disabled = true
computerFunctionData.reason = career_modules_computer.reasons.tutorialActive computerFunctionData.reason = career_modules_computer.reasons.tutorialActive