Initial Commit
This commit is contained in:
commit
4bdd73f121
82
lua/ge/extensions/career/retrievedamaged.lua
Normal file
82
lua/ge/extensions/career/retrievedamaged.lua
Normal file
@ -0,0 +1,82 @@
|
||||
local M = {}
|
||||
|
||||
M.dependencies = { 'career_career', 'career_modules_computer', 'career_modules_inventory', 'career_modules_payment',
|
||||
'career_modules_playerAttributes' }
|
||||
|
||||
local function tprint(tbl, indent)
|
||||
if not indent then indent = 0 end
|
||||
local toprint = string.rep(" ", indent) .. "{\r\n"
|
||||
indent = indent + 2
|
||||
for k, v in pairs(tbl) do
|
||||
toprint = toprint .. string.rep(" ", indent)
|
||||
if (type(k) == "number") then
|
||||
toprint = toprint .. "[" .. k .. "] = "
|
||||
elseif (type(k) == "string") then
|
||||
toprint = toprint .. k .. "= "
|
||||
end
|
||||
if (type(v) == "number") then
|
||||
toprint = toprint .. v .. ",\r\n"
|
||||
elseif (type(v) == "string") then
|
||||
toprint = toprint .. "\"" .. v .. "\",\r\n"
|
||||
elseif (type(v) == "table") then
|
||||
toprint = toprint .. tprint(v, indent + 2) .. ",\r\n"
|
||||
else
|
||||
toprint = toprint .. "\"" .. tostring(v) .. "\",\r\n"
|
||||
end
|
||||
end
|
||||
toprint = toprint .. string.rep(" ", indent - 2) .. "}"
|
||||
return toprint
|
||||
end
|
||||
|
||||
local function retrieve_favourite()
|
||||
local fav_veh_id = career_modules_inventory.getFavoriteVehicle()
|
||||
local vid = career_modules_inventory.getVehicleIdFromInventoryId(fav_veh_id)
|
||||
|
||||
if vid then
|
||||
local old_veh = be:getObjectByID(vid)
|
||||
old_veh:queueLuaCommand("beamstate.save()")
|
||||
end
|
||||
|
||||
extensions.core_jobsystem.create(
|
||||
function(job)
|
||||
job.sleep(0.2)
|
||||
local veh = career_modules_inventory.spawnVehicle(fav_veh_id, 2)
|
||||
local vehh = be:getObjectByID(career_modules_inventory.getVehicleIdFromInventoryId(fav_veh_id))
|
||||
local location = { pos = vehh:getPosition(), rot = quat(0, 0, 1, 0) * quat(vehh:getRefNodeRotation()) }
|
||||
local garage = career_modules_inventory.getClosestGarage(location.pos)
|
||||
freeroam_facilities.teleportToGarage(garage.id, vehh, false)
|
||||
veh:queueLuaCommand("beamstate.load()")
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local function onComputerAddFunctions(menuData, computerFunctions)
|
||||
if menuData.computerFacility.functions["vehicleInventory"] then
|
||||
local computerFunctionData = {
|
||||
id = "retrieve_damaged",
|
||||
label = "Retrieve Favourite Damaged",
|
||||
callback = retrieve_favourite,
|
||||
order = 1
|
||||
}
|
||||
if menuData.tutorialPartShoppingActive or menuData.tutorialTuningActive then
|
||||
computerFunctionData.disabled = true
|
||||
computerFunctionData.reason = career_modules_computer.reasons.tutorialActive
|
||||
end
|
||||
computerFunctions.general[computerFunctionData.id] = computerFunctionData
|
||||
end
|
||||
end
|
||||
|
||||
local function onSaveCurrentSaveSlot(currentSavePath, oldSaveDate, vehiclesThumbnailUpdate)
|
||||
local vs = career_modules_inventory.getVehicles()
|
||||
for id, _ in pairs(vs) do
|
||||
local vid = career_modules_inventory.getVehicleIdFromInventoryId(id)
|
||||
|
||||
local veh = be:getObjectByID(vid)
|
||||
veh:queueLuaCommand("beamstate.save()")
|
||||
end
|
||||
end
|
||||
|
||||
M.onSaveCurrentSaveSlot = onSaveCurrentSaveSlot
|
||||
M.onComputerAddFunctions = onComputerAddFunctions
|
||||
|
||||
return M
|
14
scripts/retrievedamagedcareer/modScript.lua
Normal file
14
scripts/retrievedamagedcareer/modScript.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local M = {}
|
||||
|
||||
M.dependencies = { 'career_career', 'career_modules_payment', 'career_modules_playerAttributes' }
|
||||
|
||||
--extensions.load("career_retrievedamaged")
|
||||
extensions.load("career_retrievedamaged")
|
||||
|
||||
M.onInit = function()
|
||||
setExtensionUnloadMode(M, "manual")
|
||||
end
|
||||
|
||||
print("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSA")
|
||||
|
||||
return M
|
Loading…
Reference in New Issue
Block a user