generateHashFromFile
Definition
-- @/lua/ge/extensions/gameplay/drag/saveSystem.lua:332
M.generateHashFromFile = function(vehicleId)
-- Generate a hash from vehicle config file for unique identification per config
if not vehicleId then
vehicleId = be:getPlayerVehicleID(0)
end
-- Get vehicle details to find the config file path
local vehicleDetails = core_vehicles.getVehicleDetails(vehicleId)
if not vehicleDetails or not vehicleDetails.current then
log('W', logTag, 'Could not get vehicle details for ID: ' .. tostring(vehicleId))
return "vehicle_" .. tostring(vehicleId)
end
-- Get the config file path (pc_file contains the full path to the .pc config file)
local configFile = vehicleDetails.current.pc_file
if not configFile or configFile == "" then
log('W', logTag, 'No config file path found for vehicle ID: ' .. tostring(vehicleId))
return "vehicle_" .. tostring(vehicleId)
end
-- Ensure it's a full path
if not string.find(configFile, "^/") then
configFile = "/" .. configFile
end
-- Hash the config file
if FS:fileExists(configFile) then
local hash = FS:hashFile(configFile)
if hash and hash ~= "" then
return hash
end
end
-- Fallback to vehicle ID if hashing fails
log('W', logTag, 'Failed to hash config file: ' .. configFile .. ', using vehicle ID fallback')
return "vehicle_" .. tostring(vehicleId)
end
Callers
@/lua/ge/extensions/gameplay/drag/dragBridge.lua
if vehicleId then
return saveSystem.generateHashFromFile(vehicleId)
else
else
return saveSystem.generateHashFromFile(be:getPlayerVehicleID(0))
end
@/lua/ge/extensions/gameplay/drag/saveSystem.lua
if racer.timers and racer.timers.time_1_4 and racer.isPlayable then
local timesKey = M.generateHashFromFile(vehId)
if rRacer.lane == racerInfo.laneNum then
racerInfo.configHash = M.generateHashFromFile(rVehId)
break
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/generateDragOpponents.lua
if configTimes then
local currentConfig = gameplay_drag_dragBridge.generateHashFromFile()
if configTimes[currentConfig] then
@/lua/ge/extensions/gameplay/drag/general.lua
local oldData = gameplay_drag_saveSystem.getDialTimes()
local timesKey = gameplay_drag_saveSystem.generateHashFromFile(vehicleId)