-- This Source Code Form is subject to the terms of the bCDDL, v. 1.1.
-- If a copy of the bCDDL was not distributed with this
-- file, You can obtain one at http://beamng.com/bCDDL-1.1.txt
local M = {}

local function onInit()
	electrics.values['disp_Pa'] = 0
	electrics.values['disp_Ra'] = 0
	electrics.values['disp_Na'] = 0
	electrics.values['disp_Da'] = 0

    electrics.values['reverseactive'] = 0
end

local function reset()
  onInit()
end

local function updateGFX(dt)
--FOR INFOTAINMENT SCREEN, IT'S HERE SO I DONT NEED A NEW LUA FILE FOR THIS SIMPLE STUFF

  if electrics.values['gear'] == -1 or electrics.values['gear'] == "R" then
    electrics.values['reverseactive'] = 1
	electrics.values['musicscreenactive'] = 0
  else
    electrics.values['reverseactive'] = 0
  end
----------------------------
--For automatic transmission shifter
    if electrics.values['gear'] == "P" then
		electrics.values['disp_Ra'] = 0
		electrics.values['disp_Na'] = 0
		electrics.values['disp_Da'] = 0
		electrics.values['disp_Pa'] = 1

    elseif electrics.values['gear'] == "R" then
		electrics.values['disp_Na'] = 0
		electrics.values['disp_Da'] = 0
		electrics.values['disp_Pa'] = 0
		electrics.values['disp_Ra'] = 1

    elseif electrics.values['gear'] == "N" then
		electrics.values['disp_Da'] = 0
		electrics.values['disp_Pa'] = 0
		electrics.values['disp_Ra'] = 0
		electrics.values['disp_Na'] = 1
	else
		electrics.values['disp_Pa'] = 0
		electrics.values['disp_Ra'] = 0
		electrics.values['disp_Na'] = 0
		electrics.values['disp_Da'] = 1
	end
end

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

return M