summaryrefslogtreecommitdiff
path: root/scripts/gugus/dev.lua
blob: ba4061b18a2653f3fd5bca26017d3e5f6ae3f390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

--require("scripts/gugus/sector")

-- hint : i don’t care if this is correctly initialized at each session.
mCurrentSector = nil
function custom_deviceReport(deviceType)
	-- sim paused?
	local paused = GetContextInfo("paused")
	if !paused then
		local sector = GetCarInfo("sector")
		if mCurrentSector == nil or mCurrentSector ~= sector then

			local s1 = GetTimeInfo("sector1")
			local s2 = GetTimeInfo("sector2")
			local s3 = GetTimeInfo("sector3")

			local ls1 = GetTimeInfo("lastsector1")
			local ls2 = GetTimeInfo("lastsector2")
			local ls3 = GetTimeInfo("lastsector3")

			local bs1 = GetTimeInfo("bestsector1")
			local bs2 = GetTimeInfo("bestsector2")
			local bs3 = GetTimeInfo("bestsector3")

			print ("")
			print ("--- lap "..GetContextInfo("laps").." ----------------------------------------")
			print ("sector " ..mCurrentSector.." -> "..sector.." [curr] " .. s1 .. " - " .. s2 .. " - " .. s3)
			print ("sector " ..mCurrentSector.." -> "..sector.." [last] " ..ls1 .. " - " ..ls2 .. " - " ..ls3)
			print ("sector " ..mCurrentSector.." -> "..sector.." [best] " ..bs1 .. " - " ..bs2 .. " - " ..bs3)
			print ("-----------------------------------------------------------------------------")

			--ls = GetTimeInfo(string.format("sector%d", mCurrentSector))
			--if mCurrentOptimalSectorTimes[sector] ~= 0.0 and mCurrentOptimalSectorTimes[sector] > ls then
			--	mCurrentOptimalSectorTimes[sector] = ls
			--end

			mCurrentSector = sector
		end
	end

	return 2

end

print ("gugus> + sector")