Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17d90c2699 | |||
| 5929cdff5f | |||
| 5eaf701f91 | |||
| 11cad0c721 | |||
| 014cc7dc20 |
@@ -15,7 +15,8 @@
|
||||
|
||||
local M = {}
|
||||
|
||||
M.dependencies = { 'career_modules_inventory', 'freeroam_facilities', "career_vehicleSaveSystem" }
|
||||
M.dependencies = { 'career_modules_inventory', 'freeroam_facilities', "career_vehicleSaveSystem",
|
||||
"career_modules_permissions", 'career_modules_valueCalculator' }
|
||||
|
||||
local career_modules_inventory_removeVehicleObject
|
||||
local vehicleObjectsToRemove = {}
|
||||
@@ -28,31 +29,54 @@ local function spawnVehicle(inventoryId, callback)
|
||||
end
|
||||
end
|
||||
|
||||
local function Retrieve()
|
||||
local fav_veh_id = career_modules_inventory.getFavoriteVehicle()
|
||||
local function Retrieve(inventoryId)
|
||||
career_vehicleSaveSystem.QueueVehicleToSave(inventoryId)
|
||||
if not career_vehicleSaveSystem.SaveVehicle(inventoryId) then
|
||||
career_vehicleSaveSystem.QueuedVehicleSaved(inventoryId)
|
||||
end
|
||||
|
||||
extensions.core_jobsystem.create(
|
||||
function(job)
|
||||
spawnVehicle(fav_veh_id, function()
|
||||
local veh = be:getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(fav_veh_id))
|
||||
local location = { pos = veh:getPosition(), rot = quat(0, 0, 1, 0) * quat(veh:getRefNodeRotation()) }
|
||||
local garage = career_modules_inventory.getClosestGarage(location.pos)
|
||||
job.sleep(1)
|
||||
career_vehicleSaveSystem.LoadVehicle(fav_veh_id)
|
||||
freeroam_facilities.teleportToGarage(garage.id, veh, false)
|
||||
end)
|
||||
end
|
||||
)
|
||||
local vehicleValue = career_modules_valueCalculator.getInventoryVehicleValue(inventoryId, true)
|
||||
local currentVehicleValue = career_modules_valueCalculator.getInventoryVehicleValue(inventoryId)
|
||||
|
||||
career_vehicleSaveSystem.CheckSavedAsync(function()
|
||||
extensions.core_jobsystem.create(
|
||||
function(job)
|
||||
spawnVehicle(inventoryId, function()
|
||||
local veh = be:getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(inventoryId))
|
||||
local location = { pos = veh:getPosition(), rot = quat(0, 0, 1, 0) * quat(veh:getRefNodeRotation()) }
|
||||
local garage = career_modules_inventory.getClosestGarage(location.pos)
|
||||
job.sleep(1)
|
||||
if currentVehicleValue < vehicleValue then
|
||||
career_vehicleSaveSystem.LoadVehicle(inventoryId)
|
||||
else
|
||||
log('I', 'retrieval', 'retrieving vehicle ' .. inventoryId .. " in an undamaged state")
|
||||
end
|
||||
freeroam_facilities.teleportToGarage(garage.id, veh, false)
|
||||
end)
|
||||
end
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
local function onComputerAddFunctions(menuData, computerFunctions)
|
||||
if menuData.computerFacility.functions["vehicleInventory"] then
|
||||
local favouriteVehicleId = career_modules_inventory.getFavoriteVehicle()
|
||||
|
||||
local computerFunctionData = {
|
||||
id = "retrieve_damaged",
|
||||
label = "Retrieve Favourite Damaged",
|
||||
callback = Retrieve,
|
||||
callback = function() Retrieve(favouriteVehicleId) end,
|
||||
order = 1
|
||||
}
|
||||
|
||||
local repairPermission = career_modules_permissions.getStatusForTag("vehicleRepair",
|
||||
{ inventoryId = favouriteVehicleId })
|
||||
|
||||
if not repairPermission["allow"] then
|
||||
computerFunctionData.disabled = true
|
||||
computerFunctionData.reason = { type = "text", label = "Vehicle is being repaired." }
|
||||
end
|
||||
|
||||
if menuData.tutorialPartShoppingActive or menuData.tutorialTuningActive then
|
||||
computerFunctionData.disabled = true
|
||||
computerFunctionData.reason = career_modules_computer.reasons.tutorialActive
|
||||
|
||||
Reference in New Issue
Block a user