---@class CBRadioHelper : provides helpers use of a map wide CB Radio
---
---

CBRadioHelper = {};
local CBRadioHelper_mt = Class(CBRadioHelper);
addModEventListener(CBRadioHelper); --gives you access to continually running complete lifecycle

CBRadioHelper.workerText = "";
CBRadioHelper.vehicleText = "";
CBRadioHelper.fillLevelText = "";
CBRadioHelper.pricePerHour = 1000;
CBRadioHelper.modName = g_currentModName;
CBRadioHelper.modDir = g_currentModDirectory;

source(Utils.getFilename("scripts/utils.lua", CBRadioHelper.modDir));

local modDescFile = loadXMLFile("modDesc", g_currentModDirectory .. "modDesc.xml");
CBRadioHelper.title = getXMLString(modDescFile, "modDesc.title.en");
CBRadioHelper.author = getXMLString(modDescFile, "modDesc.author");
CBRadioHelper.version = getXMLString(modDescFile, "modDesc.version");
CBRadioHelper.pricePerHour = getXMLString(modDescFile, "modDesc.helperHourlyWage");
CBRadioHelper.debug = false;
delete(modDescFile);



--source(g_currentModDirectory)

---@generic every time a helper speaks, you store what event they spoke
CBRadioHelper.didIsayThatTable = {"init"}

---@generic assembled in the update loop and then used in the draw loop
CBRadioHelper.textForRender = "init";

---@generic used to "queue" samples one after another
CBRadioHelper.lastCbSamplePlayed = 0;

CBRadioHelper.playedHourlyAlert = false;
CBRadioHelper.playedHourlyAlertHour = nil;
CBRadioHelper.playedChatterAlertMinute = 0;
CBRadioHelper.playedChatterAlert = false;

---@generic this should be a modulus of 60 to work
CBRadioHelper.playChatterInterval = 5;

CBRadioHelper.activeCombineHelpers = 0;
CBRadioHelper.tableTextToRender = {};

--renderOverlay(overlay, posX, posY, sizeX, sizeY, state)
CBRadioHelper.overlayData = {
	posX = .05,
	posY = .975,
	sizeX = 0,
	sizeY = .015
}

CBRadioHelper.overlayText = {
	x = .055,
	y = .985;
}

CBRadioHelper.brandNames = {
	CASE = "CASE",
	CLAAS = "CLAAS",
	JOHN_DEERE = "JOHN DEERE",
	NEW_HOLLAND = "NEW HOLLAND",
	ROSTSELMASH = "ROSTSELMASH"
}

---@generic provides template for renderText options
CBRadioHelper.colors = {
	lightBlue = {0.00, 0.70, 1.00, 1.00},  -- LightBlue
	default =   {1.00, 1.00, 1.00, 1.00},  -- White
	PARKED =    {0.70, 0.70, 0.70, 0.70},  -- Light Gray
	hovered =   {0.20, 0.20, 1.00, 1.00},  -- Purple
	BLOCKED =   {1.00, 0.00, 0.00, 1.00},  -- Red
	selected =  {1.00, 0.00, 0.00, 1.00},  -- Red
	TANKLOW =   {0.00, 1.00, 0.00, 1.00},  -- Green
	TANKMID =   {1.00, 0.60, 0.00, 1.00},  -- Orange
	TANKFULL =  {1.00, 0.00, 0.00, 1.00},  -- Red
	INACTIVE =  {0.60, 0.38, 0.38, 1.00},  -- Dark red
	entered =   {0.00, 1.00, 1.00, 1.00},  -- Cyan
	helper =    {0.75, 1.00, 0.45, 1.00},  -- Green/Yellow
	BGColor =   {0.00, 0.00, 0.00, 0.70},  -- Only alpha is working
	BGBlack =   {0.00, 0.00, 0.00, 1.00}   -- Only alpha is working
};

CBRadioHelper.alertLevels = {
	COMBINECAPACITYLVL1_START = 70,
	COMBINECAPACITYLVL1_END = 84,
	COMBINECAPACITYLVL2_START = 85,
	COMBINECAPACITYLVL2_END = 99,
}

CBRadioHelper.cbMessageTypes = {
	OUTOFFUEL = "OUTOFFUEL",
	BLOCK = "BLOCK",
	BRANDMESSAGE_CASE = "BRANDMESSAGE_CASE",
	BRANDMESSAGE_CLAAS = "BRANDMESSAGE_CLAAS",
	BRANDMESSAGE_JOHN_DEERE = "BRANDMESSAGE_JOHN_DEERE",
	BRANDMESSAGE_NEW_HOLLAND = "BRANDMESSAGE_NEW_HOLLAND",
	BRANDMESSAGE_ROSTSELMASH = "BRANDMESSAGE_ROSTSELMASH",
	COMBINECAPACITYLVL1 = "COMBINECAPACITYLVL1",
	COMBINECAPACITYLVL2 = "COMBINECAPACITYLVL2",
	COMBINECAPACITYLFULL = "COMBINECAPACITYFULL" ,
	CONTINUEWORK = "CONTINUEWORK",
	RIDEALONG = "RIDEALONG",
	THANKSHAULER = "THANKSHAULER",
	FARMER_WORKSTART = "FARMER_WORKSTART",
	FARMER_WORKEND = "FARMER_WORKEND",
	GENERALWORKSTART = "GENERALWORKSTART",
	GENERALWORKEND = "GENERALWORKEND",
	CBCHATTER = "CBCHATTER",
	THREEOCLOCK = "THREEOCLOCK",
	SIXOCLOCK = "SIXOCLOCK",
	NINEOCLOCK = "NINEOCLOCK",
	MIDNIGHT = "MIDNIGHT",
	TWELVEOCLOCK = "TWELVEOCLOCK",
	SUNSET = "SUNSET",
	SUNRISE = "SUNRISE",
	FORCASTRAIN = "FORCASTRAIN",
	FORCASTSNOW = "FORCASTSNOW",
	WEATHERRAIN = "WEATHERRAIN",
	WEATHERSNOW = "WEATHERSNOW",
	GREETINGMESSAGE = "GREETINGMESSAGE"
}


--A = male white
--B = male white
--C = male white
--D = male black
--E = female white
--F = female white
--G = male black
--H - female black
--I = female black
--J = male white
--Z = male DO NOT CHANGE
CBRadioHelper.cbHelperNames = {
	A = "Kevin",
	B = "Michael",
	C = "Tom",
	D = "Jerid",
	E = "Allison" ,
	F = "Linda",
	G = "Curtis",
	H = "Lisa",
	I = "Lilly",
	J = "Shawn",
	Z = "gordo"
}

---@generic do not change helper Z
CBRadioHelper.cbHelperGenders = {
	A = "M",
	B = "M",
	C = "M",
	D = "M",
	E = "F",
	F = "F",
	G = "M",
	H = "F",
	I = "F",
	J = "M",
	Z = "M"
}

CBRadioHelper.genericHelper = {
	name = "Z",
	title = "Z"
}

---@generic more of a stub as loading of specializations is handled in CDRadioRegister.lua
---@return boolean
function CBRadioHelper.prerequisitesPresent(specializations)
	return true;
end


--function CBRadioHelper:new(i18n)
--	self.i18n = i18n;
--end


--- Fixes global translations.
function CBRadioHelper.getText(i18n, superFunc, name, customEnv)
	return superFunc(i18n, name, customEnv or CBRadioHelper.modName)
end
I18N.getText = Utils.overwrittenFunction(I18N.getText, CBRadioHelper.getText)

---@generic all the events we want to be altered of
function CBRadioHelper.registerEventListeners(vehicleType)

	SpecializationUtil.registerEventListener(vehicleType, "onUpdate", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onDraw", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onLoad", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onPostLoad", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "saveToXMLFile", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onRegisterActionEvents", CBRadioHelper)
 	SpecializationUtil.registerEventListener(vehicleType, "onReadStream", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onWriteStream", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onReadUpdateStream", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onWriteUpdateStream", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onPostAttachImplement", CBRadioHelper) 
	SpecializationUtil.registerEventListener(vehicleType, "onPreDetachImplement", CBRadioHelper)


	SpecializationUtil.registerEventListener(vehicleType, "onUpdateTick", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onLoadMap", CBRadioHelper) 

	SpecializationUtil.registerEventListener(vehicleType, "onAIDriveableStart", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onAIDriveableActive", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onAIDriveableEnd", CBRadioHelper)
	
	--gameSource\dataS\scripts\vehicles\specializations\AIJobVehicle.lua
	SpecializationUtil.registerEventListener(vehicleType, "onAIJobStarted", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onAIJobFinished", CBRadioHelper)
	
	--gameSource\dataS\scripts\vehicles\specializations\AIImplement.lua
	SpecializationUtil.registerEventListener(vehicleType, "onAIImplementBlock", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onAIImplementContinue", CBRadioHelper)
	--gameSource\dataS\scripts\vehicles\specializations\AIFieldWorker
	SpecializationUtil.registerEventListener(vehicleType, "onAIImplementActive", CBRadioHelper)

	SpecializationUtil.registerEventListener(vehicleType, "onEnterVehicle", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onLeaveVehicle", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onSetBroken", CBRadioHelper)

	--gameSource\dataS\scripts\vehicles\specializations\Dischargeable.lua
	SpecializationUtil.registerEventListener(vehicleType, "onDischargeStateChanged", CBRadioHelper)

	--gameSource\dataS\scripts\vehicles\specializations\combine.lua
	SpecializationUtil.registerEventListener(vehicleType, "onStartWorkAreaProcessing", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onEndWorkAreaProcessing", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onFillUnitLevelChanged", CBRadioHelper)

	SpecializationUtil.registerEventListener(vehicleType, "onStartThreshing", CBRadioHelper)
	SpecializationUtil.registerEventListener(vehicleType, "onStopThreshing", CBRadioHelper)

	--print("CBRadioHelper registerEventListeners loaded ========================================================");
end


---@generic fires when the game map loads
function CBRadioHelper:loadMap()
	--print("CBRadioHelper loadMap loaded ========================================================");
	--print("CBRH_langCode: "..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode);
	--print("CBRH_helperA: "..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperA);

	if g_modIsLoaded["FS22_HelperNameHelper"] == true then
		g_gui:showInfoDialog({
			text = "ATTENTION MOD CONFLICT: you are running FS22_HelperNameHelper which alters the in-game helpers. Please disable this mod to use CB Radio Helpers or hiring helpers will NOT work!";
		})
	end

	-- https://forum.giants-software.com/viewtopic.php?t=124817
	if g_currentMission:getIsServer() then
		if CBRadioHelper ~= nil then
			addConsoleCommand('restartMySavegame', 'Restart my savegame', 'restartMySavegame', self); -- Add a console command when the mod is loaded, you can call this command from in game console and quickly restart the savegame.
		end
	end

	if CBRadioHelper.debug then
		print("--- CBRadioHelper Debug ... CBRadioHelper:loadMap ++ isClient="..tostring(g_currentMission:getIsClient()).." ,isServer="..tostring(g_currentMission:getIsServer()).." ,isMasterUser="..tostring(g_currentMission.isMasterUser).." ,isMultiplayer="..tostring(g_currentMission.missionDynamicInfo.isMultiplayer).." ---");
	end;


	--i18n = _G[g_currentMission.missionInfo.customEnvironment].g_i18n;

	--for key, text in pairs(i18n.texts) do
	--	global[key] = text
	--end

	--CBRadioHelper.workerText = g_i18n:getText("ui_helper");
	--CBRadioHelper.vehicleText = g_i18n:getText("typeDesc_combine");
	--CBRadioHelper.fillLevelText = g_i18n:getText("info_fillLevel");
	CBRadioHelper.vehicleText = string.upper(string.sub(CBRadioHelper.vehicleText,0,1))..string.sub(CBRadioHelper.vehicleText,2);

	CBRadioHelper.cbHelperNames["A"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperA;
	CBRadioHelper.cbHelperNames["B"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperB;
	CBRadioHelper.cbHelperNames["C"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperC;
	CBRadioHelper.cbHelperNames["D"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperD;
	CBRadioHelper.cbHelperNames["E"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperE;
	CBRadioHelper.cbHelperNames["F"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperF;
	CBRadioHelper.cbHelperNames["G"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperG;
	CBRadioHelper.cbHelperNames["H"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperH;
	CBRadioHelper.cbHelperNames["I"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperI;
	CBRadioHelper.cbHelperNames["J"] = g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_helperJ;

	if CBRadioHelper.vehicleText == "Harvester" then
		CBRadioHelper.vehicleText = "Combine";
		--print("OHHH look... CBRadioHelper loadMap located a combine!");
	end;

	anyoneWithACopyComeInM = createSample("anyoneWithACopyComeInM")
	appreciateTheComebackGoodBuddyM = createSample("appreciateTheComebackGoodBuddyM")
	breakerBreakerM = createSample("breakerBreakerM")
	hollarWhenHome20M = createSample("hollarWhenHome20M")
	heyGoodBuddyM = createSample("heyGoodBuddyM")
	thatsABig104M = createSample("thatsABig104M")
	thatsABig104V2M = createSample("thatsABig104V2M")
	thatsABig104V3M = createSample("thatsABig104V3M")
	timeToPullTheBigSwitchM = createSample("timeToPullTheBigSwitchM")
	break19ForARadioCheckM = createSample("break19ForARadioCheckM")

	greetingMessage = createSample("greetingMessage")
	cbChatter1 = createSample("cbChatter1");
	cbChatter2 = createSample("cbChatter2");
	cbChatter3 = createSample("cbChatter3");
	cbChatter4 = createSample("cbChatter4");
	cbChatter5 = createSample("cbChatter5");
	cbChatter6 = createSample("cbChatter6");
	cbChatter7 = createSample("cbChatter7");
	cbChatter8 = createSample("cbChatter8");

	generalWorkStart1_B = createSample("generalWorkStart1_B");
	generalWorkStart2_B = createSample("generalWorkStart2_B");
	generalWorkStart3_B = createSample("generalWorkStart3_B");
	generalWorkStart1M = createSample("generalWorkStart1M");
	generalWorkStart2M = createSample("generalWorkStart2M");
	generalWorkStart3M = createSample("generalWorkStart3M");
	generalWorkStart1F = createSample("generalWorkStart1F");
	generalWorkStart2F = createSample("generalWorkStart2F");
	generalWorkStart3F = createSample("generalWorkStart3F");
	generalWorkStart1_E = createSample("generalWorkStart1_E");
	generalWorkStart2_E = createSample("generalWorkStart2_E");
	generalWorkStart3_E = createSample("generalWorkStart3_E");
	generalWorkStart4_E = createSample("generalWorkStart4_E");

	brandMessageCase_A = createSample("brandMessageCase_A");
	brandMessageCase_B = createSample("brandMessageCase_B");
	brandMessageCaseV2_B = createSample("brandMessageCaseV2_B");
	brandMessageCaseV3_B = createSample("brandMessageCaseV3_B");
	brandMessageCase_E = createSample("brandMessageCase_E");
	brandMessageCase_F = createSample("brandMessageCase_F");
	brandMessageCaseM = createSample("brandMessageCaseM");
	brandMessageCaseF = createSample("brandMessageCaseF");
	brandMessageClaasM = createSample("brandMessageClaasM");
	brandMessageClaasF = createSample("brandMessageClaasF");
	brandMessageClaas_B = createSample("brandMessageClass_B");
	brandMessageClaas_E = createSample("brandMessageClaas_E");
	brandMessageJDM = createSample("brandMessageJDM");
	brandMessageJDV2M = createSample("brandMessageJDV2M");
	brandMessageJDV3M = createSample("brandMessageJDV3M");
	brandMessageJDV4M = createSample("brandMessageJDV4M");
	brandMessageJDV5M = createSample("brandMessageJDV5M");
	brandMessageJDF = createSample("brandMessageJDF");
	brandMessageJDV2F = createSample("brandMessageJDV2F");
	brandMessageJDV3F = createSample("brandMessageJDV3F");
	brandMessageJDV4F = createSample("brandMessageJDV4F");
	brandMessageJDV5F = createSample("brandMessageJDV5F");

	letsseewhatwecangetdone_A = createSample("letsseewhatwecangetdone_A");
	iwillgetitdone_A = createSample("iwillgetitdone_A");
	imonit_A = createSample("imonit_A");
	allDoneWithThisJob_A = createSample("allDoneWithThisJob_A");
	goodToSeeYouBoss_A = createSample("goodToSeeYouBoss_A");
	iGotThisJobCovered_A = createSample("iGotThisJobCovered_A");
	allFiredUpReadyToRoll_A = createSample("allFiredUpReadyToRoll_A")
	thanksForTheWorkBoss_A = createSample("thanksForTheWorkBoss_A")


	letsseewhatwecangetdone_E = createSample("letsseewhatwecangetdone_E");
	iwillgetitdone_E = createSample("iwillgetitdone_E");
	imonit_E = createSample("imonit_E");
	allDoneWithThisJob_E = createSample("allDoneWithThisJob_E");
	goodToSeeYouBoss_E = createSample("goodToSeeYouBoss_E");
	iGotThisJobCovered_E = createSample("iGotThisJobCovered_E");
	allFiredUpReadyToRoll_E = createSample("allFiredUpReadyToRoll_E")
	thanksForTheWorkBoss_E = createSample("thanksForTheWorkBoss_E")

	generalWorkEnd1M = createSample("generalWorkEnd1M");
	generalWorkEnd2M = createSample("generalWorkEnd2M");
	generalWorkEnd3M = createSample("generalWorkEnd3M");
	generalWorkEnd4M = createSample("generalWorkEnd4M");
	generalWorkEnd1F = createSample("generalWorkEnd1F");
	generalWorkEnd2F = createSample("generalWorkEnd2F");
	generalWorkEnd3F = createSample("generalWorkEnd3F");
	generalWorkEnd1_B = createSample("generalWorkEnd1_B");
	generalWorkEnd2_B = createSample("generalWorkEnd1_B");
	generalWorkEnd3_B = createSample("generalWorkEnd1_B");
	generalWorkEnd1_E = createSample("generalWorkEnd1_E");
	generalWorkEnd2_E = createSample("generalWorkEnd2_E");
	generalWorkEnd3_E = createSample("generalWorkEnd3_E");
	combineCapacityLvl1M = createSample("combineCapacityLvl1M");
	combineCapacityLvl1_A = createSample("combineCapacityLvl1_A");
	combineCapacityLvl1_E = createSample("combineCapacityLvl1_E");
	combineCapacityLvl2M = createSample("combineCapacityLvl2M");
	combineCapacityLvl2_A = createSample("combineCapacityLvl2_A");
	combineCapacityLvl2_E = createSample("combineCapacityLvl2_E");
	combineCapacityFullM = createSample("combineCapacityFullM");
	combineCapacityFull_A = createSample("combineCapacityFull_A");
	combineCapacityFull_E = createSample("combineCapacityFull_E");
	combineCapacityLvl1F = createSample("combineCapacityLvl1F");
	combineCapacityLvl2F = createSample("combineCapacityLvl2F");
	combineCapacityFullF = createSample("combineCapacityFullF");
	combineCapacityFull_A = createSample("combineCapacityFull_A");

	lowOnFuel = createSample("lowOnfuel");
	needUnloaded = createSample("needUnloaded");
	blockM = createSample("blockM");
	blockF = createSample("blockF");
	block_A = createSample("block_A");
	blockV2_A = createSample("blockV2_A");
	block_E = createSample("block_E");
	blockV2_E = createSample("blockV2_E");
	continueWorkM = createSample("continueWorkM");
	continueWorkF = createSample("continueWorkF");
	continueWork_A = createSample("continueWork_A");
	continueWork_E = createSample("continueWork_E");
	rideAlong1M = createSample("rideAlong1M");
	rideAlong2M = createSample("rideAlong2M");
	rideAlong3M = createSample("rideAlong3M");
	rideAlong1F = createSample("rideAlong1F");
	rideAlong2F = createSample("rideAlong2F");
	rideAlong3F = createSample("rideAlong3F");
	rideAlong1_E = createSample("rideAlong1_E");
	rideAlong2_E = createSample("rideAlong2_E");
	rideAlong3_E = createSample("rideAlong3_E");

	alert1 = createSample("alert1");
	airHorn = createSample("airHorn");
	airHorn2Blows = createSample("airHorn2Blows");
	thanksHaulerM = createSample("thanksHaulerM");
	thanksHaulerF = createSample("thanksHaulerF");
	thanksHauler_A = createSample("thanksHauler_A");
	thanksHauler_E = createSample("thanksHauler_E");

	threeoclock = createSample("threeoclock");
	sixoclock = createSample("sixoclock");
	nineoclock = createSample("nineoclock");
	midnight = createSample("midnight");
	twelveoclock = createSample("twelveoclock");
	sunset = createSample("sunset");
	sunrise = createSample("sunrise");
	weatherRainComing = createSample("weatherRainComing");
	weatherSnowComing = createSample("weatherSnowComing");
	weatherRain = createSample("weatherRain");
	weatherRainV2 = createSample("weatherRainV2");
	weatherRainV3 = createSample("weatherRainV3");
	weatherSnow = createSample("weatherSnow");
	weatherSnowV2 = createSample("weatherSnowV2");
	weatherSnowV3 = createSample("weatherSnowV3");

	loadSample(anyoneWithACopyComeInM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.. "/anyoneWithACopyComeIn.ogg", CBRadioHelper.modDir) ,false);
	loadSample(appreciateTheComebackGoodBuddyM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.. "/appreciateTheComebackGoodBuddy.ogg", CBRadioHelper.modDir) ,false);
	loadSample(breakerBreakerM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreaker.ogg", CBRadioHelper.modDir) ,false);
	loadSample(hollarWhenHome20M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/hollarHome20.ogg", CBRadioHelper.modDir) ,false);
	loadSample(heyGoodBuddyM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/heyGoodBuddy.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thatsABig104M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/thatsABig104.ogg", CBRadioHelper.modDir) ,false);
	loadSample(timeToPullTheBigSwitchM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/timeToPullTheBigSwitch.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thatsABig104V2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/thatsABig104V2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thatsABig104V3M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/thatsABig104V3.ogg", CBRadioHelper.modDir) ,false);
	loadSample(break19ForARadioCheckM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/break19ForARadioCheck.ogg", CBRadioHelper.modDir) ,false);

	loadSample(thanksForTheWorkBoss_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/break19ForARadioCheck.ogg", CBRadioHelper.modDir) ,false);

	loadSample(greetingMessage, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/break19ForARadioCheck.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter1, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatter.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter2, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter3, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV3.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter4, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV4.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter5, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV5.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter6, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV6.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter7, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV7.ogg", CBRadioHelper.modDir) ,false);
	loadSample(cbChatter8, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/cbChatterV8.ogg", CBRadioHelper.modDir) ,false);

	loadSample(generalWorkStart1_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iwillgetitdone-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart2_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allFiredUpReadyToRoll-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart3_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imonit-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart1M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iWillGetItDone.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allFiredUpReadyToRoll.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart3M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imOnIt.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart1F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iWillGetItDone-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart2F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allFiredUpReadyToRoll-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart3F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imOnIt-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart1_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iWillGetItDone-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart2_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allFiredUpReadyToRoll-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart3_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imOnIt-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkStart4_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/thanks4theworkBoss-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(brandMessageCase_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseGettinIt-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCase_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseGettinIt-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCaseV2_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseBrand-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCaseV3_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseBrandV2-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCase_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseBrand-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCase_F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseBrand-H.ogg", CBRadioHelper.modDir) ,false)
	loadSample(brandMessageCaseM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseGettinIt.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageCaseF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/caseBrand-H.ogg", CBRadioHelper.modDir) ,false);


	loadSample(brandMessageClaasM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/claasNotBreakinSweat.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageClaasF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/claasBrand-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageClaas_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/claasNotBreakinSweat-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageClaas_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/claasBrand-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(brandMessageJDM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrand.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV3M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV3.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV4M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV4.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV5M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV5.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandF.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV2F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV2F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV3F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV3F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV4F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV4F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(brandMessageJDV5F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/jdBrandV5F.ogg", CBRadioHelper.modDir) ,false);

	loadSample(letsseewhatwecangetdone_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/letsseewhatwecangetdone-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(iwillgetitdone_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iwillgetitdone-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(imonit_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imonit-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(allDoneWithThisJob_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(goodToSeeYouBoss_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/goodToSeeYouBoss-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(iGotThisJobCovered_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iGotThisJobCovered-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(allFiredUpReadyToRoll_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allfiredupreadytoroll-A.ogg", CBRadioHelper.modDir) ,false);

	loadSample(letsseewhatwecangetdone_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/letsSeeWhatWeCanGetDone-E.ogg", CBRadioHelper.modDir) ,false);
	--loadSample(iwillgetitdone_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iwillgetitdone-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(imonit_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imOnIt-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(allDoneWithThisJob_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(goodToSeeYouBoss_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/goodToSeeYouBoss-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(iGotThisJobCovered_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iGotThisJobCovered-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(allFiredUpReadyToRoll_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allFiredUpReadyToRoll-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(generalWorkEnd1M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/doneWithTheJob.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd3M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreakerImAllDone.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd4M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreakerImAllDoneV2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd1F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/doneWithTheJob-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd2F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd3F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreakerImAllDone-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd1_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/doneWithTheJob-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd2_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd3_B, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreakerImAllDone-B.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd1_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/doneWithTheJob-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd2_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/allDoneWithThisJob-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(generalWorkEnd3_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/breakerBreakerImAllDone-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(combineCapacityLvl1M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl1.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl1_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl1-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl1_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacitylvl1-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl2_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl2-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl2_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacitylvl2-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFullM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFull_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFull_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl1F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl1-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityLvl2F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityLvl2-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFullF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFull_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(combineCapacityFull_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/combineCapacityFull-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(lowOnFuel, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/imRunningLowOnFuel.ogg", CBRadioHelper.modDir) ,false);
	loadSample(needUnloaded, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/needUnloaded.ogg", CBRadioHelper.modDir) ,false);
	loadSample(blockM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelp.ogg", CBRadioHelper.modDir) ,false);
	loadSample(blockF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelp-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(block_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelp-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(blockV2_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelpV2-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(block_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelp-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(blockV2_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/stuckAndNeedHelpV2-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(continueWorkM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rightBackAtIt.ogg", CBRadioHelper.modDir) ,false);
	loadSample(continueWorkF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rightBackAtIt-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(continueWork_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rightBackAtIt-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(continueWork_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rightBackAtIt-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(rideAlong1M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iGotThisJobCovered.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong2M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/niceToHaveYouHere.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong3M, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/goodToSeeYouBoss.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong1F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iGotThisJobCovered-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong2F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/niceToHaveYouHere-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong3F, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/goodToSeeYouBoss-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong1_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/iGotThisJobCovered-E.ogg", CBRadioHelper.modDir) ,false);
	loadSample(rideAlong3_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/goodToSeeYouBoss-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(alert1, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/alert1.ogg", CBRadioHelper.modDir) ,false);
	loadSample(airHorn, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/airHorn.ogg", CBRadioHelper.modDir) ,false);
	loadSample(airHorn2Blows, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/airHorn2Blows.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thanksHaulerM, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/haulerImGood.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thanksHaulerF, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/haulerImGood-F.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thanksHauler_A, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/haulerImgood-A.ogg", CBRadioHelper.modDir) ,false);
	loadSample(thanksHauler_E, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/haulerImGood-E.ogg", CBRadioHelper.modDir) ,false);

	loadSample(threeoclock, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoThreeOclock.ogg", CBRadioHelper.modDir) ,false);
	loadSample(sixoclock, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoSixOclock.ogg", CBRadioHelper.modDir) ,false);
	loadSample(nineoclock, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoNineOclock.ogg", CBRadioHelper.modDir) ,false);
	loadSample(midnight, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoTwelveOclock.ogg", CBRadioHelper.modDir) ,false);
	loadSample(twelveoclock, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoTwelveOclock.ogg", CBRadioHelper.modDir) ,false);
	loadSample(sunset, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/info30MinuteSunset.ogg", CBRadioHelper.modDir) ,false);
	loadSample(sunrise, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/info30MinuteSunrise.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherRainComing, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoWeatherRainComing.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherSnowComing, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/infoWeatherSnowComing.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherRain, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rainContinues.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherRainV2, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rainContinuesV2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherRainV3, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/rainContinuesV3.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherSnow, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/snowContinues.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherSnowV2, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/snowContinuesV2.ogg", CBRadioHelper.modDir) ,false);
	loadSample(weatherSnowV3, Utils.getFilename("sounds/"..g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_langCode.."/snowContinuesV3.ogg", CBRadioHelper.modDir) ,false);

	CBRadioHelper.aiJobFieldWorkGiantsPrice = AIJobFieldWork:getPricePerMs();
	if CBRadioHelper.aiJobFieldWorkGiantsPrice ~= nil then
		AIJobFieldWork.getPricePerMs = Utils.overwrittenFunction(AIJobFieldWork.getPricePerMs, CBRadioHelper.aiJobFieldWorkPricePerMs );
		if CBRadioHelper.debug then
			print("CBRadioHelper overwrittenFunction AIJobFieldWork.getPricePerMs complete during loadMap");
			print("CBRadioHelper pricePerHour: "..CBRadioHelper.pricePerHour);
		end
	end;

	g_messageCenter:subscribe(MessageType.HOUR_CHANGED, self.hourChanged, self);
end

function CBRadioHelper:aiJobFieldWorkPricePerMs(superFunc)
	local PricePerMs = 0;
	superFunc(self);

	PricePerMs = CBRadioHelper.pricePerHour / 60 / 60 / 1000; --CBRadioHelper.aiJobFieldWorkGiantsPrice * .25;

	if CBRadioHelper.debug then
		--print("CBRadioHelper setting helper wage for field work to "..PricePerMs);
	end

	return PricePerMs;
end

function CBRadioHelper:hourChanged()

	--if g_sleepManager:getIsSleeping() then return end;
	--@TODO might not want this to run at all if the game speed is set too fast
	if g_sleepManager:getIsSleeping() then return end;

	--print("g_currentMission.environment.currentHour: " .. g_currentMission.environment.currentHour );

	local x = 1
	while ( x < 5)
	do
		local weatherType = g_weatherTypeManager.indexToName[x];
		if CBRadioHelper.debug then
			print( weatherType );
		end
		x = x + 1;
	end

	--https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=15&class=151
	--GameInfoDisplay
	local sixHours = 6 * 60 * 60 * 1000
	local env = g_currentMission.environment
	local dayPlus6h, timePlus6h = env:getDayAndDayTime(env.dayTime + sixHours, env.currentDay)
	local weatherState = env.weather:getWeatherTypeAtTime(env.currentDay, env.dayTime)
	local nextWeatherState = env.weather:getWeatherTypeAtTime(dayPlus6h, timePlus6h)

	if CBRadioHelper.debug then
		print("weatherState: ".. g_weatherTypeManager.indexToName[weatherState] )
		print("nextWeatherState: ".. g_weatherTypeManager.indexToName[nextWeatherState] )

		print("weather:getIsRaining(): ".. tostring(g_currentMission.environment.weather:getIsRaining()) );
	end

	if g_weatherTypeManager.indexToName[nextWeatherState] == 'RAIN' then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.FORCASTRAIN, CBRadioHelper.genericHelper);
	end
	if g_weatherTypeManager.indexToName[nextWeatherState] == 'SNOW' then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.FORCASTSNOW, CBRadioHelper.genericHelper);
	end

	if g_currentMission.environment.weather:getIsRaining() then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.WEATHERRAIN, CBRadioHelper.genericHelper);
	end

	if weatherState == 'SNOW' then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.WEATHERSNOW, CBRadioHelper.genericHelper);
	end

	if g_currentMission.environment.currentHour == 15 then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.THREEOCLOCK, CBRadioHelper.genericHelper);
	elseif g_currentMission.environment.currentHour == 18 then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.SIXOCLOCK, CBRadioHelper.genericHelper);
	elseif g_currentMission.environment.currentHour == 21 then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.NINEOCLOCK, CBRadioHelper.genericHelper);
	elseif g_currentMission.environment.currentHour == 21 then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.MIDNIGHT, CBRadioHelper.genericHelper);
	elseif g_currentMission.environment.currentHour == 12 then
		CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.TWELVEOCLOCK, CBRadioHelper.genericHelper);
	end


	local dayMinutes = g_currentMission.environment.dayTime / 60000
	--print("daylight.logicalNightStartMinutes: " .. g_currentMission.environment.daylight.logicalNightStartMinutes )
	--print("dayMinutes: ".. dayMinutes);
	--print("time left till sunset: ".. (g_currentMission.environment.daylight.logicalNightStartMinutes - dayMinutes) );

	if g_currentMission.environment.currentHour >= 17 and g_currentMission.environment.currentHour < 22 then
		if ( g_currentMission.environment.daylight.logicalNightStartMinutes - dayMinutes ) <= 40 then
			if ( g_currentMission.environment.daylight.logicalNightStartMinutes - dayMinutes)  > -40 then
				CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.SUNSET, CBRadioHelper.genericHelper);
			end
		end
	end

	--print("daylight.logicalNightEndMinutes: " .. g_currentMission.environment.daylight.logicalNightEndMinutes )
	--print("dayMinutes: ".. dayMinutes);
	--print("time left till sunrise: ".. (g_currentMission.environment.daylight.logicalNightEndMinutes - dayMinutes) );
	if g_currentMission.environment.currentHour >= 5 and g_currentMission.environment.currentHour < 9 then
		if ( g_currentMission.environment.daylight.logicalNightEndMinutes - dayMinutes ) <= 60 then
			if ( g_currentMission.environment.daylight.logicalNightEndMinutes - dayMinutes)  > -30 then
				CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.SUNRISE, CBRadioHelper.genericHelper);
			end
		end
	end

end

function CBRadioHelper.isItDaytime()
	if g_currentMission.environment.isSunOn then
		return true
	else
		return false
	end
end
function CBRadioHelper:onAIJobStarted()
	if CBRadioHelper.debug then
		print("CBRadioHelper:onAIJobStarted loaded ========================================================");
	end

	if g_modIsLoaded["FS22_HelperNameHelper"] == true then
		g_gui:showInfoDialog({
			text = "ATTENTION MOD CONFLICT: you are running FS22_HelperNameHelper which alters the in-game helpers. Please disable this mod to use CB Radio Helpers or hiring helpers will NOT work!";
		})
	end

	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.FARMER_WORKSTART, CBRadioHelper.genericHelper )
	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.GENERALWORKSTART, self.spec_CBRadioHelper:getCurrentHelper() );

	if self.spec_CBRadioHelper:getIsAIActive() and self.spec_CBRadioHelper.spec_combine ~= nil then
		CBRadioHelper.activeCombineHelpers = CBRadioHelper.activeCombineHelpers + 1;
	end

end

function CBRadioHelper:onAIJobFinished()

	--@todo probably worth considering a cleaning of any other CB alerts or messages for this helper in didIsayThatTable?
	-- could be playStop for this helper... which is not clean but stops a queue effect

	if CBRadioHelper.debug then
		print("CBRadioHelper:onAIJobFinished loaded ========================================================");
	end

	if self.spec_CBRadioHelper:getIsAIActive() and self.spec_CBRadioHelper.spec_combine ~= nil then
		CBRadioHelper.activeCombineHelpers = CBRadioHelper.activeCombineHelpers - 1;
	end

	-- vehicles\specializations\TurnOnVehicle.lua
	--print("self.spec_CBRadioHelper:getCanAIImplementContinueWork(): ".. tostring( self.spec_CBRadioHelper:getCanAIImplementContinueWork() ) );

	--AIMessageType AIJobVehicle
	local myLastJob = self.spec_CBRadioHelper:getLastJob();
	local helper = CBRadioHelper:cbHelperCrossMapping( g_helperManager:getHelperByIndex( myLastJob.helperIndex ) );
	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.GENERALWORKEND, helper);
	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.FARMER_WORKEND, CBRadioHelper.genericHelper );

	CBRadioHelper:removeDidISayThatAlert(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CASE..helper.name )
	CBRadioHelper:removeDidISayThatAlert(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CLAAS..helper.name )
	CBRadioHelper:removeDidISayThatAlert(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_JOHN_DEERE..helper.name )
	CBRadioHelper:removeDidISayThatAlert(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_NEW_HOLLAND..helper.name )
	CBRadioHelper:removeDidISayThatAlert(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_ROSTSELMASH..helper.name )
end

---@generic maps the in-game helper to a custom version
--- this is used to provide GUI and mapping to sounds
---@param g_currentMission.getCurrentHelper
---@return CBRadioHelper
function CBRadioHelper:cbHelperCrossMapping(passedHelper)
	if CBRadioHelper.debug then
		print("CBRadioHelper:cbHelperCrossMapping called with : ".. passedHelper.name )
	end

	local helper = CBRadioHelper.genericHelper

	for k,v,myhelper in pairs( CBRadioHelper.cbHelperNames ) do
		--print("helper in loop: ".. tostring(k) .. " == " .. tostring(passedHelper.name) .." ?");
		if passedHelper.name == k then
			helper.name = k;
			helper.title = v;
		end
	end

	if CBRadioHelper.debug then
		print("CBRadioHelper:cbHelperCrossMapping returning : ".. tostring(helper.name) );
	end

	return helper;

end

function CBRadioHelper:onAIDriveableStart()
	if CBRadioHelper.debug then
		print("CBRadioHelper:onAIDriveableStart loaded ========================================================");
	end

	playSample(airHorn, 1, 1, 0, 0, 0);
	-- if self.spec_CBRadioHelper:getIsAIActive() then
	-- CBRadioHelper:playCB('generalWorkStart');
	-- end

end
function CBRadioHelper:onAIDriveableActive()
	--print("CBRadioHelper:onAIDriveableActive loaded ========================================================");
end

function CBRadioHelper:onAIImplementActive()
	--print("CBRadioHelper:onAIImplementActive loaded ========================================================");
end

function CBRadioHelper:onAIDriveableEnd()
	--print("CBRadioHelper:onAIDriveableEnd loaded ========================================================");

end

function CBRadioHelper:onAIImplementBlock(vehicleType)
	--print("CBRadioHelper onAIImplementBlock initiated ===========================================================================================");

	playSample(airHorn2Blows, 1, 1, 0, 0, 0);
	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.BLOCK, self.spec_CBRadioHelper:getCurrentHelper());

	return true
end

function CBRadioHelper:onAIImplementContinue(vehicleType)
	--print("CBRadioHelper onAIImplementContinue initiated ===========================================================================================");

	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.CONTINUEWORK, self.spec_CBRadioHelper:getCurrentHelper());

	return true
end

function CBRadioHelper:AIonEnterVehicle(vehicleType)
	--print("CBRadioHelper AIonEnterVehicle initiated ===========================================================================================");
end



function CBRadioHelper:draw()

end

function CBRadioHelper:onDraw()

	--CBRadioHelper.modDir ..



	--renderText(0,0.95,0.04,"r value: " .. self.spec_CBRadioHelper:getName() );
	--renderText(0,0.90,0.03,"vehicle: " .. g_currentMission.currentVehicleName );
	local x = CBRadioHelper.overlayText['x'];
	local y = CBRadioHelper.overlayText['y'];

	--local boxOverlay = Overlay.new( CBRadioHelper.modDir.."scripts/overlay.dds", x, y, 1000, 1000)
	--local boxElement = HUDElement.new(boxOverlay)
	--g_currentMission.hud:addChild(boxElement);

	for i = CBRadioHelper.activeCombineHelpers, 1, - 1 do
		y = y + .001;
	end

	if not g_gui:getIsGuiVisible() then
		if g_currentMission.hud.isVisible then

			CBRadioHelper:renderBackground();

			setTextAlignment(RenderText.ALIGN_LEFT);
			--renderText(x,y,0.01,"-- AI Combines --" );
			-- https://stackoverflow.com/questions/50079030/how-to-math-floor-to-a-decimal-in-lua
			renderText(x,y,0.01, CBRadioHelper.textForRender );

		end
	end

end

---@generic add CB calls from the helpers
---@param passedTable table table you want to iterate looking for an entry
---@param passedHelper table helper who called the message on the CB
function CBRadioHelper:didIsayThat(passedTable, passedHelper)
	--print("CBRadioHelper:didIsayThat called ===========================================================================================")
	--print( type(passedTable) );
	--print(passedHelper);
	--if passedTable == nil then return true; end
	for i, v in pairs(passedTable) do
		--print("i:".. i) --print the number--
		--print("v:".. v) --print the value--
		if v == passedHelper then
			--print("MATCH FOUND: "..v.."=="..passedHelper);
			return true;
		end
	end
	--print("CBRadioHelper:didIsayThat returning false");
	return false;
end

function CBRadioHelper:removeDidISayThatAlert( passedAlertMessage )
	for i, v in pairs(CBRadioHelper.didIsayThatTable) do
		--print("i:".. i) --print the number--
		--print("v:".. v) --print the value--
		if v == passedAlertMessage then
			--print("MATCH FOUND: "..v.."=="..passedHelper);
			table.remove(CBRadioHelper.didIsayThatTable, passedAlertMessage);
			return true;
		end
	end
	--print("CBRadioHelper:didIsayThat returning false");
	return false;
end


function CBRadioHelper:onUpdateTick(dt)
	--print("CBRadioHelper onUpdateTick initiated ===========================================================================================")

	local x = .07;
	local y = .99;

	local textColor = {1,1,1,1};
	local direction = "";

	local fillLevel = 0;
	CBRadioHelper.textForRender = "";

	if g_sleepManager:getIsSleeping() then return end;

	if CBRadioHelper.activeCombineHelpers <= 1 then
		CBRadioHelper.lastBuildPassLength = 0
	end

	--@TODO might not want this to run at all if the game speed is set too fast

	-- introduces some generic chatter to liven up the CB
	--print("starting CBRadioHelper.playedChatterAlert: ".. tostring(CBRadioHelper.playedChatterAlert) );
	--print("starting CBRadioHelper.playedChatterAlertMinute: ".. CBRadioHelper.playedChatterAlertMinute .. " ".. type(CBRadioHelper.playedChatterAlertMinute) );

	--@TODO prevent chatter if this is the top of the hour
	if CBRadioHelper.playedChatterAlertMinute < g_currentMission.environment.currentMinute then
		CBRadioHelper.playedChatterAlert = false -- new minute, reset to consider play again
	end

	if g_currentMission.environment.currentMinute % CBRadioHelper.playChatterInterval == 0 then
		if CBRadioHelper.playedChatterAlert == false then
			CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.CBCHATTER, CBRadioHelper.genericHelper);
			CBRadioHelper.playedChatterAlert = true
			--print("played chatter, now set CBRadioHelper.playedChatterAlert to ".. tostring(CBRadioHelper.playedChatterAlert) );
			CBRadioHelper.playedChatterAlertMinute = g_currentMission.environment.currentMinute;
			--print("played chatter, now set CBRadioHelper.playedChatterAlertMinute to ".. CBRadioHelper.playedChatterAlertMinute );
		else
			--print("CBRadioHelper.playedHourlyAlert was ".. tostring(CBRadioHelper.playedHourlyAlert) .. " chatter already played for this round" );
		end
	else
		--print("modulus test did NOT qualify to play chatter: " .. g_currentMission.environment.currentMinute % CBRadioHelper.playChatterInterval );
	end


	for _, vehicle in pairs(g_currentMission.vehicles) do
		if vehicle:getIsAIActive() and vehicle.spec_combine ~= nil then
			local buildForDrawMessage = "";
			y = y - .01
			textColor = {1,1,1,1};
			setTextColor(unpack(textColor));
			fillLevel = CBRadioHelper:getFillLevel(vehicle);
			--print("CBRadioHelper:update vehicle:getDischargeState(): "..vehicle:getDischargeState() .. type(vehicle:getDischargeState()));

			-- @todo this will fire multiple times for live dumping
			if vehicle:getDischargeState() == 1 and fillLevel == 0 then
				if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.cbMessageTypes.THANKSHAULER..vehicle:getCurrentHelper().name ) == true then

				else
					if not isSamplePlaying(thanksHaulerM) or not isSamplePlaying(thanksHaulerF) then
						CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.THANKSHAULER, self.spec_CBRadioHelper:getCurrentHelper());
						table.insert( CBRadioHelper.didIsayThatTable, CBRadioHelper.cbMessageTypes.THANKSHAULER..vehicle:getCurrentHelper().name);
					end
				end
			end

			if fillLevel >= CBRadioHelper.alertLevels.COMBINECAPACITYLVL1_START and fillLevel <= CBRadioHelper.alertLevels.COMBINECAPACITYLVL1_END then
				textColor = {0.00, 1.00, 0.00, 1.00}
				setTextColor(unpack(textColor));
				if vehicle:getDischargeState() == 0 then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,"combineCapacityLvl1::"..vehicle:getCurrentHelper().name ) == true then
						buildForDrawMessage = "Combine Capacity Lvl1 warning";
					else
						table.insert( CBRadioHelper.didIsayThatTable,"combineCapacityLvl1::"..vehicle:getCurrentHelper().name);
						--print("CBRadioHelper:update playing micCB for combineCapacityLvl1 alert");
						CBRadioHelper:micCB("combineCapacityLvl1", vehicle:getCurrentHelper());
						buildForDrawMessage = vehicle:getCurrentHelper().name .. g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_CombineCapacityLvl1Warning ;
					end
				end
			end

			if fillLevel >= CBRadioHelper.alertLevels.COMBINECAPACITYLVL2_START and fillLevel <= CBRadioHelper.alertLevels.COMBINECAPACITYLVL2_END then
				textColor = {1.00, 0.60, 0.00, 1.00}
				setTextColor(unpack(textColor));
				if vehicle:getDischargeState() == 0 then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,"combineCapacityLvl2::"..vehicle:getCurrentHelper().name ) == true then
						buildForDrawMessage = " Combine Capacity Lvl2 warning";
					else
						table.insert( CBRadioHelper.didIsayThatTable,"combineCapacityLvl2::"..vehicle:getCurrentHelper().name);
						--print("CBRadioHelper:update playing micCB for combineCapacityLvl2 alert");
						CBRadioHelper:micCB("combineCapacityLvl2", vehicle:getCurrentHelper());
						buildForDrawMessage = vehicle:getCurrentHelper().name .. g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_CombineCapacityLvl2Warning;
					end
				end
			end;

			if fillLevel >= 100 then
				textColor = {1.00, 0.00, 0.00, 1.00}
				setTextColor(unpack(textColor));
				if vehicle:getDischargeState() == 0 then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,"combineCapacityFull::"..vehicle:getCurrentHelper().name ) == true then
						buildForDrawMessage = " |PARKED| waiting to unload";
					else
						table.insert( CBRadioHelper.didIsayThatTable,"combineCapacityFull::"..vehicle:getCurrentHelper().name);
						--print("CBRadioHelper:update playing micCB for combineCapacityFull alert");
						CBRadioHelper:micCB("combineCapacityFull", vehicle:getCurrentHelper());
						buildForDrawMessage = vehicle:getCurrentHelper().name .. g_i18n.modEnvironments[CBRadioHelper.modName].texts.CBRH_CombineCapacityFull;
					end
				end
			end;

			setTextColor(unpack(textColor));

			if vehicle:getIsDrivingForward() then
				direction = " ^ "
			elseif vehicle:getIsDrivingBackward() then
				direction = "<*>"
			else
				direction = "(*)"
			end

			-- D:\fsmods\gameSource\dataS\scripts\vehicles\specializations\Drivable.lua
			if vehicle:getDischargeState() == 1 then
				buildForDrawMessage = buildForDrawMessage .. " :UNLOADING: ";
			end

			if vehicle:getIsOperating() == 1 then
				buildForDrawMessage = buildForDrawMessage .. " :THRESHING: ";
			end

			--@todo slow down the machine because of the dirty windshield?
			--if vehicle.isMassDirty then
			--	buildForDrawMessage = buildForDrawMessage.. " :: WASHME ";
			--	--@todo play audio for dirty windshield
			--else
			--	buildForDrawMessage = buildForDrawMessage.. " :: CLEAN ";
			--end

			--buildForDrawMessage = buildForDrawMessage .. " : " .. tostring(g_currentMission.time)

			--@TODO determine what the active farm for the AIFieldWorker is
			--.. " on farm " .. tostring( vehicle.spec_aiJobVehicle.job.farmId)

			--@TODO localize speed
			-- https://gdn.giants-software.com/thread.php?categoryId=3&threadId=6390
			-- Using 'g_i18n:getSpeed' will return the speed in MPH or KPH depending on the user setting.
			-- local speedToDisplay = string.format("%1d - %s", g_i18n:getSpeed(speed), measuringUnit)
			local lastKnownSpeed = 0;

			lastKnownSpeed = math.floor(vehicle:getLastSpeed() * 10) / 10;
			if lastKnownSpeed < 1 then lastKnownSpeed = "00" end;

			local measuringUnit = "KPH";
			if g_gameSettings:getValue("useMiles") then
				measuringUnit = "MPH";
			end;

			local brand = g_brandManager:getBrandByIndex( vehicle:getBrand() );
			local model = vehicle:getName();
			local operatingOnFarm = " :: on farm " .. tostring( vehicle:getAIJobFarmId() ) .. " :: "; --scripts/vehicles/specializations/AIJobVehicle.lua
			if operatingOnFarm == nil then
				operatingOnFarm = " :: "
			end

			--https://stackoverflow.com/questions/43776809/how-to-use-string-as-variable-name-in-lua
			local lineToRender = brand.title .. " " .. model .. " operated by ".. tostring(_G['CBRadioHelper']['cbHelperNames'][vehicle:getCurrentHelper().name]) .. operatingOnFarm .. " " .. direction .. " :: ".. fillLevel .. "% :: " .. buildForDrawMessage .. " :: " .. lastKnownSpeed .. " " .. measuringUnit;

			table.insert( CBRadioHelper.tableTextToRender, string.len(lineToRender) )

			CBRadioHelper.textForRender = CBRadioHelper.textForRender.. "\n".. lineToRender

			buildForDrawMessage = "";

			-- 1 in 20 chance you will get a 1-time brand message
			if math.random(1,200) == 1 then
				if string.find( string.upper(brand.title), CBRadioHelper.brandNames.CASE) then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.brandNames.CASE..vehicle:getCurrentHelper().name ) == true then
						--print (vehicle:getCurrentHelper().name .." already gave brand message for ".. brand.title)
					else
						CBRadioHelper:micCB( CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CASE, self.spec_CBRadioHelper:getCurrentHelper() );
						table.insert( CBRadioHelper.didIsayThatTable, CBRadioHelper.brandNames.CASE..vehicle:getCurrentHelper().name);
					end
				end

				if string.find( string.upper(brand.title), CBRadioHelper.brandNames.CLAAS) then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.brandNames.CLAAS..vehicle:getCurrentHelper().name ) == true then
						--print (vehicle:getCurrentHelper().name .." already gave brand message for ".. brand.title)
					else
						CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CLAAS, self.spec_CBRadioHelper:getCurrentHelper());
						table.insert( CBRadioHelper.didIsayThatTable, CBRadioHelper.brandNames.CLAAS..vehicle:getCurrentHelper().name);
					end
				end
				if string.find( string.upper(brand.title), CBRadioHelper.brandNames.JOHN_DEERE) then
					if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.brandNames.JOHN_DEERE..vehicle:getCurrentHelper().name ) == true then
						--print (vehicle:getCurrentHelper().name .." already gave brand message for ".. brand.title)
					else
						CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.BRANDMESSAGE_JOHN_DEERE, self.spec_CBRadioHelper:getCurrentHelper());
						table.insert( CBRadioHelper.didIsayThatTable, CBRadioHelper.brandNames.JOHN_DEERE..vehicle:getCurrentHelper().name);
					end
				end
			end

		end
	end

end

---
function CBRadioHelper:update(dt)
	--print("CBRadioHelper:update CBRadioHelper.textForRender: " .. CBRadioHelper.textForRender);
end


function CBRadioHelper:onPostLoad()

	--if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.cbMessageTypes.CBCHATTER..CBRadioHelper.genericHelper.name ) == true then
	--	buildForDrawMessage = "CBRadioHelper.cbMessageTypes.CBCHATTER";
	--else
	--	print("CBRadioHelper:update playing micCB for CB chatter");
	--	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.CBCHATTER, CBRadioHelper.genericHelper );
	--end
	--
	--if CBRadioHelper:didIsayThat( CBRadioHelper.didIsayThatTable,CBRadioHelper.cbMessageTypes.GREETINGMESSAGE..CBRadioHelper.genericHelper.name ) == true then
	--	buildForDrawMessage = "CBRadioHelper.cbMessageTypes.GREETINGMESSAGE";
	--else
	--	print("CBRadioHelper:update playing micCB for greeting message");
	--	CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.GREETINGMESSAGE, CBRadioHelper.genericHelper );
	--end

end
function CBRadioHelper:saveToXMLFile()
	return true
end
function CBRadioHelper:onRegisterActionEvents()
	return true
end
function CBRadioHelper:readStream()

end
function CBRadioHelper:onReadStream()
	--self.object = NetworkUtil.readNodeObject(streamId)
	--self.isBlocked = streamReadBool(streamId)
	--self:run(connection)
	--print("CBRadioHelper:onReadStream() isBlocked: " .. self.isBlocked )
end
function CBRadioHelper:onWriteStream()
	return true
end
function CBRadioHelper:onReadUpdateStream()
	return true
end
function CBRadioHelper:onWriteUpdateStream()
	return true
end
function CBRadioHelper:onPostAttachImplement()
	return true
end
function CBRadioHelper:onPreDetachImplement()
	return true
end
function CBRadioHelper:onUpdate(dt)
	-- print("CBRadioHelper onUpdate loaded ========================================================");
	-- print("disableCombineAI: ".. g_currentMission.disableCombineAI );
	return true;
end

function CBRadioHelper:onEnterVehicle(vehicleType)
	--print("CBRadioHelper onEnterVehicle ".. self.spec_CBRadioHelper:getName()  .." initiated ===========================================================================================");

	if self.spec_CBRadioHelper:getIsAIActive() then
		if math.random(1,5) == 2 then
			CBRadioHelper:micCB(CBRadioHelper.cbMessageTypes.RIDEALONG, self.spec_CBRadioHelper:getCurrentHelper());
		end
	end
end

function CBRadioHelper:onLeaveVehicle(vehicleType)
	--print("CBRadioHelper onLeaveVehicle ".. self.spec_CBRadioHelper:getName()  .." initiated ===========================================================================================");
end

function CBRadioHelper:onSetBroken()
	--print("CBRadioHelper:onSetBroken loaded ========================================================");
	
	if self.spec_CBRadioHelper:getIsAIActive() then
		CBRadioHelper:micCB( CBRadioHelper.cbMessageTypes.GENERALWORKEND , self.spec_CBRadioHelper:getCurrentHelper());
	end
	
end

function CBRadioHelper:onDischargeStateChanged(vehicle)
	print("CBRadioHelper onDischargeStateChanged initiated with ".. self.spec_CBRadioHelper:getName() .." on farm ".. self.spec_CBRadioHelper:getActiveFarm()) ;

	if self.spec_CBRadioHelper:getIsAIActive() or self.spec_CBRadioHelper:getIsControlled() then
		print("onDischargeStateChanged returning because it is either AI or controlled by user")
		return
	end;

	print("self.spec_CBRadioHelper:getRootVehicle().spec_combine: ".. tostring(self.spec_CBRadioHelper:getRootVehicle().spec_combine) );
	if self.spec_CBRadioHelper:getRootVehicle().spec_combine == nil then
		print("onDischargeStateChanged returning because this is not a combine")
		return
	end

	-- removing fill should remove issued alerts gradually - not an all or nothing unload process
	if CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() ) <= 10 then
		CBRadioHelper:removeDidISayThatAlert('combineFillLevel1'..self.spec_CBRadioHelper:getCurrentHelper().name )
		CBRadioHelper:removeDidISayThatAlert('combineFillLevel2'..self.spec_CBRadioHelper:getCurrentHelper().name )

		-- if the level goes to less than 50%, let's remove mid fillLevel warnings
	elseif CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() )  >= 11 and CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() ) <= 50 then
		CBRadioHelper:removeDidISayThatAlert('combineFillLevel1'..self.spec_CBRadioHelper:getCurrentHelper().name )
		--if not isSamplePlaying( alert1 ) then
		--	playSample( alert1, 1, .1, 0, 0, 0);
		--end

	-- if the level goes to less than 90%, let's remove high fillLevel warnings
	elseif CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() ) >= 51 and CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() ) <= 90 then
		CBRadioHelper:removeDidISayThatAlert('combineFillLevel2'..self.spec_CBRadioHelper:getCurrentHelper().name )
			--if not isSamplePlaying( alert1 ) then
			--	playSample( alert1, 1, 1, 0, 0, 0);
			--end

	end

	print("CBRadioHelper onDischargeStateChanged fill level: ".. CBRadioHelper:getFillLevel( self.spec_CBRadioHelper:getRootVehicle() ) .." %");
end



function CBRadioHelper:onStartWorkAreaProcessing(vehicle)
	--print("CBRadioHelper onStarWorkAreaProcessing initiated with ".. self.spec_CBRadioHelper:getName() );
end

function CBRadioHelper:onEndWorkAreaProcessing(vehicle)
	--print("CBRadioHelper onEndWorkAreaProcessing initiated with ".. self.spec_CBRadioHelper:getName() );
end

function CBRadioHelper:onFillUnitFillLevelChanged(vehicle)
	--print("CBRadioHelper onFillUnitFillLevelChanged initiated on ".. self.spec_CBRadioHelper:getName() );
end


function CBRadioHelper:onStartThreshing(vehicle)
	--print("CBRadioHelper onStartThreshing initiated on ".. self.spec_CBRadioHelper:getName() );
end


function CBRadioHelper:buildSampleOptionsForHelper(passedHelper, passedMessageType)
	--print("CBRadioHelper:buildSampleOptionsForHelper called")

	local gender = _G['CBRadioHelper']['cbHelperGenders'][passedHelper.name];
	local samples = {};

	--print("CBRadioHelper:buildSampleOptionsForHelper target gender: ".. gender);
	--print("CBRadioHelper:buildSampleOptionsForHelper target cbMessageType: ".. passedMessageType);

	if passedMessageType == CBRadioHelper.cbMessageTypes.GENERALWORKEND then
		if passedHelper.name == 'A' then
			table.insert( samples, allDoneWithThisJob_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, allDoneWithThisJob_E);
			return samples;
		end

		if gender == 'M' then
			table.insert( samples, generalWorkEnd1M );
			table.insert( samples, generalWorkEnd2M );
			table.insert( samples, generalWorkEnd3M );
			table.insert( samples, generalWorkEnd4M );
		else
			table.insert( samples, generalWorkEnd1F );
			table.insert( samples, generalWorkEnd2F );
			table.insert( samples, generalWorkEnd3F );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.CBCHATTER then
		table.insert( samples, cbChatter1);
		table.insert( samples, cbChatter2);
		table.insert( samples, cbChatter3);
		table.insert( samples, cbChatter4);
		table.insert( samples, cbChatter5);
		table.insert( samples, cbChatter6);
		table.insert( samples, cbChatter7);
		table.insert( samples, cbChatter8);
		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.GREETINGMESSAGE then
		table.insert( samples, break19ForARadioCheckM );
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.THREEOCLOCK then
		table.insert( samples, threeoclock);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.SIXOCLOCK then
		table.insert( samples, sixoclock);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.NINEOCLOCK then
		table.insert( samples, nineoclock);
		return samples
		--@TODO create unique midnight alerts
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.MIDNIGHT then
		table.insert( samples, midnight);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.TWELVEOCLOCK then
		table.insert( samples, twelveoclock);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.WEATHERRAIN then
		table.insert( samples, weatherRain);
		table.insert( samples, weatherRainV2);
		table.insert( samples, weatherRainV3);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.WEATHERSNOW then
		table.insert( samples, weatherSnow);
		table.insert( samples, weatherSnowV2);
		table.insert( samples, weatherSnowV3);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.FORCASTRAIN then
		table.insert( samples, weatherRainComing);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.FORCASTSNOW then
		table.insert( samples, weatherSnowComing);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.SUNSET then
		table.insert( samples, sunset);
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.SUNRISE then
		table.insert( samples, sunrise );
		return samples
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.FARMER_WORKSTART then
		if gender == 'M' then
			table.insert( samples, anyoneWithACopyComeInM);
			table.insert( samples, timeToPullTheBigSwitchM);
			table.insert( samples, breakerBreakerM);
			table.insert( samples, heyGoodBuddyM);
		else
			table.insert( samples, anyoneWithACopyComeInM);
			table.insert( samples, timeToPullTheBigSwitchM);
			table.insert( samples, breakerBreakerM);
			table.insert( samples, heyGoodBuddyM);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.FARMER_WORKEND then
		if gender == 'M' then
			table.insert( samples, thatsABig104);
			table.insert( samples, thatsABig104V2M);
			table.insert( samples, thatsABig104V3M);
			table.insert( samples, appreciateTheComebackGoodBuddyM);
			table.insert( samples, hollarWhenHome20M);
		else
			table.insert( samples, thatsABig104);
			table.insert( samples, thatsABig104V2M);
			table.insert( samples, thatsABig104V3M);
			table.insert( samples, appreciateTheComebackGoodBuddyM);
			table.insert( samples, hollarWhenHome20M);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.COMBINECAPACITYLFULL then
		if passedHelper.name == 'A' then
			table.insert( samples, combineCapacityFull_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, combineCapacityFull_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, combineCapacityFullM);
		else
			table.insert( samples, combineCapacityFullF);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.COMBINECAPACITYLVL2 then
		if passedHelper.name == 'A' then
			table.insert( samples, combineCapacityLvl2_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, combineCapacityLvl2_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, combineCapacityLvl2M);
		else
			table.insert( samples, combineCapacityLvl2F);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.COMBINECAPACITYLVL1 then
		if passedHelper.name == 'A' then
			table.insert( samples, combineCapacityLvl1_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, combineCapacityLvl1_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, combineCapacityLvl1M);
		else
			table.insert( samples, combineCapacityLvl1F);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.CONTINUEWORK then
		if passedHelper.name == 'A' then
			table.insert( samples, continueWork_A);
			table.insert( samples, rightBackAtIt_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, continueWork_E);
			table.insert( samples, rightBackAtIt_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, continueWorkM );
		else
			table.insert( samples, continueWorkF );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.BLOCK then
		if passedHelper.name == 'A' then
			table.insert( samples, block_A);
			table.insert( samples, blockV2_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, block_E);
			table.insert( samples, blockV2_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, blockM );
		else
			table.insert( samples, blockF );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CASE then
		if passedHelper.name == 'A' then
			table.insert( samples, brandMessageCase_A);
			--table.insert( samples, brandMessageCaseV2_A);
			--table.insert( samples, brandMessageCaseV3_A);
			return samples;
		end
		if passedHelper.name == 'B' then
			table.insert( samples, brandMessageCase_B);
			table.insert( samples, brandMessageCaseV2_B);
			table.insert( samples, brandMessageCaseV3_B);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, brandMessageCase_E);
			--table.insert( samples, brandMessageCaseV2_E);
			--table.insert( samples, brandMessageCaseV3_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, brandMessageCaseM );
		else
			table.insert( samples, brandMessageCaseF );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.BRANDMESSAGE_CLAAS then
		--if passedHelper.name == 'A' then
		--	table.insert( samples, brandMessageCase_A);
		--	--table.insert( samples, brandMessageCaseV2_E);
		--	--table.insert( samples, brandMessageCaseV3_E);
		--	return samples;
		--end
		if passedHelper.name == 'B' then
			table.insert( samples, brandMessageClaas_B);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, brandMessageClaas_E);
			--	--table.insert( samples, brandMessageCaseV2_A);
			--	--table.insert( samples, brandMessageCaseV3_A);
			return samples;
		end

		if gender == 'M' then
			table.insert( samples, brandMessageClaasM);
		else
			table.insert( samples, brandMessageClaasF );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.BRANDMESSAGE_JOHN_DEERE then
		--if passedHelper.name == 'A' then
		--	table.insert( samples, brandMessageCase_A);
		--	--table.insert( samples, brandMessageCaseV2_A);
		--	--table.insert( samples, brandMessageCaseV3_A);
		--	return samples;
		--end
		--if passedHelper.name == 'B' then
		--	table.insert( samples, brandMessageCase_B);
		--	table.insert( samples, brandMessageCaseV2_B);
		--	table.insert( samples, brandMessageCaseV3_B);
		--	return samples;
		--end
		--if passedHelper.name == 'E' then
		--	table.insert( samples, brandMessageCase_E);
		--	--table.insert( samples, brandMessageCaseV2_E);
		--	--table.insert( samples, brandMessageCaseV3_E);
		--	return samples;
		--end
		if gender == 'M' then
			table.insert( samples, brandMessageJDM );
			table.insert( samples, brandMessageJDV2M );
			table.insert( samples, brandMessageJDV3M );
			table.insert( samples, brandMessageJDV4M );
			table.insert( samples, brandMessageJDV5M );
		else
			table.insert( samples, brandMessageJDF );
			table.insert( samples, brandMessageJDV2F );
			table.insert( samples, brandMessageJDV3F );
			table.insert( samples, brandMessageJDV4F );
			table.insert( samples, brandMessageJDV5F );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.THANKSHAULER then
		if passedHelper.name == 'A' then
			table.insert( samples, thanksHauler_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, thanksHauler_E);
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, thanksHaulerM );
		else
			table.insert( samples, thanksHaulerF );
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.RIDEALONG then
		if passedHelper.name == 'A' then
			table.insert( samples, goodToSeeYouBoss_A);
			table.insert( samples, iGotThisJobCovered_A );
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, goodToSeeYouBoss_E);
			table.insert( samples, iGotThisJobCovered_E );
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, rideAlong1M);
			table.insert( samples, rideAlong2M);
			table.insert( samples, rideAlong3M);
		else
			table.insert( samples, rideAlong1F);
			table.insert( samples, rideAlong2F);
			table.insert( samples, rideAlong3F);
		end

		return samples;
	elseif passedMessageType == CBRadioHelper.cbMessageTypes.GENERALWORKSTART then
		if passedHelper.name == 'A' then
			table.insert( samples, letsseewhatwecangetdone_A);
			table.insert( samples, iwillgetitdone_A);
			table.insert( samples, imonit_A);
			table.insert( samples, allFiredUpReadyToRoll_A);
			return samples;
		end
		if passedHelper.name == 'E' then
			table.insert( samples, generalWorkStart1_E );
			table.insert( samples, generalWorkStart2_E );
			table.insert( samples, generalWorkStart3_E );
			table.insert( samples, generalWorkStart4_E );
			return samples;
		end
		if gender == 'M' then
			table.insert( samples, generalWorkStart1M );
			table.insert( samples, generalWorkStart2M );
			table.insert( samples, generalWorkStart3M );
		else
			table.insert( samples, generalWorkStart1F );
			table.insert( samples, generalWorkStart2F );
			table.insert( samples, generalWorkStart3F );
		end

		return samples;
	else
		if gender == 'M' then
			table.insert( samples, generalWorkStart1M );
			table.insert( samples, generalWorkStart2M );
			table.insert( samples, generalWorkStart3M );
		else
			table.insert( samples, generalWorkStart1F );
			table.insert( samples, generalWorkStart2F );
			table.insert( samples, generalWorkStart3F );
		end

		return samples;
	end
end

---@generic
---@param CBRadioHelper.cbMessageTypes
function CBRadioHelper:micCB(passedMessageType, passedHelper)

	if passedHelper == nil then
		print("CBRadioHelper micCB initiated with NIL passedHelper param. exiting.......")
		return;
	end

	if passedMessageType == nil then
		print("CBRadioHelper micCB initiated with NIL passedMessageType param. exiting.......")
		return;
	end

	--for k,v in pairs(passedHelper) do
	--	print(k..":".. tostring(v) )
	--end

	print("CBRadioHelper micCB initiated with ".. string.upper(passedMessageType) .." by ".. _G['CBRadioHelper']['cbHelperNames'][passedHelper.name] .." ===========================================================================================")
	local samples = {};
	local targetSample = nil;
	local sampleToPlay = {} ;

	samples = CBRadioHelper:buildSampleOptionsForHelper(passedHelper, string.upper(passedMessageType) )

	local count = 0;
	for i = 1, #samples do
		count = count + 1;
	end
	targetSample = math.random(1, count);
	sampleToPlay = samples[targetSample];

	--print("CBRadioHelper micCB sampleToPlay: ".. tostring(sampleToPlay) );

	playSample( sampleToPlay , 1, 2, 0, 0, CBRadioHelper.lastCbSamplePlayed); --

	CBRadioHelper.lastCbSamplePlayed = sampleToPlay -- @TODO keeping this for now, but needs per-helper instance control

	if _G['CBRadioHelper']['cbHelperNames'][passedHelper.name] ~= "gordo" then
		--CBRadioHelper:sendGUIGameNotification(_G['CBRadioHelper']['cbHelperNames'][passedHelper.name] .. " keyed the CB...")
	end
		if passedMessageType == CBRadioHelper.cbMessageTypes.GENERALWORKSTART then
			CBRadioHelper:sendGUIGameNotification("looking for help...")
		end
	return
end

function CBRadioHelper:sendGUIGameNotification(passedMessage)
	--print("CBRadioHelper:sendGUIGameNotification called");

	if passedMessage == nil then
		print("CBRadioHelper:sendGUIGameNotification passedMessage was nil");
		return;
	end

	g_currentMission:addIngameNotification(FSBaseMission.INGAME_NOTIFICATION_OK, passedMessage );
end

function CBRadioHelper:onStopThreshing(vehicle)
	--print("CBRadioHelper onStopThreshing initiated on ".. self.spec_CBRadioHelper:getName() );
end


function CBRadioHelper:onPreLoad(savegame)
	--print("onPreLoad loaded...");
end


function CBRadioHelper:onLoad(savegame)
	--print("CBRadioHelper onLoad loaded ===========================================================================================");
	local spec = self.spec_CBRadioHelper -- This is created when its added to vehicleType, its using the "name" so spec_"name" if that make sense
end


function CBRadioHelper:getFillLevel(vehicle)
	local fillCap = vehicle:getFillUnitCapacity(vehicle.spec_combine.fillUnitIndex);
	local fillLvl = vehicle:getFillUnitFillLevel(vehicle.spec_combine.fillUnitIndex);
	if fillCap > 9999999 then fillCap = 0; end;
	local attachedImplements = vehicle:getAttachedImplements();
	if attachedImplements ~= nil then
		for _, attachable in pairs(attachedImplements) do
			if attachable.object ~= nil then
				if attachable.object.spec_dischargeable ~= nil then
					local dischargeNode = attachable.object.spec_dischargeable.currentDischargeNode;
					fillCap = fillCap + attachable.object:getFillUnitCapacity(dischargeNode.fillUnitIndex);
					fillLvl = fillLvl + attachable.object:getFillUnitFillLevel(dischargeNode.fillUnitIndex);
				end;
			end;
		end;
	end;
	if fillCap <= 0 then return nil; end;
	return math.floor((fillLvl/fillCap)*100);
end;


function CBRadioHelper:restartMySavegame()
	if g_server then
		restartApplication(true, " -autoStartSavegameId 1"); -- FS22 restart application
		-- OLD FS19 command: restartApplication(" -autoStartSavegameId 6"); -- 6 is the savegame number used by me to test my mods, you can change the number to your savegame nr.
	end
end

--@todo work with this to give the draw data a nice background
--https://gdn.giants-software.com/documentation_scripting_fs19.php?version=script&category=15&class=151
function CBRadioHelper:renderBackground()
	--overlayId = Overlay:new("overlay", "sample/overlay/overlay.png");
	--overlayId = Overlay:new("overlay", "sample/overlay/overlay.png");
	--local myImage = createImageOverlay( CBRadioHelper.modDir .. "scripts/overlay.dds");
	--setOverlayColor(myImage, 0, 1, 0, 1)
	--renderOverlay(myImage, 1, 1, 1500, 1500);

	local myImage = createImageOverlay( "dataS/menu/blank.png");
	local xS = string.len( CBRadioHelper.textForRender );
	--local myImage = createImageOverlay( CBRadioHelper.modDir .. "scripts/overlay.png");

	--print("xS: ".. xS);
	--print("passedxS: ".. passedxS)
	setOverlayColor(myImage, 0, 0, 0, 70)
	-- renderOverlay(overlay, posX, posY, sizeX, sizeY, state)

	local sizeY = CBRadioHelper.overlayData['sizeY'];
	local sizeX = CBRadioHelper.overlayData['sizeX'];
	local posY = CBRadioHelper.overlayData['posY'];

	--print("CBRadioHelper.activeCombineHelpers: ".. CBRadioHelper.activeCombineHelpers);

	--posX = .05,
	--posY = .95,
	--sizeX = .35,
	--sizeY = .03

	--print("CBRadioHelper.activeCombineHelpers: ".. CBRadioHelper.activeCombineHelpers )

	if CBRadioHelper.activeCombineHelpers < 1 then
		sizeX = 0;
		sizeY = 0;
	else
		sizeX = ( (CBRadioHelper.lastBuildPassLength * .010) / 5 ) ;
		sizeY = CBRadioHelper.overlayData['sizeY'];
	end

	--if CBRadioHelper.activeCombineHelpers >= 1 then sizeX = .35 end

	for i = CBRadioHelper.activeCombineHelpers, 1, - 1 do
		sizeY = sizeY + .009;
		posY = posY - .009;
	end


	--print("sizeX: ".. sizeX);

	local lastPass = 0;
	for _,pass in pairs(CBRadioHelper.tableTextToRender) do
		if lastPass < pass then
			sizeX = pass;
			lastPass = pass;
		end
	end

	sizeX = (sizeX * .003) - .035;

	--print("renderOverlay: ".. tostring(.05)..", ".. posY ..", ".. CBRadioHelper.overlayData['sizeX'] ..",".. sizeY );
	renderOverlay(myImage, CBRadioHelper.overlayData['posX'], posY, sizeX, sizeY );
end


function CBRadioHelper:unload()
	removeModEventListener(CBRadioHelper)
	g_messageCenter:unsubscribeAll(self)

	if CBRadioHelper ~= nil then
		CBRadioHelper= nil -- Allows garbage collecting
	end
end

