resetCrawlData
Definition
-- @/lua/ge/extensions/gameplay/crawl/utils.lua:778
local function resetCrawlData(crawlerId, force)
if not crawlerId then
return false
end
local state = crawlStates[crawlerId]
if not state or not state.active then
return false
end
if state.isFromMission and not force then
log('W', logTag, 'Cannot reset mission crawl - use flowgraph node instead')
return false
end
state.currentPathnodeIndex = 1
state.completedPathnodes = {}
state.skippedPathnodes = {}
state.pathnodeTimings = {}
state.eventLog = {}
state.currentTime = 0
state.isCompleted = false
state.completionStartTime = 0
state.events = {}
state.crawlStarted = false
state.isDisqualified = false
state.recoveryCount = 0
if state.crawlerData then
state.crawlerData.points = 0
if state.crawlerData.infractionData then
state.crawlerData.infractionData.drivingBackwardsCooldown = 0
state.crawlerData.infractionData.drivingBackwardsDistance = 0
state.crawlerData.infractionData.boundaryViolationCooldown = 0
state.crawlerData.infractionData.recentlyRecovered = false
state.crawlerData.infractionData.recoveryCooldown = 0
if not state.crawlerData.infractionData.cooldowns then
state.crawlerData.infractionData.cooldowns = {}
end
if not state.crawlerData.infractionData.violations then
state.crawlerData.infractionData.violations = {}
end
else
state.crawlerData.infractionData = {
drivingBackwardsCooldown = 0,
drivingBackwardsDistance = 0,
boundaryViolationCooldown = 0,
recentlyRecovered = false,
recoveryCooldown = 0,
cooldowns = {},
violations = {}
}
end
end
gameplay_crawl_display.clearPointsMessage()
gameplay_crawl_display.showPointsMessage(0)
if gameplay_crawl_boundary and gameplay_crawl_boundary.clearCrawlerExitPoint then
gameplay_crawl_boundary.clearCrawlerExitPoint(crawlerId)
end
-- Clear lap times app when resetting
if core_lapTimes then
core_lapTimes.onRaceStop()
end
return true
end
Callers
@/lua/ge/extensions/gameplay/crawl/flowgraphBridge.lua
if not gameplay_crawl_utils.resetCrawlData(activeCrawlerId, true) then
return false
@/lua/ge/extensions/gameplay/crawl/crawlFlowgraphBridge.lua
gameplay_crawl_utils.resetCrawlData(bridgeState.activeCrawlerId)