Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17d90c2699 | |||
| 5929cdff5f | |||
| 5eaf701f91 | |||
| 11cad0c721 | |||
| 014cc7dc20 |
@@ -15,7 +15,8 @@
|
|||||||
|
|
||||||
local M = {}
|
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 career_modules_inventory_removeVehicleObject
|
||||||
local vehicleObjectsToRemove = {}
|
local vehicleObjectsToRemove = {}
|
||||||
@@ -28,31 +29,54 @@ local function spawnVehicle(inventoryId, callback)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Retrieve()
|
local function Retrieve(inventoryId)
|
||||||
local fav_veh_id = career_modules_inventory.getFavoriteVehicle()
|
career_vehicleSaveSystem.QueueVehicleToSave(inventoryId)
|
||||||
|
if not career_vehicleSaveSystem.SaveVehicle(inventoryId) then
|
||||||
|
career_vehicleSaveSystem.QueuedVehicleSaved(inventoryId)
|
||||||
|
end
|
||||||
|
|
||||||
|
local vehicleValue = career_modules_valueCalculator.getInventoryVehicleValue(inventoryId, true)
|
||||||
|
local currentVehicleValue = career_modules_valueCalculator.getInventoryVehicleValue(inventoryId)
|
||||||
|
|
||||||
|
career_vehicleSaveSystem.CheckSavedAsync(function()
|
||||||
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)
|
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)
|
freeroam_facilities.teleportToGarage(garage.id, veh, false)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
end)
|
||||||
end
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user