onActivityAcceptGatherData
Definition
-- @/lua/ge/extensions/gameplay/crawl/general.lua:234
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
if elem.type == "crawl" then
local trail = gameplay_crawl_saveSystem.getTrailById(elem.trailId)
local pathStats = nil
if trail.pathId then
pathStats = gameplay_crawl_utils.calculatePathStats(trail.pathId, trail.pathReversed)
end
local props = {}
if pathStats then
table.insert(props, {
icon = "ui_icons_distance",
keyLabel = "Distance",
valueLabel = string.format("%.1f m", pathStats.totalDistance)
})
if pathStats.elevationGain > 0 then
table.insert(props, {
icon = "ui_icons_elevation_up",
keyLabel = "Elevation Gain",
valueLabel = string.format("%.1f m", pathStats.elevationGain)
})
end
if pathStats.elevationLoss > 0 then
table.insert(props, {
icon = "ui_icons_elevation_down",
keyLabel = "Elevation Loss",
valueLabel = string.format("%.1f m", pathStats.elevationLoss)
})
end
end
local trailStats = gameplay_crawl_saveSystem.getPlayerTrailStats(elem.trailId)
if trailStats then
if trailStats.bestPenaltyPoints < math.huge then
table.insert(props, {
icon = "ui_icons_points",
keyLabel = "Best Penalty Points",
valueLabel = string.format("%d", trailStats.bestPenaltyPoints)
})
end
if trailStats.bestTime < math.huge then
table.insert(props, {
icon = "ui_icons_time",
keyLabel = "Best Time",
valueLabel = string.format("%.2fs", trailStats.bestTime)
})
end
if trailStats.attempts > 0 then
table.insert(props, {
icon = "ui_icons_attempts",
keyLabel = "Attempts",
valueLabel = tostring(trailStats.attempts)
})
end
end
local data = {
data = elem,
icon = "mission_rockcrawling01_triangle",
heading = trail.name,
preheadings = {"Freeroam Crawl"},
props = props,
buttonLabel = "Play",
buttonFun = function()
local veh = be:getPlayerVehicle(0)
if veh then
startCrawlFreeroam(trail, veh)
end
ui_missionInfo.closeDialogue()
end,
}
table.insert(activityData, data)
end
end
end
Callers
@/lua/ge/extensions/career/modules/inspectVehicle.lua
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
@/lua/ge/extensions/gameplay/missions/missions.lua
local function onActivityAcceptGatherData(elemData, activityData)
local missionElems = {}
@/lua/ge/extensions/career/modules/delivery/general.lua
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
@/lua/ge/extensions/freeroam/gasStations.lua
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
@/lua/ge/extensions/freeroam/facilities.lua
local function onActivityAcceptGatherData(elemData, activityData)
for _, elem in ipairs(elemData) do
@/lua/ge/extensions/core/sounds.lua
local function onActivityAcceptGatherData(elemData, activityData)
audioBlurLog('I','AUDIO',string.format("onActivityAcceptGatherData: elemData = %s, activityData = %s",dumps(elemData),(activityData)))