//gas.
local gas = 0

local CV_Gas = CV_RegisterVar{
	name = 'gas',
	defaultvalue = '1',
	flags = CV_NETVAR,
	PossibleValue = {MIN = 0, MAX = 1}
}

local CV_GasMusc = CV_RegisterVar{
	name = 'gasmusic',
	defaultvalue = '1',
	flags = 0,
	PossibleValue = {MIN = 0, MAX = 1}
}

addHook("MapChange", do
	gas = 0
end)

addHook("ThinkFrame", do
	for p in players.iterate
		if (CV_Gas.value == 1)
			if (gas >= 0)
				gas = p.realtime
			end
			if (CV_GasMusc.value == 1) and (gas > 0)
				COM_BufInsertText(p, "tunes \"GAS\"")
			end
			if (gas >= 1424) and not (p.kartstuff[k_spinouttimer]) and not (p.kartstuff[k_wipeoutslow]) and not (p.exiting)
				p.kartstuff[k_sneakertimer] = 10
			end
			if (gas >= 2735) and not (gas >= 3608)
				p.kartstuff[k_boostpower] = FRACUNIT+(FRACUNIT/6)
			end
			if (gas >= 3608) and not (gas >= 4916)
				p.kartstuff[k_boostpower] = FRACUNIT+(FRACUNIT/4)
			end
			if (gas >= 4916) and not (gas >= 6229)
				p.kartstuff[k_boostpower] = FRACUNIT+(FRACUNIT/2)
			end
			if (gas >= 6229) and not (gas >= 7591)
				p.kartstuff[k_boostpower] = FRACUNIT+FRACUNIT
			end
			if (gas >= 7591)
				p.kartstuff[k_boostpower] = FRACUNIT+FRACUNIT+(FRACUNIT/6)
			end
		end
	end
end)

//blast off!