local mpcd_path = LockOn_Options.script_path.."MPCD/indicator/EW/"

dofile(LockOn_Options.script_path.."MPCD/indicator/MPCD_definitions.lua")
dofile(LockOn_Options.script_path.."MPCD/indicator/MENU/MPCD_BG.lua")

local mpcd_mm_btn_01			= CreateElement "ceStringPoly"
mpcd_mm_btn_01.name				= "mpcd_mm_btn_01"
mpcd_mm_btn_01.material			= mpcd_font_base
mpcd_mm_btn_01.init_pos			= {-0.92, -0.65, 0}
mpcd_mm_btn_01.alignment		= "CenterCenter"
mpcd_mm_btn_01.formats			= {"ASPJ\nALT\n%s"}
mpcd_mm_btn_01.stringdefs		= MPCD_default_font_size
mpcd_mm_btn_01.controllers		= {{"EW_ASPJ_Altitude"}}
Add_MPCD_Element(mpcd_mm_btn_01)

local mpcd_mm_btn_02			= CreateElement "ceStringPoly"
mpcd_mm_btn_02.name				= "mpcd_mm_btn_02"
mpcd_mm_btn_02.material			= mpcd_font_base
mpcd_mm_btn_02.init_pos			= mpcd_btn_02_pos
mpcd_mm_btn_02.alignment		= "CenterCenter"
mpcd_mm_btn_02.value			= "P\nR\nO\nG"
mpcd_mm_btn_02.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_02)

--[[
local mpcd_mm_btn_03			= CreateElement "ceStringPoly"
mpcd_mm_btn_03.name				= "mpcd_mm_btn_03"
mpcd_mm_btn_03.material			= mpcd_font_base
mpcd_mm_btn_03.init_pos			= mpcd_btn_03_pos
mpcd_mm_btn_03.alignment		= "CenterCenter"
mpcd_mm_btn_03.formats			= {"JMR\n%d\n%s"}
mpcd_mm_btn_03.stringdefs		= MPCD_default_font_size
mpcd_mm_btn_03.controllers		= {{"EW_Jammr_count"}}
Add_MPCD_Element(mpcd_mm_btn_03)
--]]

local mpcd_mm_btn_04			= CreateElement "ceStringPoly"
mpcd_mm_btn_04.name				= "mpcd_mm_btn_04"
mpcd_mm_btn_04.material			= mpcd_font_base
mpcd_mm_btn_04.init_pos			= mpcd_btn_04_pos
mpcd_mm_btn_04.alignment		= "CenterCenter"
mpcd_mm_btn_04.formats			= {"FLR\n%d\n%s"}
mpcd_mm_btn_04.stringdefs		= MPCD_default_font_size
mpcd_mm_btn_04.controllers		= {{"EW_Flare_count"}}
Add_MPCD_Element(mpcd_mm_btn_04)

local mpcd_mm_btn_05			= CreateElement "ceStringPoly"
mpcd_mm_btn_05.name				= "mpcd_mm_btn_05"
mpcd_mm_btn_05.material			= mpcd_font_base
mpcd_mm_btn_05.init_pos			= mpcd_btn_05_pos
mpcd_mm_btn_05.alignment		= "CenterCenter"
mpcd_mm_btn_05.formats			= {"CHF\n%d\n%s"}
mpcd_mm_btn_05.stringdefs		= MPCD_default_font_size
mpcd_mm_btn_05.controllers		= {{"EW_Chaff_count"}}
Add_MPCD_Element(mpcd_mm_btn_05)

local mpcd_mm_btn_11			= CreateElement "ceStringPoly"
mpcd_mm_btn_11.name				= "mpcd_mm_btn_11"
mpcd_mm_btn_11.material			= mpcd_font_base
mpcd_mm_btn_11.init_pos			= mpcd_btn_11_pos
mpcd_mm_btn_11.alignment		= "CenterCenter"
mpcd_mm_btn_11.value			= "O\nF\nS\nT"
mpcd_mm_btn_11.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_11)

local mpcd_mm_btn_12			= CreateElement "ceStringPoly"
mpcd_mm_btn_12.name				= "mpcd_mm_btn_12"
mpcd_mm_btn_12.material			= mpcd_font_base
mpcd_mm_btn_12.init_pos			= mpcd_btn_12_pos
mpcd_mm_btn_12.alignment		= "CenterCenter"
mpcd_mm_btn_12.value			= "P\nR\nI"
mpcd_mm_btn_12.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_12)

local mpcd_mm_btn_13			= CreateElement "ceStringPoly"
mpcd_mm_btn_13.name				= "mpcd_mm_btn_13"
mpcd_mm_btn_13.material			= mpcd_font_base
mpcd_mm_btn_13.init_pos			= mpcd_btn_13_pos
mpcd_mm_btn_13.alignment		= "CenterCenter"
mpcd_mm_btn_13.value			= "L\nI\nM"
mpcd_mm_btn_13.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_13)

local mpcd_mm_btn_14			= CreateElement "ceStringPoly"
mpcd_mm_btn_14.name				= "mpcd_mm_btn_14"
mpcd_mm_btn_14.material			= mpcd_font_base
mpcd_mm_btn_14.init_pos			= mpcd_btn_14_pos
mpcd_mm_btn_14.alignment		= "CenterCenter"
mpcd_mm_btn_14.value			= "B\nI\nT"
mpcd_mm_btn_14.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_14)

local mpcd_mm_btn_15			= CreateElement "ceStringPoly"
mpcd_mm_btn_15.name				= "mpcd_mm_btn_15"
mpcd_mm_btn_15.material			= mpcd_font_base
mpcd_mm_btn_15.init_pos			= mpcd_btn_15_pos
mpcd_mm_btn_15.alignment		= "CenterCenter"
mpcd_mm_btn_15.value			= "E\nC\nM"
mpcd_mm_btn_15.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_15)

local mpcd_mm_btn_18			= CreateElement "ceStringPoly"
mpcd_mm_btn_18.name				= "mpcd_mm_btn_18"
mpcd_mm_btn_18.material			= mpcd_font_base
mpcd_mm_btn_18.init_pos			= mpcd_btn_18_pos
mpcd_mm_btn_18.alignment		= "CenterCenter"
mpcd_mm_btn_18.value			= "MENU"
mpcd_mm_btn_18.stringdefs		= MPCD_default_font_size
Add_MPCD_Element(mpcd_mm_btn_18)

-- SELECTED MENU OPTIONS
local	mpcd_mm_btn_13_s				= create_mpcd_textured_box( 5, 4, 58, 153, nil, nil, 1)
		mpcd_mm_btn_13_s.name			= "mpcd_mm_btn_13_s"
		mpcd_mm_btn_13_s.init_pos		= mpcd_btn_13_pos
		mpcd_mm_btn_13_s.controllers	= {{"EW_Declutter"}}
Add_MPCD_Element(mpcd_mm_btn_13_s)

local	mpcd_mm_btn_15_s			= create_mpcd_textured_box( 5, 4, 58, 153, nil, nil, 1)
		mpcd_mm_btn_15_s.name		= "mpcd_mm_btn_15_s"
		mpcd_mm_btn_15_s.init_pos	= mpcd_btn_15_pos
Add_MPCD_Element(mpcd_mm_btn_15_s)

-- Weapons List AG Mode
-- Available Weapons
local	wpn_menu_btn_06				= CreateElement "ceStringPoly"
		wpn_menu_btn_06.name		= "wpn_menu_btn_06"
		wpn_menu_btn_06.material	= mpcd_font_base
		wpn_menu_btn_06.init_pos	= mpcd_btn_06_pos
		wpn_menu_btn_06.alignment	= "CenterCenter"
		wpn_menu_btn_06.formats		= {"%s"}
		wpn_menu_btn_06.stringdefs	= MPCD_default_font_size
		wpn_menu_btn_06.controllers	= {{"strs_wpn_1a"}}
Add_MPCD_Element(wpn_menu_btn_06)

local	wpn_menu_btn_07				= CreateElement "ceStringPoly"
		wpn_menu_btn_07.name		= "wpn_menu_btn_07"
		wpn_menu_btn_07.material	= mpcd_font_base
		wpn_menu_btn_07.init_pos	= mpcd_btn_07_pos
		wpn_menu_btn_07.alignment	= "CenterCenter"
		wpn_menu_btn_07.formats		= {"%s"}
		wpn_menu_btn_07.stringdefs	= MPCD_default_font_size
		wpn_menu_btn_07.controllers	= {{"strs_wpn_1b"}}
Add_MPCD_Element(wpn_menu_btn_07)

local	wpn_menu_btn_08				= CreateElement "ceStringPoly"
		wpn_menu_btn_08.name		= "wpn_menu_btn_08"
		wpn_menu_btn_08.material	= mpcd_font_base
		wpn_menu_btn_08.init_pos	= mpcd_btn_08_pos
		wpn_menu_btn_08.alignment	= "CenterCenter"
		wpn_menu_btn_08.formats		= {"%s"}
		wpn_menu_btn_08.stringdefs	= MPCD_default_font_size
		wpn_menu_btn_08.controllers	= {{"strs_wpn_2a"}}
Add_MPCD_Element(wpn_menu_btn_08)

local	wpn_menu_btn_09				= CreateElement "ceStringPoly"
		wpn_menu_btn_09.name		= "wpn_menu_btn_09"
		wpn_menu_btn_09.material	= mpcd_font_base
		wpn_menu_btn_09.init_pos	= mpcd_btn_09_pos
		wpn_menu_btn_09.alignment	= "CenterCenter"
		wpn_menu_btn_09.formats		= {"%s"}
		wpn_menu_btn_09.stringdefs	= MPCD_default_font_size
		wpn_menu_btn_09.controllers	= {{"strs_wpn_2b"}}
Add_MPCD_Element(wpn_menu_btn_09)

local	wpn_menu_btn_10				= CreateElement "ceStringPoly"
		wpn_menu_btn_10.name		= "wpn_menu_btn_10"
		wpn_menu_btn_10.material	= mpcd_font_base
		wpn_menu_btn_10.init_pos	= mpcd_btn_10_pos
		wpn_menu_btn_10.alignment	= "CenterCenter"
		wpn_menu_btn_10.formats		= {"%s"}
		wpn_menu_btn_10.stringdefs	= MPCD_default_font_size
		wpn_menu_btn_10.controllers	= {{"strs_wpn_gun"}}
Add_MPCD_Element(wpn_menu_btn_10)

-- Selected Weapons
local	wpn_menu_06_boxed				= create_mpcd_textured_box( 60, 4, 175, 50)
		wpn_menu_06_boxed.name			= "wpn_menu_06_boxed"
		wpn_menu_06_boxed.init_pos		= mpcd_btn_06_pos
		wpn_menu_06_boxed.controllers	= {{"strs_wpn_1a_sel"}}
Add_MPCD_Element(wpn_menu_06_boxed)

local	wpn_menu_07_boxed				= create_mpcd_textured_box( 60, 4, 175, 50)
		wpn_menu_07_boxed.name			= "wpn_menu_07_boxed"
		wpn_menu_07_boxed.init_pos		= mpcd_btn_07_pos
		wpn_menu_07_boxed.controllers	= {{"strs_wpn_1b_sel"}}
Add_MPCD_Element(wpn_menu_07_boxed)

local	wpn_menu_08_boxed				= create_mpcd_textured_box( 60, 4, 175, 50)
		wpn_menu_08_boxed.name			= "wpn_menu_08_boxed"
		wpn_menu_08_boxed.init_pos		= mpcd_btn_08_pos
		wpn_menu_08_boxed.controllers	= {{"strs_wpn_2a_sel"}}
Add_MPCD_Element(wpn_menu_08_boxed)

local	wpn_menu_09_boxed				= create_mpcd_textured_box( 60, 4, 175, 50)
		wpn_menu_09_boxed.name			= "wpn_menu_09_boxed"
		wpn_menu_09_boxed.init_pos		= mpcd_btn_09_pos
		wpn_menu_09_boxed.controllers	= {{"strs_wpn_2b_sel"}}
Add_MPCD_Element(wpn_menu_09_boxed)

local	wpn_menu_10_boxed				= create_mpcd_textured_box( 60, 4, 175, 50)
		wpn_menu_10_boxed.name			= "wpn_menu_10_boxed"
		wpn_menu_10_boxed.init_pos		= mpcd_btn_10_pos
		wpn_menu_10_boxed.controllers	= {{"strs_gun_sel"}}
Add_MPCD_Element(wpn_menu_10_boxed)

-- DATA
local	EW_EXP_Title				= CreateElement "ceStringPoly"
		EW_EXP_Title.name			= "EW_EXP_Title"
		EW_EXP_Title.material		= mpcd_font_base
		EW_EXP_Title.init_pos		= {-0.80, 0.80, 0.0}
		EW_EXP_Title.alignment		= "CenterCenter"
		EW_EXP_Title.value			= "EXP"
		EW_EXP_Title.stringdefs		= MPCD_large_font_size
Add_MPCD_Element(EW_EXP_Title)

local	EW_EXP_Selection				= CreateElement "ceStringPoly"
		EW_EXP_Selection.name			= "EW_EXP_Selection"
		EW_EXP_Selection.material		= mpcd_font_base
		EW_EXP_Selection.init_pos		= {-0.80, 0.70, 0.0}
		EW_EXP_Selection.alignment		= "CenterCenter"
		EW_EXP_Selection.formats		= {"%s"}
		EW_EXP_Selection.stringdefs		= MPCD_large_font_size
		EW_EXP_Selection.controllers	= {{"EW_EXP_Switch"}}
Add_MPCD_Element(EW_EXP_Selection)

local	EW_RWR_Title				= CreateElement "ceStringPoly"
		EW_RWR_Title.name			= "EW_RWR_Title"
		EW_RWR_Title.material		= mpcd_font_base
		EW_RWR_Title.init_pos		= {0.80, 0.80, 0.0}
		EW_RWR_Title.alignment		= "CenterCenter"
		EW_RWR_Title.value			= "RWR"
		EW_RWR_Title.stringdefs		= MPCD_large_font_size
Add_MPCD_Element(EW_RWR_Title)

local	EW_RWR_Selection				= CreateElement "ceStringPoly"
		EW_RWR_Selection.name			= "EW_RWR_Selection"
		EW_RWR_Selection.material		= mpcd_font_base
		EW_RWR_Selection.init_pos		= {0.80, 0.70, 0.0}
		EW_RWR_Selection.alignment		= "CenterCenter"
		EW_RWR_Selection.formats		= {"%s"}
		EW_RWR_Selection.stringdefs		= MPCD_large_font_size
		EW_RWR_Selection.controllers	= {{"EW_RWR_Switch"}}
Add_MPCD_Element(EW_RWR_Selection)


-- RWR SYMBOLS
-- GRID
local	rwr_grid				= create_mpcd_textured_box( 0, 0, 855, 855, nil, nil, 21)
		rwr_grid.name			= "rwr_grid"
		rwr_grid.init_pos		= {0, 0, 0}
		rwr_grid.controllers	= {{"EW_RWR_Sts_ON"}}
Add_MPCD_Element(rwr_grid)

-- RWR STATUS
local	rwr_dis_type				= CreateElement "ceStringPoly"
		rwr_dis_type.name			= "rwr_dis_type"
		rwr_dis_type.material		= mpcd_font_base
		rwr_dis_type.init_pos		= {-0.05, 0.03, 0.0}
		rwr_dis_type.alignment		= "CenterCenter"
		rwr_dis_type.formats		= {"%s"}
		rwr_dis_type.stringdefs		= MPCD_large_font_size
		rwr_dis_type.controllers	= {{"EW_RWR_Sts_ON"}, {"EW_RWR_Filter"}}
Add_MPCD_Element(rwr_dis_type)

local	rwr_dis_mode				= CreateElement "ceStringPoly"
		rwr_dis_mode.name			= "rwr_dis_mode"
		rwr_dis_mode.material		= mpcd_font_base
		rwr_dis_mode.init_pos		= {0.05, 0.03, 0.0}
		rwr_dis_mode.alignment		= "CenterCenter"
		rwr_dis_mode.value			= "L"
		rwr_dis_mode.stringdefs		= MPCD_large_font_size
		rwr_dis_mode.controllers	= {{"EW_RWR_Sts_ON"}, {"EW_RWR_Limited"}}
Add_MPCD_Element(rwr_dis_mode)

local	rwr_bit_stat				= CreateElement "ceStringPoly"
		rwr_bit_stat.name			= "rwr_bit_stat"
		rwr_bit_stat.material		= mpcd_font_base
		rwr_bit_stat.init_pos		= {0.0, -0.07, 0.0}
		rwr_bit_stat.alignment		= "CenterCenter"
		rwr_bit_stat.formats		= {"%s"}
		rwr_bit_stat.stringdefs		= MPCD_large_font_size
		rwr_bit_stat.controllers	= {{"EW_RWR_Sts_ON"}, {"EW_RWR_Failure"}}
Add_MPCD_Element(rwr_bit_stat)


-- CONTACTS ALIGNMENT
--[[
local	ContactPos				= CreateElement "ceSimple"
		ContactPos.name			= "ContactPos"
		ContactPos.init_pos		= {0.0, 0.0, 0.0}
		ContactPos.controllers	= {{"EW_ContactPos", 0, 0.125}}
Add_MPCD_Element(ContactPos)

local	ContactCode					= CreateElement "ceStringPoly"
		ContactCode.name			= "ContactCode"
		ContactCode.material		= mpcd_font_tacan
		ContactCode.init_pos		= {0, 0, 0}
		ContactCode.alignment		= "CenterCenter"
		ContactCode.parent_element	= "ContactPos"
		ContactCode.value			= "UK"
		ContactCode.stringdefs		= MPCD_large_font_size
Add_MPCD_Element(ContactCode)
--]]

-- CONTACTS (16 max)

for i = 1, 16 do

	local	ThreatPlacer				= CreateElement "ceSimple"
			ThreatPlacer.name			= "ThreatPlacer" .. string.format("%02d", i)
			ThreatPlacer.init_pos		= {0.0, 0.0, 0.0}
			ThreatPlacer.controllers	= {{"EW_ThreatPos", i-1, 0.125}, {"EW_Threat_is_Primary", i-1}}
	Add_MPCD_Element(ThreatPlacer)
	
	local	ThreatCode					= CreateElement "ceStringPoly"
			ThreatCode.name				= "ThreatCode" .. string.format("%02d", i)
			ThreatCode.material			= mpcd_font_tacan
			ThreatCode.init_pos			= {0, 0, 0}
			ThreatCode.alignment		= "CenterCenter"
			ThreatCode.parent_element	= "ThreatPlacer" .. string.format("%02d", i)
			ThreatCode.formats			= {"%s"}
			ThreatCode.stringdefs		= MPCD_large_font_size
			ThreatCode.controllers		= {{"EW_ThreatCode", i-1}}
	Add_MPCD_Element(ThreatCode)
	
	local	ThreatAirborneSymbol				= create_mpcd_textured_box( 670, 10, 707, 32, nil, nil, 3)
			ThreatAirborneSymbol.name			= "ThreatAirborneSymbol" .. string.format("%02d", i)
			ThreatAirborneSymbol.init_pos		= {0, 0.06, 0}
			ThreatAirborneSymbol.parent_element	= "ThreatPlacer" .. string.format("%02d", i)
			ThreatAirborneSymbol.controllers	= {{"EW_Threat_is_Airborne", i-1}}
	Add_MPCD_Element(ThreatAirborneSymbol)
	
	local	ThreatSeaborneSymbol				= create_mpcd_textured_box( 666, 34, 713, 48, nil, nil, 3)
			ThreatSeaborneSymbol.name			= "ThreatSeaborneSymbol" .. string.format("%02d", i)
			ThreatSeaborneSymbol.init_pos		= {0, -0.05, 0}
			ThreatSeaborneSymbol.parent_element	= "ThreatPlacer" .. string.format("%02d", i)
			ThreatSeaborneSymbol.controllers	= {{"EW_Threat_is_Seaborne", i-1}}
	Add_MPCD_Element(ThreatSeaborneSymbol)
	
	local	ThreatNewSymbol						= create_mpcd_textured_box( 422, 3, 530, 111, nil, nil, 3)
			ThreatNewSymbol.name				= "ThreatNewSymbol" .. string.format("%02d", i)
			ThreatNewSymbol.init_pos			= {0, 0, 0}
			ThreatNewSymbol.parent_element		= "ThreatPlacer" .. string.format("%02d", i)
			ThreatNewSymbol.controllers			= {{"EW_Threat_is_New", i-1}}
	Add_MPCD_Element(ThreatNewSymbol)

end