local M = {}		--cody by Inn0centJok3r +added shit by jsze xd
local timer = 0
local timer2 = 0
local timer3 = 0
local cycleComplete = 0
local cycleStarting = 0

local function onInit()
	electrics.values["signal_L_2"] = 0
    electrics.values["signal_L_3"] = 0
    electrics.values["signal_L_4"] = 0
    electrics.values["signal_L_5"] = 0
    electrics.values["signal_L_6"] = 0
    electrics.values["signal_L_7"] = 0
    electrics.values["signal_L_8"] = 0
    electrics.values["signal_L_9"] = 0
    electrics.values["signal_L_10"] = 0
    electrics.values["signal_L_11"] = 0
    electrics.values["signal_L_12"] = 0
    electrics.values["signal_L_13"] = 0
    electrics.values["signal_L_14"] = 0
    electrics.values["signal_L_15"] = 0
	
	electrics.values["signal_R_2"] = 0
    electrics.values["signal_R_3"] = 0
    electrics.values["signal_R_4"] = 0
    electrics.values["signal_R_5"] = 0
    electrics.values["signal_R_6"] = 0
    electrics.values["signal_R_7"] = 0
    electrics.values["signal_R_8"] = 0
    electrics.values["signal_R_9"] = 0
    electrics.values["signal_R_10"] = 0
    electrics.values["signal_R_11"] = 0
    electrics.values["signal_R_12"] = 0
    electrics.values["signal_R_13"] = 0
    electrics.values["signal_R_14"] = 0
    electrics.values["signal_R_15"] = 0
	timer2 = 0
	timer = 0
	cycleStarting = 0
	cycleComplete = 0
--Running light starting sequence
    electrics.values["inno_running_1"] = 1
	electrics.values["inno_running_2"] = 1
    electrics.values["inno_running_3"] = 1
    electrics.values["inno_running_4"] = 1
    electrics.values["inno_running_5"] = 1
    electrics.values["inno_running_6"] = 1
    electrics.values["inno_running_7"] = 1
    electrics.values["inno_running_8"] = 1
    electrics.values["inno_running_9"] = 1
    electrics.values["inno_running_10"] = 1
    electrics.values["inno_running_11"] = 1
    electrics.values["inno_running_12"] = 1
    electrics.values["inno_running_13"] = 1
    electrics.values["inno_running_14"] = 1
end

local function onReset()
	electrics.values["signal_L_2"] = 0
    electrics.values["signal_L_3"] = 0
    electrics.values["signal_L_4"] = 0
    electrics.values["signal_L_5"] = 0
    electrics.values["signal_L_6"] = 0
    electrics.values["signal_L_7"] = 0
    electrics.values["signal_L_8"] = 0
    electrics.values["signal_L_9"] = 0
    electrics.values["signal_L_10"] = 0
    electrics.values["signal_L_11"] = 0
    electrics.values["signal_L_12"] = 0
    electrics.values["signal_L_13"] = 0
    electrics.values["signal_L_14"] = 0
    electrics.values["signal_L_15"] = 0
	
	electrics.values["signal_R_2"] = 0
    electrics.values["signal_R_3"] = 0
    electrics.values["signal_R_4"] = 0
    electrics.values["signal_R_5"] = 0
    electrics.values["signal_R_6"] = 0
    electrics.values["signal_R_7"] = 0
    electrics.values["signal_R_8"] = 0
    electrics.values["signal_R_9"] = 0
    electrics.values["signal_R_10"] = 0
    electrics.values["signal_R_11"] = 0
    electrics.values["signal_R_12"] = 0
    electrics.values["signal_R_13"] = 0
    electrics.values["signal_R_14"] = 0
    electrics.values["signal_R_15"] = 0
	timer2 = 0
	timer = 0
	cycleStarting = 0
	cycleComplete = 0

end

local function updateGFX(dt) 
  if electrics.values["signal_L"] == 1 then
	timer = timer + dt
	
	if timer >= 0.01 then
	electrics.values["signal_L_2"] = 1
	end
	if timer >= 0.0272 then
	electrics.values["signal_L_3"] = 1
	end
	if timer >= 0.0541 then
	electrics.values["signal_L_4"] = 1
	end
	if timer >= 0.081 then
	electrics.values["signal_L_5"] = 1
	end
	if timer >= 0.1079 then
	electrics.values["signal_L_6"] = 1
	end
	if timer >= 0.1348 then
	electrics.values["signal_L_7"] = 1
	end
	if timer >= 0.1617 then
	electrics.values["signal_L_8"] = 1
	end
	if timer >= 0.1886 then
	electrics.values["signal_L_9"] = 1
	end
	if timer >= 0.2155 then
	electrics.values["signal_L_10"] = 1
	end
	if timer >= 0.2424 then
	electrics.values["signal_L_11"] = 1
	end
	if timer >= 0.2693 then
	electrics.values["signal_L_12"] = 1
	end
	if timer >= 0.2962 then
	electrics.values["signal_L_13"] = 1
	end
	if timer >= 0.3231 then
	electrics.values["signal_L_14"] = 1
	end
	if timer >= 0.35 then
	electrics.values["signal_L_15"] = 1
	end
	if timer >= 0.4 then

	electrics.values["signal_L_16"] = 1
	end
	
	
  else
	electrics.values["signal_L_2"] = 0
    electrics.values["signal_L_3"] = 0
    electrics.values["signal_L_4"] = 0
    electrics.values["signal_L_5"] = 0
    electrics.values["signal_L_6"] = 0
    electrics.values["signal_L_7"] = 0
    electrics.values["signal_L_8"] = 0
    electrics.values["signal_L_9"] = 0
    electrics.values["signal_L_10"] = 0
    electrics.values["signal_L_11"] = 0
    electrics.values["signal_L_12"] = 0
    electrics.values["signal_L_13"] = 0
    electrics.values["signal_L_14"] = 0
    electrics.values["signal_L_15"] = 0
	electrics.values["signal_L_16"] = 0
	timer = 0	
  end
  
  if electrics.values["signal_R"] == 1 then
	timer2 = timer2 + dt
	
	if timer2 >= 0.01 then
	electrics.values["signal_R_2"] = 1
	end
	if timer2 >= 0.0272 then
	electrics.values["signal_R_3"] = 1
	end
	if timer2 >= 0.0541 then
	electrics.values["signal_R_4"] = 1
	end
	if timer2 >= 0.081 then
	electrics.values["signal_R_5"] = 1
	end
	if timer2 >= 0.1079 then
	electrics.values["signal_R_6"] = 1
	end
	if timer2 >= 0.1348 then
	electrics.values["signal_R_7"] = 1
	end
	if timer2 >= 0.1617 then
	electrics.values["signal_R_8"] = 1
	end
	if timer2 >= 0.1886 then
	electrics.values["signal_R_9"] = 1
	end
	if timer2 >= 0.2155 then
	electrics.values["signal_R_10"] = 1
	end
	if timer2 >= 0.2424 then
	electrics.values["signal_R_11"] = 1
	end
	if timer2 >= 0.2693 then
	electrics.values["signal_R_12"] = 1
	end
	if timer2 >= 0.2962 then
	electrics.values["signal_R_13"] = 1
	end
	if timer2 >= 0.3231 then
	electrics.values["signal_R_14"] = 1
	end
	if timer2 >= 0.35 then
	electrics.values["signal_R_15"] = 1
	end
	if timer2 >= 0.4 then
	electrics.values["signal_R_16"] = 1
	end
	
  else
	electrics.values["signal_R_2"] = 0
    electrics.values["signal_R_3"] = 0
    electrics.values["signal_R_4"] = 0
    electrics.values["signal_R_5"] = 0
    electrics.values["signal_R_6"] = 0
    electrics.values["signal_R_7"] = 0
    electrics.values["signal_R_8"] = 0
    electrics.values["signal_R_9"] = 0
    electrics.values["signal_R_10"] = 0
    electrics.values["signal_R_11"] = 0
    electrics.values["signal_R_12"] = 0
    electrics.values["signal_R_13"] = 0
    electrics.values["signal_R_14"] = 0
    electrics.values["signal_R_15"] = 0
	electrics.values["signal_R_16"] = 0
	timer2 = 0	
  end
end

-- public interface
M.onInit = onInit
M.onReset = onReset
M.updateGFX = updateGFX

return M