-- EASING --
local path = GAMESTATE:GetCurrentSong():GetSongDir()..'lua/'
local images = FILEMAN:GetDirListing(GAMESTATE:GetCurrentSong():GetSongDir()..'lua/car/')
loadfile(path..'easing.lua')()

LIST_ACTORS = false

checked = false

local linear, inQuad, outQuad, inOutQuad, outInQuad, inCubic, outCubic, inOutCubic, outInCubic, inQuart,outQuart, inOutQuart, outInQuart, inQuint, outQuint, inOutQuint, outInQuint, inSine, outSine, inOutSine,outInSine, inExpo, outExpo, inOutExpo, outInExpo, inCirc, outCirc, inOutCirc, outInCirc, inElastic,outElastic, inOutElastic, outInElastic, inBack, outBack, inOutBack, outInBack, inBounce, outBounce,inOutBounce, outInBounce = ease.linear, ease.inQuad, ease.outQuad, ease.inOutQuad, ease.outInQuad,ease.inCubic, ease.outCubic, ease.inOutCubic, ease.outInCubic, ease.inQuart, ease.outQuart,ease.inOutQuart, ease.outInQuart, ease.inQuint, ease.outQuint, ease.inOutQuint, ease.outInQuint,ease.inSine, ease.outSine, ease.inOutSine, ease.outInSine, ease.inExpo, ease.outExpo, ease.inOutExpo,ease.outInExpo, ease.inCirc, ease.outCirc, ease.inOutCirc, ease.outInCirc, ease.inElastic,ease.outElastic, ease.inOutElastic, ease.outInElastic, ease.inBack, ease.outBack, ease.inOutBack,ease.outInBack, ease.inBounce, ease.outBounce, ease.inOutBounce, ease.outInBounce

	sw = SCREEN_WIDTH
	sh = SCREEN_HEIGHT --shortcuts
	
	scx = sw/2
	scy = sh/2
	
local po = {GAMESTATE:GetPlayerState(0):GetPlayerOptions'ModsLevel_Song', GAMESTATE:GetPlayerState(1):GetPlayerOptions'ModsLevel_Song'}
function mod_do(str,pn)
	--if pn then if GAMESTATE:IsPlayerEnabled(pn-1) then handle_mods(str,pn) end
	--else for pn=1,2 do if GAMESTATE:IsPlayerEnabled(pn-1) then handle_mods(str,pn) end end end
	
    if pn then
        po[pn]:FromString(str)
    else
        po[1]:FromString(str)
        po[2]:FromString(str)
    end
end

_numplayers = 0
local _diff = {0,0}
if GAMESTATE:IsHumanPlayer(PLAYER_1) then
	local stepsr = (GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty())
	if stepsr == "Difficulty_Beginner" then _diff[1] = 0 end
	if stepsr == "Difficulty_Easy" then _diff[1] = 1 end
	if stepsr == "Difficulty_Medium" then _diff[1] = 2 end
	if stepsr == "Difficulty_Hard" then _diff[1] = 3 end
	if stepsr == "Difficulty_Challenge" then _diff[1] = 4 end
	_numplayers = _numplayers+1
end
if GAMESTATE:IsHumanPlayer(PLAYER_2) then
	local stepsr = (GAMESTATE:GetCurrentSteps(PLAYER_2):GetDifficulty())
	if stepsr == "Difficulty_Beginner" then _diff[2] = 0 end
	if stepsr == "Difficulty_Easy" then _diff[2] = 1 end
	if stepsr == "Difficulty_Medium" then _diff[2] = 2 end
	if stepsr == "Difficulty_Hard" then _diff[2] = 3 end
	if stepsr == "Difficulty_Challenge" then _diff[2] = 4 end
	_numplayers = _numplayers+1
end

--print("tech num players: ".._numplayers)

-- thank u ky dashiel
local poptions = {GAMESTATE:GetPlayerState(0):GetPlayerOptions('ModsLevel_Song'), GAMESTATE:GetPlayerState(1):GetPlayerOptions('ModsLevel_Song')}
_isusingreverse = {false, false}
_miniscale = {1,1}
for pn = 1, 2 do
	if poptions[pn] then
		_isusingreverse[pn] = poptions[pn]:Reverse() ~= 0
		_miniscale[pn] = (200 - poptions[pn]:Mini()) * 0.005
	end
end

			sw,sh = SCREEN_WIDTH,SCREEN_HEIGHT
			
			curmod = 1
			m_current = {{},{}}
			m_lastframe = {{},{}}
			m_startv = {{},{}}
			m_startt = {{},{}}
			m_endv = {{},{}}
			m_len = {{},{}}
			m_ease = {{},{}}
			m_opt1 = {{},{}}
			m_opt2 = {{},{}}
			m_tweening = {{},{}}
			modnames = {}
			m_isreal = {} --REAL mods that are part of the engine
			
			function definemod(name,initv,real)
				if not initv then initv = 0 end
				if real == nil then real = true end
				table.insert(modnames,name)
				m_isreal[name] = real
				for pn=1,2 do
					m_tweening[pn][name] = false
					m_current[pn][name] = initv
					m_lastframe[pn][name] = -1
					m_startv[pn][name] = initv
					m_endv[pn][name] = initv
					m_startt[pn][name] = 0
					m_len[pn][name] = 0
					m_opt1[pn][name] = 0
					m_opt2[pn][name] = 0
					m_ease[pn][name] = linear
				end
			end
			
			function modulo(a, b)
				return a - math.floor(a/b)*b;
			end
			
			function randomXD(t)
				if t == 0 then return 0.5 else
				return modulo(math.sin(t * 3229.3) * 43758.5453, 1) end
			end
			
			--regular ass mods
			definemod('drunk')
			definemod('tipsy')
			definemod('stealth')
			definemod('sudden')
			definemod('suddenoffset')
			definemod('brake')
			definemod('beat')
			definemod('tiny')
			definemod('dark')
			definemod('flip')
			definemod('invert')
			definemod('centered')
			definemod('split')
			definemod('cross')
			definemod('alternate')
			definemod('reverse')
			definemod('hallway')
			definemod('distant')
			definemod('confusionoffset')
			definemod('cover')
			for i=1,8 do
				definemod('movex'..i)
				definemod('movey'..i)
				definemod('dark'..i)
				definemod('tiny'..i)
				definemod('confusionoffset'..i)
			end
			
			--tweens as mods lol
			definemod('x',0,false)
			definemod('y',0,false)
			definemod('z',0,false)
			definemod('rotationx',0,false)
			definemod('rotationy',0,false)
			definemod('rotationz',0,false)
			definemod('skewx',0,false)
			definemod('zoomx',1,false)
			definemod('zoomy',1,false)
			definemod('zoomz',1,false)
			definemod('zoom',1,false)

			definemod('screenvibby',0,false)
			definemod('thewagger',0,false)
			
			mods, ma, ca, mfsb = {}, {}, 1, GAMESTATE:GetSongBeat();
			local me, m2 = function (t)
				local beat,len,ease,str1,mod = unpack(t)
				for pn=1,2 do
					--print(_diff[pn],t.min)
					if not t.min and not t.only or t.only and _diff[pn] == t.only or t.min and _diff[pn] >= t.min then
						if not t.plr or pn == t.plr then
							table.insert(mods,{beat,len,ease,str1,mod,startVal=t.startVal,opt1=t.opt1,opt2=t.opt2,plr=t.plr})
						end
					end
				end
			end, function (beat,fun,per) table.insert(ma,{beat,fun,per}) end
			function ome(t)
				me{t[1],t[2],t[3],startVal=t[4],t[5],t[6],min=t.min,only=t.only,opt1=t.opt1,opt2=t.opt2,plr=t.plr}
			end
			
			capturedOrig = false
			origx = {SCREEN_WIDTH*0.25,SCREEN_WIDTH*0.75}
			origy = {SCREEN_HEIGHT*0.5,SCREEN_HEIGHT*0.5}
			origz = {0,0}
			
			function sm2(t)
				local b,l,e,v2,v1,mo = unpack(t)
				me{b-.05,.1,linear,v2,mo,min=t.min,plr=t.plr,only=t.only,opt1=t.opt1,opt2=t.opt2}
				me{b+.05,l-.05,e,v1,mo,min=t.min,plr=t.plr,only=t.only,opt1=t.opt1,opt2=t.opt2}
			end
			
			function set(t)
				local b,v1,mo = unpack(t)
				me{b,0,linear,v1,mo,min=t.min,plr=t.plr,only=t.only}
				return set
			end
			
			_anyplayers = false
			_firstplayer = -1
			
			m2(0,function()
				for pn=1,2 do
					local a = SCREENMAN:GetTopScreen():GetChild('PlayerP'..pn)
					
					local darkSize = math.min((SCREEN_WIDTH*.5)/320,SCREEN_HEIGHT/480)
					
					if a then
						origx[pn] = a:GetX()
						origy[pn] = a:GetY()
						origz[pn] = a:GetZ()
						
						_anyplayers = true
						if _firstplayer == -1 then
							_firstplayer = pn
						end
						
					end
					
				end
				if _firstplayer == -1 then
					_firstplayer = 1
				end
				capturedOrig = true
			end,true)
			
			
			--thanks mr thatkid!!!
			local log0_5 = 1/math.log(0.5)
			--Save this so we do one less math.log & division every call, maybe.

			local skawx = function(x)
				for i = 1, 2 do
					if mod_plr[i] then
						mod_plr[i]:skewx(x/100)
					end
				end
			end
			
			function SM5Tiny(amt)
				--takes a nitg tiny% and returns a sm5 tiny%
				--return amt --in nitg, just return base val
				return (math.log(1-0.5*(amt*0.01))*log0_5)*100
			end

			for pn = 1, 2 do
				if _isusingreverse[pn] then
					me{0,.1,linear,100,'reverse',plr=pn}
				end
				me{288, 0.5, outExpo, math.random(1,360), 'rotationz', plr=pn}
			end

			ome{0, 2, inExpo, -10, 0, 'rotationz'}
			ome{0, 2, inExpo, SM5Tiny(100), 0, 'tiny'}
			ome{3, 2, outBounce, 100, 0, 'drunk'}
			ome{3, 2, outBounce, 100, 0, 'tipsy'}
			
			local oppositeday = 1
			local function thedoor(beat)
				me{beat, 0.5, outQuad, -15*oppositeday/100, 'skewx'}
				me{beat+.5, 0.5, outQuad, 0, 'skewx'}
				oppositeday = -oppositeday
			end
			local function thecar(beat)
				me{beat, 0.25, outCirc, 25, 'brake'}
				me{beat+0.25, 0.25, inCirc, 0, 'brake'}
				me{beat+0.5, 0.5, outCirc, 25, 'brake'}
				me{beat+1, 0.5, inCirc, 0, 'brake'}
			end
			local function thedogtoy(beat)
				me{beat, 0.5, outCirc, 10, 'flip'}
				me{beat+.5, 0.5, outCirc, -10, 'flip'}
				me{beat+1, 0.5, outCirc, 0, 'flip'}
			end
			local function theswift(beat)
				ome{beat, 1, outCirc, -628, 0, 'confusionoffset1'}
				ome{beat+.25, 1, outCirc, 628, 0, 'confusionoffset4'}
				ome{beat+.5, 1, outCirc, 628, 0, 'confusionoffset2'}
				ome{beat+.5, 1, outCirc, -628, 0, 'confusionoffset3'}
			end
			local function thebananapeel(beat)
				me{beat, 0.5, outExpo, 50*oppositeday, 'drunk'}
				me{beat+.5, 0.75, outExpo, 0, 'drunk'}
				me{beat+.5, 0.5, outExpo, 50*oppositeday, 'tipsy'}
				me{beat+1, 0.5, inExpo, 0, 'tipsy'}
				oppositeday = -oppositeday
			end
			local function thecrasher(beat)
				me{beat, 0.25, outCirc, 15, 'flip'}
				ome{beat+.25, 1, outCirc, -25, 0, 'flip'}
			end
			local function thecranker(beat)
				ome{beat, 0.5, outCirc, 314, 0, 'confusionoffset'}
				ome{beat+.5, 1, outCirc, SM5Tiny(-50), 0, 'tiny'}
				ome{beat+.5, 1, outCirc, 15*oppositeday, 0, 'rotationz'}
				oppositeday = -oppositeday
			end
			local function theclownjuice(beat)
				me{beat, 0.25, outCirc, 5*oppositeday, 'rotationz'}
				me{beat+.25, 0.25, outCirc, 0, 'rotationz'}
				ome{beat+.5, 1, outBack, 150*oppositeday, 0, 'drunk'}
				ome{beat+.5, 1, outBack, 150*oppositeday, 0, 'tipsy'}
				oppositeday = -oppositeday
			end
			local function theclownjuice2(beat)
				ome{beat, 0.25, outCirc, 5*oppositeday, 0, 'rotationz'}
				ome{beat+.25, 1, outBack, 150*oppositeday, 0, 'drunk'}
				ome{beat+.25, 1, outBack, 150*oppositeday, 0, 'tipsy'}
				oppositeday = -oppositeday
			end

			thedoor(7)
			thecar(10.5)
			thedogtoy(14.5)
			theswift(18.5)
			thecar(26.5)
			thebananapeel(62.5)
			thecrasher(66.75)
			thecranker(70.5)
			theclownjuice(74.5)
			thebananapeel(78.5)
			thecrasher(82.75)
			thecranker(84.5)
			thecranker(86.5)
			thecranker(88.5)
			theclownjuice(90.5)
			thedoor(95)
			thecar(98.5)
			thecrasher(98.75)
			thecranker(102.5)
			thedogtoy(102.5)
			theclownjuice(106.5)
			thedoor(111)
			thecar(114.5)
			thecrasher(114.75)
			thecranker(116.5)
			thecranker(118.5)
			thecranker(120.5)
			theclownjuice(122.5)
			theclownjuice2(138.75)
			theclownjuice2(140.75)
			theclownjuice2(142.75)
			theclownjuice2(144.75)
			theclownjuice2(146.75)
			theclownjuice2(147.75)
			theclownjuice2(148.75)
			theclownjuice2(149.75)
			theclownjuice2(150.75)
			thebananapeel(234.5)
			thecrasher(237.75)
			thecranker(241.5)
			theclownjuice(244.5)
			thebananapeel(248.5)
			thecrasher(251.75)
			thecranker(253.5)
			thecranker(255.5)
			thecranker(257.5)
			theclownjuice(259.5)
			thedoor(263)
			thecrasher(265.75)
			thecranker(269.5)
			thedogtoy(269.5)
			theclownjuice(272.5)
			thedoor(277)
			thecrasher(279.75)
			thecar(280.5)
			thecranker(281.5)
			thecranker(283.5)
			thecranker(285.5)
			theclownjuice(287.5)

			local function airisfree(beat)
				me{beat, 0.5, outCirc, SM5Tiny(-50), 'tiny'}
				me{beat, 0.5, outCirc, 10, 'brake'}
				me{beat+.5, 0.5, outQuad, 0, 'tiny'}
				me{beat+.5, 0.5, outQuad, 0, 'brake'}
			end

			airisfree(21)
			airisfree(23)
			airisfree(25)
			airisfree(27)
			airisfree(28.5)
			airisfree(29.5)
			airisfree(30.5)
			airisfree(31.5)

			ome{32, 16, linear, 25, 0, 'screenvibby'}
			me{32, 8, linear, 100, 'dark'}
			me{52, 3, linear, 60, 'dark'}
			me{59, 1, linear, 0, 'dark'}

			ome{56, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{57, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{58, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{59, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}

			me{151, 0.5, outCirc, SM5Tiny(-75), 'tiny'}
			me{151, 0.5, outCirc, 35, 'brake'}
			me{151.5, 0.5, inCirc, SM5Tiny(15), 'tiny'}
			me{151.5, 0.5, inCirc, 0, 'brake'}
			me{152, 32, linear, SM5Tiny(50), 'tiny'}
			me{152, 32, linear, 2, 'thewagger'}
			me{205, 1, linear, 0, 'thewagger'}
			me{205, 8, linear, 0, 'tiny'}
			me{205, 8, linear, 60, 'dark'}
			me{229, 3, linear, 0, 'dark'}

			ome{205, 20, linear, 50, 0, 'screenvibby'}

			ome{229, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{230, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{231, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}

			ome{257, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{258, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}
			ome{259, 1, outExpo, SM5Tiny(-50), 0, 'tiny'}

			-- bg
			me{31.5, 0.5, inCirc, 100, 'cover'}
			me{57, 3, inCirc, 0, 'cover'}
			me{148, 4, linear, 100, 'cover'}

			me{229, 0.5, outCirc, 75, 'cover'}
			me{230, 0.5, outCirc, 50, 'cover'}
			me{231, 0.5, outCirc, 25, 'cover'}
			me{232, 0.5, outCirc, 0, 'cover'}
			me{288, 0.5, outCirc, 0, 'cover'}

			-- the rest
			
			function cmp(a,b)
				return a[1] < b[1]
			end
			if table.getn(ma) > 1 then
				table.sort(ma, cmp)
			end
			if table.getn(mods) > 1 then
				table.sort(mods, cmp)
			end

local ac = Def.ActorFrame{
	
	Def.Actor{
		OnCommand=function(s)
			s:queuecommand('Loop')
		end,
		LoopCommand=function(self)
			local beat = GAMESTATE:GetSongBeat()
			if beat > mfsb+0.1 then
				
				while curmod <= #mods and beat > mods[curmod][1] do
					local v = mods[curmod]
					
					local mn = v[5]
					local dur = v[2]
					if v.timing and v.timing == 'end' then
						dur = v[2]-v[1]
					end
					
					print('launch attack '..v[4]..' '..mn..' at beat '..v[1])
					
					if v.plr and not v.pn then v.pn = v.plr end
					
					for pn=1,2 do
						if not v.pn or pn == v.pn then
							m_startt[pn][mn] = v[1]
							m_len[pn][mn] = dur
							m_ease[pn][mn] = v[3]
							if v.startVal then
								m_startv[pn][mn] = v.startVal
							else
								m_startv[pn][mn] = m_current[pn][mn]
							end
							if v.add then
								m_endv[pn][mn] = m_current[pn][mn]+v[4]
							else
								m_endv[pn][mn] = v[4]
							end
							m_opt1[pn][mn] = v.opt1
							m_opt2[pn][mn] = v.opt2
							m_tweening[pn][mn] = true
						end
					end
					
					curmod = curmod+1
				end
				
				for pn=1,2 do
					for _,v in pairs(modnames) do
						if m_tweening[pn][v] then
							local curtime = beat - m_startt[pn][v]
							local duration = m_len[pn][v]
							local startstrength = m_startv[pn][v]
							local diff = m_endv[pn][v] - startstrength
							local curve = m_ease[pn][v]
							local strength = curve(curtime, startstrength, diff, duration, m_opt1[pn][v], m_opt2[pn][v])
							m_current[pn][v] = strength
							if beat > m_startt[pn][v]+duration then
								m_tweening[pn][v] = false
							end
						else
							m_current[pn][v] = m_endv[pn][v]
						end
					end
				end
				
				--ONLY apply mods if there were changes THIS frame
				for pn=1,2 do
					local mstr = ''
					for _,v in pairs(modnames) do
						if m_isreal[v] and m_lastframe[pn][v] ~= m_current[pn][v] then
							mstr = mstr..'*10000 '..m_current[pn][v]..' '..v..','
							m_lastframe[pn][v] = m_current[pn][v]
						end
					end
					if mstr ~= '' then
						mod_do(mstr,pn)
					end
				end
				
				if capturedOrig then
					SCREENMAN:GetTopScreen():vibrate()
					for pn=1,2 do
						local a = SCREENMAN:GetTopScreen():GetChild('PlayerP'..pn)
						if a then
							a:x(origx[pn]+m_current[pn].x*SCREEN_HEIGHT/480)
							if _isusingreverse[pn] then
								a:y(origy[pn]-m_current[pn].y*SCREEN_HEIGHT/480)
							else
								a:y(origy[pn]+m_current[pn].y*SCREEN_HEIGHT/480)
							end
							a:z(origz[pn]+m_current[pn].z)
							if _isusingreverse[pn] then
								a:rotationx(-m_current[pn].rotationx)
							else
								a:rotationx(m_current[pn].rotationx)
							end
							a:rotationy(m_current[pn].rotationy)
							a:rotationz(m_current[pn].rotationz)
							a:skewx(m_current[pn].skewx)
							a:basezoomx(m_current[pn].zoomx*m_current[pn].zoom)
							a:basezoomy(m_current[pn].zoomy*m_current[pn].zoom)
							a:zoomz(m_current[pn].zoomz*m_current[pn].zoom)
							a:wag()
							a:effectmagnitude(0,0,m_current[pn].thewagger)
							a:effectperiod(1)
							a:effectclock('bgm')
							SCREENMAN:GetTopScreen():effectmagnitude(m_current[pn].screenvibby,0,0)
						end
					end
					
				end
				
				while ca<=table.getn(ma) and GAMESTATE:GetSongBeat()>=ma[ca][1] do
					if ma[ca][3] or GAMESTATE:GetSongBeat() < ma[ca][1]+2 then
						ma[ca][2]()
					end
					ca = ca+1
				end
			end
			self:sleep(1/60) self:queuecommand('Loop')
		end
	},

	Def.Sprite{
		Delay0000= 0.1,
		Delay0001= 0.1,
		Delay0002= 0.1,
		Delay0003= 0.1,
		Delay0004= 0.1,
		Delay0005= 0.1,
		Delay0006= 0.1,
		Delay0007= 0.1,
		Delay0008= 0.1,
		Delay0009= 0.1,
		Delay0010= 0.1,
		Delay0011= 0.1,
		Delay0012= 0.1,
		Delay0013= 0.1,
		Delay0014= 0.1,
		Delay0015= 0.1,
		Delay0016= 0.1,
		Delay0017= 0.1,
		Delay0018= 0.1,
		Delay0019= 0.1,
		Delay0020= 0.1,
		Delay0021= 0.1,
		Delay0022= 0.1,
		Delay0023= 0.1,
		Delay0024= 0.1,
		Frame0000= 0,
		Frame0001= 1,
		Frame0002= 2,
		Frame0003= 3,
		Frame0004= 4,
		Frame0005= 5,
		Frame0006= 6,
		Frame0007= 7,
		Frame0008= 8,
		Frame0009= 9,
		Frame0010= 10,
		Frame0011= 11,
		Frame0012= 12,
		Frame0013= 13,
		Frame0014= 14,
		Frame0015= 15,
		Frame0016= 16,
		Frame0017= 17,
		Frame0018= 18,
		Frame0019= 19,
		Frame0020= 20,
		Frame0021= 21,
		Frame0022= 22,
		Frame0023= 23,
		Frame0024= 24,
		InitCommand= function(self) _boom = self; self:SetTextureFiltering(false) end,
		OnCommand= cmd(diffusealpha,1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoom,15;visible,0;hibernate,13.7145;visible,1;linear,2;diffusealpha,0;),
		Texture= "explosion 5x5.png",
	},

	Def.Sprite{
		InitCommand= function(self) _blue = self; self:SetTextureFiltering(false) end,
		OnCommand= cmd(fadebottom,0.5;basezoom,2;diffusealpha,0;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-720;visible,1;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;hibernate,61.2852;linear,2;diffusealpha,0.5;y,SCREEN_CENTER_Y;sleep,7;linear,1;diffusealpha,0;),
		Texture='blue.png',
	},

	Def.Sprite{
		InitCommand= function(self) _toilettu = self; self:SetTextureFiltering(false); self:blend('add') end,
		OnCommand= cmd(diffusealpha,0;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;visible,1;hibernate,61.2852;linear,2;diffusealpha,0.25;y,SCREEN_CENTER_Y;zoom,1.5;sleep,7;linear,1;diffusealpha,0;),
		Texture='toilettu.mp4',
	},

	Def.Sprite{
		InitCommand= function(self) _car = self; self:SetTextureFiltering(false) end,
		OnCommand= cmd(diffusealpha,1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;visible,0;zoom,0;hibernate,71.358;visible,1;linear,1.8;zoom,1;diffusealpha,0.8;rotationx,360;rotationy,-360;rotationz,720;sleep,0.01;diffusealpha,0;),
		Texture='car/'..images[math.random(#images)]
	},

	Def.Sprite{
		Delay0000= 0.1,
		Delay0001= 0.1,
		Delay0002= 0.1,
		Delay0003= 0.1,
		Delay0004= 0.1,
		Delay0005= 0.1,
		Delay0006= 0.1,
		Delay0007= 0.1,
		Delay0008= 0.1,
		Delay0009= 0.1,
		Delay0010= 0.1,
		Delay0011= 0.1,
		Delay0012= 0.1,
		Delay0013= 0.1,
		Delay0014= 0.1,
		Delay0015= 0.1,
		Delay0016= 0.1,
		Delay0017= 0.1,
		Delay0018= 0.1,
		Delay0019= 0.1,
		Delay0020= 0.1,
		Delay0021= 0.1,
		Delay0022= 0.1,
		Delay0023= 0.1,
		Delay0024= 0.1,
		Frame0000= 0,
		Frame0001= 1,
		Frame0002= 2,
		Frame0003= 3,
		Frame0004= 4,
		Frame0005= 5,
		Frame0006= 6,
		Frame0007= 7,
		Frame0008= 8,
		Frame0009= 9,
		Frame0010= 10,
		Frame0011= 11,
		Frame0012= 12,
		Frame0013= 13,
		Frame0014= 14,
		Frame0015= 15,
		Frame0016= 16,
		Frame0017= 17,
		Frame0018= 18,
		Frame0019= 19,
		Frame0020= 20,
		Frame0021= 21,
		Frame0022= 22,
		Frame0023= 23,
		Frame0024= 24,
		InitCommand= function(self) _boom = self; self:SetTextureFiltering(false) end,
		OnCommand= cmd(diffusealpha,1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoom,32;visible,0;hibernate,73.015;visible,1;linear,2;diffusealpha,0;),
		Texture= "explosion 5x5.png",
	},

	Def.Quad{ InitCommand=cmd(visible,false), OnCommand=cmd(sleep,9E9) },
	
	--RECURSIVE DIGGER -Used to obtain all accessible screen elements
	Def.Quad{
		OnCommand=cmd(visible,false;sleep,1;queuecommand,"ListActors"),
		ListActorsCommand=function(self)
			
			if LIST_ACTORS then
				local file = RageFileUtil.CreateRageFile()
				local path=GAMESTATE:GetCurrentSong():GetSongDir();
				file:Open( path.."lua/TopscreenActorList.txt", 2 ) --2 = write
				
				file:PutLine("Actors part of TopScreen in "..THEME:GetCurThemeName())
				
				function listall(name, actor, level)
					--[[
					if name == "SongForeground" then
						local tabs = ''
						for i=1,level do
							tabs = tabs..'\t'
						end
						file:PutLine(tabs.."(SongForeground contains every actor placed into the fgchanges layer,")
						file:PutLine(tabs.."But that information is not relevant to this list)")
					end
					]]
					if string.sub(tostring(actor),1,10) == "ActorFrame" then
						local tabs = ''
						for i=1,level do
							tabs = tabs..'\t'
						end
						local str = tabs.."Actors part of "..name.." in "..THEME:GetCurThemeName()
						print(str)
						file:PutLine(str)
						for i,v in pairs(actor:GetChildren()) do
							if i and i~= "" then
								if string.sub(name,1,7) == "unnamed" then
									local str2 = tabs.."\tunnamed (within "..name.."):GetChild('"..i.."'); ("..tostring(v)..")"
									file:PutLine(str2);
									listall("unnamed (within "..name..")",v,level+1);
								else
									local str2 = tabs.."\tGetChild('"..name.."'):GetChild('"..i.."'); ("..tostring(v)..")"
									file:PutLine(str2);
									listall(i,v,level+1);
								end
							else
								local str3 = tabs.."\tunnamed actor in "..name.."... ("..tostring(v)..")"
								file:PutLine(str3);
								listall("unnamed (within "..name..")",v,level+1);
							end
						end
					end
				end
				
				local level = 1
				for i,v in pairs(SCREENMAN:GetTopScreen():GetChildren()) do
					if i and i~= "" then
						local str = "\tSCREENMAN:GetTopScreen():GetChild('"..i.."'); ("..tostring(v)..")"
						print(str)
						file:PutLine(str);
						listall(i,v,level+1);
					else
						local str = "\tunnamed actor... ("..tostring(v)..")"
						print(str)
						file:PutLine(str);
						listall("unnamed (top level)",v,level+1);
					end
				end
				
				file:Close();
			
			end
			
		end
	},
	
	Name= "xtl_actor_d",
	
}
return ac