local M = {}		--by NET_NUKA
local timer = 0
local timer2 = 0
local timer3 = 0
local timer4 = 0
local cycleComplete = 0
local cycleStarting = 0
local cycleHeadComplete = 0
local cycleHeadStarting = 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
	timer3 = 0
	timer4 = 0
	cycleStarting = 0
	cycleComplete = 0
	cycleHeadStarting = 0
	cycleHeadComplete = 0
--Headlight Animation
	electrics.values["signal_HL_2"] = 1
    electrics.values["signal_HL_3"] = 1
    electrics.values["signal_HL_4"] = 1
    electrics.values["signal_HL_5"] = 1
    electrics.values["signal_HL_6"] = 1
    electrics.values["signal_HL_7"] = 1
    electrics.values["signal_HL_8"] = 1
    electrics.values["signal_HL_9"] = 1
    electrics.values["signal_HL_10"] = 1
    electrics.values["signal_HL_11"] = 1
    electrics.values["signal_HL_12"] = 1
    electrics.values["signal_HL_13"] = 1
	
	electrics.values["signal_HR_2"] = 1
    electrics.values["signal_HR_3"] = 1
    electrics.values["signal_HR_4"] = 1
    electrics.values["signal_HR_5"] = 1
    electrics.values["signal_HR_6"] = 1
    electrics.values["signal_HR_7"] = 1
    electrics.values["signal_HR_8"] = 1
    electrics.values["signal_HR_9"] = 1
    electrics.values["signal_HR_10"] = 1
    electrics.values["signal_HR_11"] = 1
    electrics.values["signal_HR_12"] = 1
    electrics.values["signal_HR_13"] = 1
	
	electrics.values["signal_H_low"] = 0
--Running light starting sequence
    electrics.values["taillights_run_2"] = 1
	electrics.values["taillights_run_3"] = 1
    electrics.values["taillights_run_4"] = 1
    electrics.values["taillights_run_5"] = 1
    electrics.values["taillights_run_6"] = 1
    electrics.values["taillights_run_7"] = 1
    electrics.values["taillights_run_8"] = 1
    electrics.values["taillights_run_9"] = 1
    electrics.values["taillights_run_10"] = 1
    electrics.values["taillights_run_11"] = 1
    electrics.values["taillights_run_12"] = 1
    electrics.values["taillights_run_13"] = 0
    electrics.values["taillights_run_14"] = 0
--Running bar
    electrics.values["taillights_run_bar_2"] = 1
	electrics.values["taillights_run_bar_3"] = 1
	electrics.values["taillights_run_bar_4"] = 1
	electrics.values["taillights_run_bar_5"] = 1
	electrics.values["taillights_run_bar_6"] = 1
	electrics.values["taillights_run_bar_7"] = 1
	electrics.values["taillights_run_bar_8"] = 1
	electrics.values["taillights_run_bar_9"] = 1
	electrics.values["taillights_run_bar_10"] = 1
	electrics.values["taillights_run_bar_11"] = 1
	electrics.values["taillights_run_bar_12"] = 1
	electrics.values["taillights_run_bar_13"] = 1
	electrics.values["taillights_run_bar_14"] = 1
	electrics.values["taillights_run_bar_15"] = 1
	electrics.values["taillights_run_bar_16"] = 1
	electrics.values["taillights_run_bar_17"] = 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
	timer3 = 0
	timer4 = 0
	cycleStarting = 0
	cycleComplete = 0
	cycleHeadStarting = 0
	cycleHeadComplete = 0
--Headlight Animation
	electrics.values["signal_HL_2"] = 1
    electrics.values["signal_HL_3"] = 1
    electrics.values["signal_HL_4"] = 1
    electrics.values["signal_HL_5"] = 1
    electrics.values["signal_HL_6"] = 1
    electrics.values["signal_HL_7"] = 1
    electrics.values["signal_HL_8"] = 1
    electrics.values["signal_HL_9"] = 1
    electrics.values["signal_HL_10"] = 1
    electrics.values["signal_HL_11"] = 1
    electrics.values["signal_HL_12"] = 1
    electrics.values["signal_HL_13"] = 1
	
	electrics.values["signal_HR_2"] = 1
    electrics.values["signal_HR_3"] = 1
    electrics.values["signal_HR_4"] = 1
    electrics.values["signal_HR_5"] = 1
    electrics.values["signal_HR_6"] = 1
    electrics.values["signal_HR_7"] = 1
    electrics.values["signal_HR_8"] = 1
    electrics.values["signal_HR_9"] = 1
    electrics.values["signal_HR_10"] = 1
    electrics.values["signal_HR_11"] = 1
    electrics.values["signal_HR_12"] = 1
    electrics.values["signal_HR_13"] = 1
	
	electrics.values["signal_H_low"] = 0
--Running light starting sequence
    electrics.values["taillights_run_2"] = 1
	electrics.values["taillights_run_3"] = 1
    electrics.values["taillights_run_4"] = 1
    electrics.values["taillights_run_5"] = 1
    electrics.values["taillights_run_6"] = 1
    electrics.values["taillights_run_7"] = 1
    electrics.values["taillights_run_8"] = 1
    electrics.values["taillights_run_9"] = 1
    electrics.values["taillights_run_10"] = 1
    electrics.values["taillights_run_11"] = 1
    electrics.values["taillights_run_12"] = 1
    electrics.values["taillights_run_13"] = 0
    electrics.values["taillights_run_14"] = 0
--Running bar
    electrics.values["taillights_run_bar_2"] = 1
	electrics.values["taillights_run_bar_3"] = 1
	electrics.values["taillights_run_bar_4"] = 1
	electrics.values["taillights_run_bar_5"] = 1
	electrics.values["taillights_run_bar_6"] = 1
	electrics.values["taillights_run_bar_7"] = 1
	electrics.values["taillights_run_bar_8"] = 1
	electrics.values["taillights_run_bar_9"] = 1
	electrics.values["taillights_run_bar_10"] = 1
	electrics.values["taillights_run_bar_11"] = 1
	electrics.values["taillights_run_bar_12"] = 1
	electrics.values["taillights_run_bar_13"] = 1
	electrics.values["taillights_run_bar_14"] = 1
	electrics.values["taillights_run_bar_15"] = 1
	electrics.values["taillights_run_bar_16"] = 1
	electrics.values["taillights_run_bar_17"] = 1
end

local function updateGFX(dt) 
  if electrics.values["signal_L"] == 1 then
	timer = timer + dt
	
	if timer >= 0.0000 then
	electrics.values["signal_L_2"] = 1	
	end
	if timer >= 0.0250 then
	electrics.values["signal_L_3"] = 1	
	end
	if timer >= 0.0500 then
	electrics.values["signal_L_4"] = 1	
	end
	if timer >= 0.0750 then
	electrics.values["signal_L_5"] = 1
	end
	if timer >= 0.1000 then
	electrics.values["signal_L_6"] = 1
	end
	if timer >= 0.1250 then
	electrics.values["signal_L_7"] = 1
	end
	if timer >= 0.1500 then
	electrics.values["signal_L_8"] = 1
	end
	if timer >= 0.1750 then
	electrics.values["signal_L_9"] = 1
	end
	if timer >= 0.2000 then
	electrics.values["signal_L_10"] = 1
	end
	if timer >= 0.2250 then
	electrics.values["signal_L_11"] = 1
	end
	if timer >= 0.2500 then
	electrics.values["signal_L_12"] = 1
	end
	if timer >= 0.2750 then
	electrics.values["signal_L_13"] = 1
	end
	if timer >= 0.3000 then
	electrics.values["signal_L_14"] = 1
	end
	if timer >= 0.3250 then
	electrics.values["signal_L_15"] = 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
	timer = 0	
  end
  
  if electrics.values["signal_R"] == 1 then
	timer2 = timer2 + dt
	
	if timer2 >= 0.0000 then
	electrics.values["signal_R_2"] = 1
	end
	if timer2 >= 0.0250 then
	electrics.values["signal_R_3"] = 1
	end
	if timer2 >= 0.0500 then
	electrics.values["signal_R_4"] = 1
	end
	if timer2 >= 0.0750 then
	electrics.values["signal_R_5"] = 1
	end
	if timer2 >= 0.1000 then
	electrics.values["signal_R_6"] = 1
	end
	if timer2 >= 0.1250 then
	electrics.values["signal_R_7"] = 1
	end
	if timer2 >= 0.1500 then
	electrics.values["signal_R_8"] = 1
	end
	if timer2 >= 0.1750 then
	electrics.values["signal_R_9"] = 1
	end
	if timer2 >= 0.2000 then
	electrics.values["signal_R_10"] = 1
	end
	if timer2 >= 0.2250 then
	electrics.values["signal_R_11"] = 1
	end
	if timer2 >= 0.2500 then
	electrics.values["signal_R_12"] = 1
	end
	if timer2 >= 0.2750 then
	electrics.values["signal_R_13"] = 1
	end
	if timer2 >= 0.3000 then
	electrics.values["signal_R_14"] = 1
	end
	if timer2 >= 0.3250 then
	electrics.values["signal_R_15"] = 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
	timer2 = 0	
  end

--Headlight Animation
  if electrics.values["engineRunning"] == 0 and cycleHeadStarting == 0 then
	cycleHeadStarting = 1
	cycleHeadComplete = 0
  elseif electrics.values["engineRunning"] == 1 and cycleHeadStarting == 1 then
	timer4 = timer4 + dt
	
	if timer4 >= 0.0000 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 0.0125 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 0.0250 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 0.0375 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 0.0500 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 0.0625 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 0.0750 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 0.0875 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 0.1000 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 0.1125 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 0.1250 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 0.1375 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 0.1500 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	if timer4 >= 0.1625 then
	electrics.values["signal_HL_7"] = 0
	electrics.values["signal_HR_7"] = 0
	end
	if timer4 >= 0.1750 then
	electrics.values["signal_HL_6"] = 1
	electrics.values["signal_HR_6"] = 1
	end
	if timer4 >= 0.1875 then
	electrics.values["signal_HL_6"] = 0
	electrics.values["signal_HR_6"] = 0
	end
	if timer4 >= 0.2000 then
	electrics.values["signal_HL_5"] = 1
	electrics.values["signal_HR_5"] = 1
	end
	if timer4 >= 0.2125 then
	electrics.values["signal_HL_5"] = 0
	electrics.values["signal_HR_5"] = 0
	end
	if timer4 >= 0.2250 then
	electrics.values["signal_HL_4"] = 1
	electrics.values["signal_HR_4"] = 1
	end
	if timer4 >= 0.2375 then
	electrics.values["signal_HL_4"] = 0
	electrics.values["signal_HR_4"] = 0
	end
	if timer4 >= 0.2500 then
	electrics.values["signal_HL_3"] = 1
	electrics.values["signal_HR_3"] = 1
	end
	if timer4 >= 0.2625 then
	electrics.values["signal_HL_3"] = 0
	electrics.values["signal_HR_3"] = 0
	end
	if timer4 >= 0.2750 then
	electrics.values["signal_HL_2"] = 1
	electrics.values["signal_HR_2"] = 1
	end
	
--step 2

	if timer4 >= 0.2750 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 0.2875 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 0.3000 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 0.3125 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 0.3250 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 0.3375 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 0.3500 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 0.3675 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 0.3750 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 0.3875 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 0.4000 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 0.4125 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 0.4250 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	if timer4 >= 0.4375 then
	electrics.values["signal_HL_7"] = 0
	electrics.values["signal_HR_7"] = 0
	end
	if timer4 >= 0.4500 then
	electrics.values["signal_HL_6"] = 1
	electrics.values["signal_HR_6"] = 1
	end
	if timer4 >= 0.4625 then
	electrics.values["signal_HL_6"] = 0
	electrics.values["signal_HR_6"] = 0
	end
	if timer4 >= 0.4750 then
	electrics.values["signal_HL_5"] = 1
	electrics.values["signal_HR_5"] = 1
	end
	if timer4 >= 0.4875 then
	electrics.values["signal_HL_5"] = 0
	electrics.values["signal_HR_5"] = 0
	end
	if timer4 >= 0.5000 then
	electrics.values["signal_HL_4"] = 1
	electrics.values["signal_HR_4"] = 1
	end
	if timer4 >= 0.5125 then
	electrics.values["signal_HL_4"] = 0
	electrics.values["signal_HR_4"] = 0
	end
	if timer4 >= 0.5250 then
	electrics.values["signal_HL_3"] = 1
	electrics.values["signal_HR_3"] = 1
	end

--step 3

	if timer4 >= 0.5250 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 0.5375 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 0.5500 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 0.5625 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 0.5750 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 0.5875 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 0.6000 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 0.6125 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 0.6250 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 0.6375 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 0.6500 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 0.6625 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 0.6750 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	if timer4 >= 0.6875 then
	electrics.values["signal_HL_7"] = 0
	electrics.values["signal_HR_7"] = 0
	end
	if timer4 >= 0.7000 then
	electrics.values["signal_HL_6"] = 1
	electrics.values["signal_HR_6"] = 1
	end
	if timer4 >= 0.7125 then
	electrics.values["signal_HL_6"] = 0
	electrics.values["signal_HR_6"] = 0
	end
	if timer4 >= 0.7250 then
	electrics.values["signal_HL_5"] = 1
	electrics.values["signal_HR_5"] = 1
	end
	if timer4 >= 0.7375 then
	electrics.values["signal_HL_5"] = 0
	electrics.values["signal_HR_5"] = 0
	end
	if timer4 >= 0.7500 then
	electrics.values["signal_HL_4"] = 1
	electrics.values["signal_HR_4"] = 1
	end
	
--step 4

	if timer4 >= 0.7500 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 0.7625 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 0.7750 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 0.7875 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 0.8000 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 0.8125 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 0.8250 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 0.8375 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 0.8500 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 0.8625 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 0.8750 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 0.8875 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 0.9000 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	if timer4 >= 0.9125 then
	electrics.values["signal_HL_7"] = 0
	electrics.values["signal_HR_7"] = 0
	end
	if timer4 >= 0.9250 then
	electrics.values["signal_HL_6"] = 1
	electrics.values["signal_HR_6"] = 1
	end
	if timer4 >= 0.9375 then
	electrics.values["signal_HL_6"] = 0
	electrics.values["signal_HR_6"] = 0
	end
	if timer4 >= 0.9500 then
	electrics.values["signal_HL_5"] = 1
	electrics.values["signal_HR_5"] = 1
	end
	
--step 5

	if timer4 >= 0.9500 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 0.9625 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 0.9750 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 0.9875 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.0000 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 1.0125 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 1.0250 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 1.0375 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 1.0500 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 1.0625 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 1.0750 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 1.0875 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 1.1000 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	if timer4 >= 1.1125 then
	electrics.values["signal_HL_7"] = 0
	electrics.values["signal_HR_7"] = 0
	end
	if timer4 >= 1.1250 then
	electrics.values["signal_HL_6"] = 1
	electrics.values["signal_HR_6"] = 1
	end

--step 6

	if timer4 >= 1.1250 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.1375 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.1500 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 1.1625 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.1750 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 1.1875 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 1.2000 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 1.2125 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 1.2250 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 1.2375 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 1.2500 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	if timer4 >= 1.2625 then
	electrics.values["signal_HL_8"] = 0
	electrics.values["signal_HR_8"] = 0
	end
	if timer4 >= 1.2750 then
	electrics.values["signal_HL_7"] = 1
	electrics.values["signal_HR_7"] = 1
	end
	
--step 7

	if timer4 >= 1.2750 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.2875 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.3000 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 1.3125 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.3250 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 1.3375 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 1.3500 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 1.3625 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 1.3750 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	if timer4 >= 1.3875 then
	electrics.values["signal_HL_9"] = 0
	electrics.values["signal_HR_9"] = 0
	end
	if timer4 >= 1.4000 then
	electrics.values["signal_HL_8"] = 1
	electrics.values["signal_HR_8"] = 1
	end
	
--step 8

	if timer4 >= 1.4000 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.4125 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.4250 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 1.4375 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.4500 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 1.4625 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 1.4750 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	if timer4 >= 1.4875 then
	electrics.values["signal_HL_10"] = 0
	electrics.values["signal_HR_10"] = 0
	end
	if timer4 >= 1.5000 then
	electrics.values["signal_HL_9"] = 1
	electrics.values["signal_HR_9"] = 1
	end
	
--step 9

	if timer4 >= 1.5000 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.5125 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.5250 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 1.5375 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.5500 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	if timer4 >= 1.5625 then
	electrics.values["signal_HL_11"] = 0
	electrics.values["signal_HR_11"] = 0
	end
	if timer4 >= 1.5750 then
	electrics.values["signal_HL_10"] = 1
	electrics.values["signal_HR_10"] = 1
	end
	
--step 10

	if timer4 >= 1.5875 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.6000 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.6125 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	if timer4 >= 1.6250 then
	electrics.values["signal_HL_12"] = 0
	electrics.values["signal_HR_12"] = 0
	end
	if timer4 >= 1.6375 then
	electrics.values["signal_HL_11"] = 1
	electrics.values["signal_HR_11"] = 1
	end
	
--step 11

	if timer4 >= 1.6500 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.6625 then
	electrics.values["signal_HL_13"] = 0
	electrics.values["signal_HR_13"] = 0
	end
	if timer4 >= 1.6750 then
	electrics.values["signal_HL_12"] = 1
	electrics.values["signal_HR_12"] = 1
	end
	
--step 12

	if timer4 >= 1.6875 then
	electrics.values["signal_HL_13"] = 1
	electrics.values["signal_HR_13"] = 1
	end
	if timer4 >= 1.7250 then
	electrics.values["lowbeam"] = 1
	electrics.values["signal_H_low"] = 1
	end
	if timer4 >= 2.5000 then
	electrics.values["lowbeam"] = 0
	electrics.values["signal_H_low"] = 0
	
	cycleHeadStarting = 0
	timer4 = 0
	cycleHeadComplete = 1
	end
  end
  if electrics.values["engineRunning"] == 1 and cycleHeadComplete == 1 then
	electrics.values["signal_HL_2"] = 1
    electrics.values["signal_HL_3"] = 1
    electrics.values["signal_HL_4"] = 1
    electrics.values["signal_HL_5"] = 1
    electrics.values["signal_HL_6"] = 1
    electrics.values["signal_HL_7"] = 1
    electrics.values["signal_HL_8"] = 1
    electrics.values["signal_HL_9"] = 1
    electrics.values["signal_HL_10"] = 1
    electrics.values["signal_HL_11"] = 1
    electrics.values["signal_HL_12"] = 1
    electrics.values["signal_HL_13"] = 1
	
	electrics.values["signal_HR_2"] = 1
    electrics.values["signal_HR_3"] = 1
    electrics.values["signal_HR_4"] = 1
    electrics.values["signal_HR_5"] = 1
    electrics.values["signal_HR_6"] = 1
    electrics.values["signal_HR_7"] = 1
    electrics.values["signal_HR_8"] = 1
    electrics.values["signal_HR_9"] = 1
    electrics.values["signal_HR_10"] = 1
    electrics.values["signal_HR_11"] = 1
    electrics.values["signal_HR_12"] = 1
    electrics.values["signal_HR_13"] = 1
	
	electrics.values["signal_H_low"] = 0
  elseif electrics.values["engineRunning"] == 0 and cycleHeadComplete == 0 then
	electrics.values["signal_HL_2"] = 0
    electrics.values["signal_HL_3"] = 0
    electrics.values["signal_HL_4"] = 0
    electrics.values["signal_HL_5"] = 0
    electrics.values["signal_HL_6"] = 0
    electrics.values["signal_HL_7"] = 0
    electrics.values["signal_HL_8"] = 0
    electrics.values["signal_HL_9"] = 0
    electrics.values["signal_HL_10"] = 0
    electrics.values["signal_HL_11"] = 0
    electrics.values["signal_HL_12"] = 0
    electrics.values["signal_HL_13"] = 0
	
	electrics.values["signal_HR_2"] = 0
    electrics.values["signal_HR_3"] = 0
    electrics.values["signal_HR_4"] = 0
    electrics.values["signal_HR_5"] = 0
    electrics.values["signal_HR_6"] = 0
    electrics.values["signal_HR_7"] = 0
    electrics.values["signal_HR_8"] = 0
    electrics.values["signal_HR_9"] = 0
    electrics.values["signal_HR_10"] = 0
    electrics.values["signal_HR_11"] = 0
    electrics.values["signal_HR_12"] = 0
    electrics.values["signal_HR_13"] = 0
	
	electrics.values["signal_H_low"] = 0
  end

--Startup sequence for running lights
  if electrics.values["engineRunning"] == 0 and cycleStarting == 0 then
	cycleStarting = 1
	cycleComplete = 0
  elseif electrics.values["engineRunning"] == 1 and cycleStarting == 1 then
	timer3 = timer3 + dt
	
	if timer3 >= 0.0000 then
	electrics.values["taillights_run_1"] = 0	
	end
	if timer3 >= 0.06 then
	electrics.values["taillights_run_2"] = 1
	end
	if timer3 >= 0.12 then
	electrics.values["taillights_run_3"] = 1
	end
	if timer3 >= 0.18 then
	electrics.values["taillights_run_4"] = 1
	end
	if timer3 >= 0.24 then
	electrics.values["taillights_run_5"] = 1
	end
	if timer3 >= 0.3 then
	electrics.values["taillights_run_6"] = 1
	end
	if timer3 >= 0.36 then
	electrics.values["taillights_run_7"] = 1
	end
	if timer3 >= 0.42 then
	electrics.values["taillights_run_8"] = 1
	end
	if timer3 >= 0.48 then
	electrics.values["taillights_run_9"] = 1
	end
	if timer3 >= 0.54 then
	electrics.values["taillights_run_10"] = 1
	end
		if timer3 >= 0.6 then
	electrics.values["taillights_run_11"] = 1
	end
		if timer3 >= 0.66 then
	electrics.values["taillights_run_12"] = 1
	end
--step 2

	
--RUNNING BAR animation
--step1

	if timer3 >= 0.0000 then
	electrics.values["taillights_run_bar_17"] = 1
	end
	if timer3 >= 0.0425 then
	electrics.values["taillights_run_bar_17"] = 0
	end
	if timer3 >= 0.0650 then
	electrics.values["taillights_run_bar_16"] = 1
	end
	if timer3 >= 0.0775 then
	electrics.values["taillights_run_bar_16"] = 0
	end
	if timer3 >= 0.0800 then
	electrics.values["taillights_run_bar_15"] = 1
	end
	if timer3 >= 0.0925 then
	electrics.values["taillights_run_bar_15"] = 0
	end
	if timer3 >= 0.1150 then
	electrics.values["taillights_run_bar_14"] = 1
	end
	if timer3 >= 0.1275 then
	electrics.values["taillights_run_bar_14"] = 0
	end
	if timer3 >= 0.1400 then
	electrics.values["taillights_run_bar_13"] = 1
	end
	if timer3 >= 0.1525 then
	electrics.values["taillights_run_bar_13"] = 0
	end
	if timer3 >= 0.1650 then
	electrics.values["taillights_run_bar_12"] = 1
	end
	if timer3 >= 0.1775 then
	electrics.values["taillights_run_bar_12"] = 0
	end
	if timer3 >= 0.1900 then
	electrics.values["taillights_run_bar_11"] = 1
	end
	if timer3 >= 0.2075 then
	electrics.values["taillights_run_bar_11"] = 0
	end
	if timer3 >= 0.2150 then
	electrics.values["taillights_run_bar_10"] = 1
	end
	if timer3 >= 0.2275 then
	electrics.values["taillights_run_bar_10"] = 0
	end
	if timer3 >= 0.2400 then
	electrics.values["taillights_run_bar_9"] = 1
	end
	if timer3 >= 0.2525 then
	electrics.values["taillights_run_bar_9"] = 0
	end
	if timer3 >= 0.2750 then
	electrics.values["taillights_run_bar_8"] = 1
	end
	if timer3 >= 0.2975 then
	electrics.values["taillights_run_bar_8"] = 0
	end
	if timer3 >= 0.300 then
	electrics.values["taillights_run_bar_7"] = 1
	end
	if timer3 >= 0.3225 then
	electrics.values["taillights_run_bar_7"] = 0
	end
	if timer3 >= 0.3550 then
	electrics.values["taillights_run_bar_6"] = 1
	end
	if timer3 >= 0.3875 then
	electrics.values["taillights_run_bar_6"] = 0
	end
	if timer3 >= 0.400 then
	electrics.values["taillights_run_bar_5"] = 1
	end
	if timer3 >= 0.44125 then
	electrics.values["taillights_run_bar_5"] = 0
	end
	if timer3 >= 0.4750 then
	electrics.values["taillights_run_bar_4"] = 1
	end
	if timer3 >= 0.4975 then
	electrics.values["taillights_run_bar_4"] = 0
	end
	if timer3 >= 0.5100 then
	electrics.values["taillights_run_bar_3"] = 1
	end
	if timer3 >= 0.5525 then
	electrics.values["taillights_run_bar_3"] = 0
	end
	if timer3 >= 0.50 then
	electrics.values["taillights_run_bar_2"] = 1
	end
	
--step 2
	
		if timer3 >= 0.6775 then
	electrics.values["taillights_run_bar_2"] = 1
	end
	if timer3 >= 0.6875 then
	electrics.values["taillights_run_bar_3"] = 1
	end
	if timer3 >= 0.7000 then
	electrics.values["taillights_run_bar_4"] = 1
	end
	if timer3 >= 0.7125 then
	electrics.values["taillights_run_bar_5"] = 1
	end
	if timer3 >= 0.8250 then
	electrics.values["taillights_run_bar_6"] = 1
	end
	if timer3 >= 0.8375 then
	electrics.values["taillights_run_bar_7"] = 1
	end
	if timer3 >= 0.9500 then
	electrics.values["taillights_run_bar_8"] = 1
	end
	if timer3 >= 0.9625 then
	electrics.values["taillights_run_bar_9"] = 1
	end
	if timer3 >= 1.0750 then
	electrics.values["taillights_run_bar_10"] = 1
	end
	if timer3 >= 1.0875 then
	electrics.values["taillights_run_bar_11"] = 1
	end
	if timer3 >= 1.1000 then
	electrics.values["taillights_run_bar_12"] = 1
	end
	if timer3 >= 1.1125 then
	electrics.values["taillights_run_bar_13"] = 1
	end
	if timer3 >= 1.2250 then
	electrics.values["taillights_run_bar_14"] = 1
	end
	if timer3 >= 1.2375 then
	electrics.values["taillights_run_bar_15"] = 1
	end
	if timer3 >= 1.2500 then
	electrics.values["taillights_run_bar_16"] = 1
	end
	if timer3 >= 1.2625 then
	electrics.values["taillights_run_bar_17"] = 1
		end
	if timer3 >= 7.5625 then
	electrics.values["taillights_run_14"] = 0
	cycleStarting = 0
	timer3 = 0
	cycleComplete = 1
	end
  end
  if electrics.values["engineRunning"] == 1 and cycleComplete == 1 then
    electrics.values["taillights_run_2"] = 1
	electrics.values["taillights_run_3"] = 1
    electrics.values["taillights_run_4"] = 1
    electrics.values["taillights_run_5"] = 1
    electrics.values["taillights_run_6"] = 1
    electrics.values["taillights_run_7"] = 1
    electrics.values["taillights_run_8"] = 1
    electrics.values["taillights_run_9"] = 1
    electrics.values["taillights_run_10"] = 1
    electrics.values["taillights_run_11"] = 1
    electrics.values["taillights_run_12"] = 1
    electrics.values["taillights_run_13"] = 0
    electrics.values["taillights_run_14"] = 0
	
	electrics.values["taillights_run_bar_2"] = 1
	electrics.values["taillights_run_bar_3"] = 1
	electrics.values["taillights_run_bar_4"] = 1
	electrics.values["taillights_run_bar_5"] = 1
	electrics.values["taillights_run_bar_6"] = 1
	electrics.values["taillights_run_bar_7"] = 1
	electrics.values["taillights_run_bar_8"] = 1
	electrics.values["taillights_run_bar_9"] = 1
	electrics.values["taillights_run_bar_10"] = 1
	electrics.values["taillights_run_bar_11"] = 1
	electrics.values["taillights_run_bar_12"] = 1
	electrics.values["taillights_run_bar_13"] = 1
	electrics.values["taillights_run_bar_14"] = 1
	electrics.values["taillights_run_bar_15"] = 1
	electrics.values["taillights_run_bar_16"] = 1
	electrics.values["taillights_run_bar_17"] = 1
  elseif electrics.values["engineRunning"] == 0 and cycleComplete == 0 then
    electrics.values["taillights_run_2"] = 0
	electrics.values["taillights_run_3"] = 0
    electrics.values["taillights_run_4"] = 0
    electrics.values["taillights_run_5"] = 0
    electrics.values["taillights_run_6"] = 0
    electrics.values["taillights_run_7"] = 0
    electrics.values["taillights_run_8"] = 0
    electrics.values["taillights_run_9"] = 0
    electrics.values["taillights_run_10"] = 0
    electrics.values["taillights_run_11"] = 0
    electrics.values["taillights_run_12"] = 0
    electrics.values["taillights_run_13"] = 0
    electrics.values["taillights_run_14"] = 0
	
	electrics.values["taillights_run_bar_2"] = 0
	electrics.values["taillights_run_bar_3"] = 0
	electrics.values["taillights_run_bar_4"] = 0
	electrics.values["taillights_run_bar_5"] = 0
	electrics.values["taillights_run_bar_6"] = 0
	electrics.values["taillights_run_bar_7"] = 0
	electrics.values["taillights_run_bar_8"] = 0
	electrics.values["taillights_run_bar_9"] = 0
	electrics.values["taillights_run_bar_10"] = 0
	electrics.values["taillights_run_bar_11"] = 0
	electrics.values["taillights_run_bar_12"] = 0
	electrics.values["taillights_run_bar_13"] = 0
	electrics.values["taillights_run_bar_14"] = 0
	electrics.values["taillights_run_bar_15"] = 0
	electrics.values["taillights_run_bar_16"] = 0
	electrics.values["taillights_run_bar_17"] = 0
  end
end

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

return M