
-- Sets up tech tree locking / unlocking for each mission in the SP campaign
function TechTreeSetup()
	print("Setting up tech tree!")

	-- GLOBAL: unlock abiliies and upgrades that we want in every mission
	local abilities = {ABILITY.ALLIED_THROWGRENADE, ABILITY.ALLIED_STICKY_BOMB}
	local upgrade = {UPG.ALLIED_GRENADES, UPG.ALLIED_STICKY_BOMB}
	local upgrade_to_give = {UPG.ALLIED_WIRE_CUTTERS, UPG.ALLIED_DEMOLITION, UPG.ALLIED_SP_AIRBORNE_BASIC_DEFENSES}
	for i = 1, table.getn(abilities) do 
		Player_SetAbilityAvailability(player1, abilities[i], ITEM_UNLOCKED)
	end
	for i = 1, table.getn(upgrade) do 
		Player_SetUpgradeAvailability(player1, upgrade[i], ITEM_REMOVED)
	end
	for i = 1, table.getn(upgrade_to_give) do 
		Cmd_InstantPlayerUpgrade(player1, upgrade_to_give[i])
	end
--	Player_SetAbilityAvailability(player2, ABILITY.AXIS_THROWGRENADE, ITEM_UNLOCKED)
	
	-- GLOBAL: Modify CC tree costs
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_01, 0, 0, 0, 0, 3)					-- RANGERS cost 3
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_12, 0, 0, 0, 0, 5)					-- BOMBING RUN costs 5
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.ARMOR_01, 0, 0, 0, 0, 4)						-- CALLIOPE costs 4
	
	g_defaultActionRateModifier = 0.3
	

	-- M01 D-Day -----------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission01" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
		UI_EnableResourceTypeKicker(RT_Action, false)														-- turn off action point kickers because CC menu is disabled
		Modify_PlayerResourceRate(player1, RT_Action, 0)

		-- lock / unlock  commands
		Player_SetConstructionMenuAvailability(player1, "tp_construction_engineer_basic", ITEM_LOCKED)
		Player_SetConstructionMenuAvailability(player1, "tp_construction_rifleman_basic", ITEM_LOCKED)
		Player_SetConstructionMenuAvailability(player1, "tp_construction_allied_hq", ITEM_LOCKED)
		Player_SetCommandAvailability(player1, SCMD_Retreat, ITEM_REMOVED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_MINESWEEPER, ITEM_LOCKED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_FLAMETHROWER, ITEM_LOCKED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_WIRE_CUTTERS, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_CUT_WIRES, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_STICKY_BOMB, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWGRENADE, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_BAR_SUPPRESSION, ITEM_REMOVED)
		
		Player_SetAbilityAvailability(player1, ABILITY.REPAIR, ITEM_REMOVED)
		Player_SetCommandAvailability(player1, SCMD_PlaceCharge, ITEM_REMOVED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_AID_STATION, ITEM_UNLOCKED)
			
		-- turn off satchel charge and grenades for player (until they're told to use it vs. the bunker)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWSATCHEL_NOREQS, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_GRENADES_NOREQS, ITEM_REMOVED)

	end

	-- M02 Paradrop ---------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission02" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
		UI_EnableResourceTypeKicker(RT_Action, false)														-- turn off action point kickers because CC menu is disabled
		Modify_PlayerResourceRate(player1, RT_Action, 0)
		Modify_PlayerResourceRate(player1, RT_Manpower, 1.6)
		Modify_PlayerResourceRate(player1, RT_Munition, 1.3)
		
	end

	-- M03 Carentan ---------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission03" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
		UI_EnableResourceTypeKicker(RT_Action, false)														-- turn off action point kickers because CC menu is disabled
		m03_ActionRateModID = Modify_PlayerResourceRate(player1, RT_Action, 0)
		--UI_BindingSetEnabled("squadcap", false)

		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWSATCHELCHARGE, ITEM_UNLOCKED)

		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_TANKTRAP_RIFLEMEN, ITEM_REMOVED)
		--Modify_PlayerProductionRate(player1, 4.5)
		
		Player_SetConstructionMenuAvailability(player1, "tp_construction_allied_hq", ITEM_LOCKED)
		Cmd_InstantPlayerUpgrade(player1, UPG.ALLIED_DEFENSIVE_OP)
		
		Player_SetUpgradeAvailability( player1, UPG.CONVERT_AMBIENT_BUILDING, ITEM_LOCKED )
		Player_SetUpgradeAvailability( player1, UPG.CONVERT_AMBIENT_BUILDING_SP_CHURCH, ITEM_LOCKED )
		--HintPoint_AddToProductionButton(PITEM_SquadUpgrade, ABILITY.ALLIED_THROWSATCHELCHARGE, 409272, true)
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_ENGINEER, ITEM_LOCKED)					-- Lock out Engineers
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_57MM_AT, ITEM_LOCKED)						-- Lock out AT Guns
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_HOWITZER, ITEM_REMOVED)					-- Lock out Howitzer

		
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_SUPPRESSION_KIT, ITEM_REMOVED )
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_PARATROOPER_ATKIT, ITEM_REMOVED )
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_AID_STATION, ITEM_REMOVED )
		
--		Modify_Upkeep(player1, 0.25)																		-- Reduce upkeep penalty for this mission
	end

	-- M04 Carentan Counterattack --------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission04" then
		if m03_ActionRateModID ~= nil then
			Modifier_Remove(m03_ActionRateModID)
		end
		UI_BindingSetEnabled( "company_commander", true )
		UI_EnableResourceTypeKicker(RT_Action, true)
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY)
		g_commandPointLimit = 3
		Rule_AddInterval(Rule_CapCommandPoints, 1)
--~ 		Player_SetUpgradeAvailability(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_01, ITEM_LOCKED)
--~ 		Player_SetUpgradeAvailability(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_02, ITEM_LOCKED)
		
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_MEDICSTATION, ITEM_REMOVED)
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_TRIAGE, ITEM_REMOVED)
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_TANKTRAP, ITEM_REMOVED)
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_TANKTRAP_RIFLEMEN, ITEM_REMOVED)
		Player_SetCommandAvailability(player1, SCMD_PlaceCharge, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_CUT_WIRES, ITEM_UNLOCKED)
		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_STICKY_BOMB, ITEM_UNLOCKED )
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_SUPPRESSION_KIT, ITEM_UNLOCKED )
		
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_SHERMAN_SMOKE, ITEM_REMOVED)
		
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_MINESWEEPER, ITEM_LOCKED)
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_FLAMETHROWER, ITEM_UNLOCKED)
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_PARATROOPER_ATKIT, ITEM_UNLOCKED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWGRENADE, ITEM_UNLOCKED)
		Player_SetAbilityAvailability(player1,	ABILITY.ALLIED_THROWSATCHELCHARGE, ITEM_UNLOCKED)
		--Player_SetAbilityAvailability(player1,	ABILITY.ALLIED_DEMOLITION, ITEM_LOCKED)
		Player_SetUpgradeAvailability(player2, UPG.AXIS_MINESWEEPER, ITEM_UNLOCKED)
		UPGRADE_BARRACKS2			= Util_GetUpgradeID("upgrade/convert_ambient_building.lua")
		UPGRADE_BARRACKS			= Util_GetUpgradeID("upgrade/convert_ambient_building_sp_church.lua")
		Player_SetUpgradeAvailability(player1, UPGRADE_BARRACKS2, ITEM_REMOVED)
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_57MM_AT, ITEM_UNLOCKED)

		Player_SetUpgradeAvailability( player1, UPGRADE_BARRACKS, ITEM_LOCKED )
		Player_SetUpgradeAvailability( player1, UPG.ALLIED_CRAB, ITEM_REMOVED)
		
		Cmd_InstantPlayerUpgrade(player1, UPG.ALLIED_DEFENSIVE_OP)

	end


	-- M05 Redball Express ----------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission05" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.ARMOR)
		g_commandPointLimit = 5
		Modify_PlayerResourceRate(player1, RT_Action, 0.5)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		UPGRADE_SHERMAN_CROCODILE 	= Util_GetUpgradeID("upgrade/allies/items/allies_sherman_crocodile.lua")
		UPGRADE_SHERMAN_CALLIOPE	= Util_GetUpgradeID("upgrade/allies/items/allies_sherman_calliope.lua")
		UPGRADE_SHERMAN_BULLDOZER 	= Util_GetUpgradeID("upgrade/allies/items/allies_sherman_bulldozer.lua")
		ABILITY_FIRECALLIOPE		= Util_GetAbilityID("abilities/ally_fire_calliope.lua")
	
		Player_SetUpgradeAvailability(player1, UPGRADE_SHERMAN_CROCODILE, ITEM_REMOVED)
		Player_SetUpgradeAvailability(player1, UPGRADE_SHERMAN_CALLIOPE, ITEM_REMOVED)
		Player_SetUpgradeAvailability(player1, UPGRADE_SHERMAN_BULLDOZER, ITEM_REMOVED)
		Player_SetAbilityAvailability(player1, ABILITY_FIRECALLIOPE, ITEM_REMOVED)
		
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_CROCODILE, ITEM_LOCKED)					-- Lock out Crocodile
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_TANKDEST, ITEM_LOCKED)					-- Lock out M10 Tank Destroyer

		
	end
	
	-- M06 Cherbourg -----------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission06" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY)
		g_commandPointLimit = 5
		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		Rule_AddInterval(Rule_CapCommandPoints, 1)

		Player_SetUpgradeAvailability(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_11, ITEM_REMOVED)			-- Lock out OMA (until player destroys naval guns)
		Player_SetUpgradeAvailability(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_12, ITEM_REMOVED)			-- Lock out Howitzer
		
--		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_CROCODILE, ITEM_LOCKED)					-- Lock out Crocodile
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_TANKDEST, ITEM_LOCKED)					-- Lock out M10 Tank Destroyer
		
	end
	
	-- M07 V2 Rocket ------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission07" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE)
		g_commandPointLimit = 7
		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		Cmd_InstantPlayerUpgrade(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_00)							-- Pre-purchase paratroopers for player

		--[[ UN/RESTRICT ABILITIES ]]
		Player_SetConstructionMenuAvailability(player1, "tp_construction_allied_hq", ITEM_LOCKED)
		Player_SetCommandAvailability(player1, SCMD_PlaceCharge, ITEM_UNLOCKED)
	
		-- custom paradrop ability for M07
		Player_SetAbilityAvailability(player1, ABILITY.SP_M07_PARADROP, ITEM_UNLOCKED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWGRENADE, ITEM_UNLOCKED)
		Player_SetAbilityAvailability(player1, ABILITY.ALLIED_THROWSATCHELCHARGE, ITEM_UNLOCKED)
		
		-- [[ UN/RESTRICT UPGRADES ]]
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_ATKIT, ITEM_UNLOCKED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_PARATROOPER_ATKIT, ITEM_UNLOCKED)
		Player_SetUpgradeAvailability(player1, UPG.ALLIED_SATCHEL_CHARGE, ITEM_UNLOCKED)
		Player_SetUpgradeAvailability( player1, UPG.CONVERT_AMBIENT_BUILDING, ITEM_REMOVED )
	
		-- allow Airborne squads to build defenses
		Cmd_InstantPlayerUpgrade(player1, UPG.ALLIED_DEFENSIVE_OP)
		
		-- gives easy access to all Axis upgrades
		Cmd_InstantPlayerUpgrade(player2, UPG.AXIS_PHASE2)
		Cmd_InstantPlayerUpgrade(player2, UPG.AXIS_PHASE3)
		Cmd_InstantPlayerUpgrade(player2, UPG.AXIS_PHASE4)
		
--		Cmd_InstantPlayerUpgrade(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_00)
	end
	
	-- M08 Crossing the Vire ----------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission08" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE)
		g_commandPointLimit = 9
		Modify_PlayerResourceRate(player1, RT_Action, 0.8)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
--		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_CROCODILE, ITEM_LOCKED)					-- Lock out Crocodile
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_TANKDEST, ITEM_LOCKED)					-- Lock out M10 Tank Destroyer
		
	end

	-- M09 Hill 192 --------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission09" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY)
		g_commandPointLimit = 9
		Modify_PlayerResourceRate(player1, RT_Action, 0.8)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_TANKDEST, ITEM_LOCKED)					-- Lock out M10 Tank Destroyer
		
	end
	
	-- M10 St. Lo -----------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission10" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY)
		g_commandPointLimit = 9
		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		Player_SetSquadProductionAvailability(player1, SBP.ALLIED_TANKDEST, ITEM_LOCKED)					-- Lock out M10 Tank Destroyer
		
	end

	-- M12 Death of a Division -----------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission12" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.ARMOR)
		g_commandPointLimit = 12
		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
--		Player_SetAbilityAvailability(player1, ABILITY.SP_AIRSTRIKE_ROCKETS, ITEM_UNLOCKED)
		
	end

	-- M13 Mortain ------------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission13" then
		UI_ForceCommanderTreeChoice(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY)
		g_commandPointLimit = 13
		m13_ActionRateModID = Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		--Player cannot build a Motor Pool or a Tank Depot.
--		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_BAR_SUPPRESSION, ITEM_UNLOCKED )
		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_THROWGRENADE	, ITEM_UNLOCKED )
		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_STICKY_BOMB, ITEM_UNLOCKED )
--		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_MOTORPOOL, ITEM_REMOVED)
		Player_SetEntityProductionAvailability(player1, EBP.ALLIED_MOTORPOOL2, ITEM_REMOVED)
--		Player_SetUpgradeAvailability( player1, UPG.ALLIED_BAR, ITEM_REMOVED )
--		Player_SetUpgradeAvailability( player1, UPG.ALLIED_GRENADES , ITEM_REMOVED )
--		Player_SetUpgradeAvailability( player1, UPG.ALLIED_STICKY_BOMB, ITEM_REMOVED )
		Player_SetUpgradeAvailability( player2, UPG.AXIS_MORTAR_SMOKE, ITEM_UNLOCKED )
	end
	
	-- M14 Mortain Counterattack -----------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission14" then
--		g_commandPointLimit = 12
		if m13_ActionRateModID ~= nil then
			Modifier_Remove(m13_ActionRateModID)
		end
--		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
--		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
		--free upgrades	
--~ 		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_BAR_SUPPRESSION, ITEM_UNLOCKED )
		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_THROWGRENADE	, ITEM_UNLOCKED )
		Player_SetAbilityAvailability( player1, ABILITY.ALLIED_STICKY_BOMB, ITEM_UNLOCKED )
--~ 		Player_SetUpgradeAvailability( player1, UPG.ALLIED_BAR, ITEM_REMOVED )
--~ 		Player_SetUpgradeAvailability( player1, UPG.ALLIED_GRENADES , ITEM_REMOVED )
--~ 		Player_SetUpgradeAvailability( player1, UPG.ALLIED_STICKY_BOMB, ITEM_REMOVED )
	end
	
	-- M15 Cornered Tiger -------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission15" then
--		g_commandPointLimit = 12
--		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
--		Rule_AddInterval(Rule_CapCommandPoints, 1)
		
--~ 		Player_SetAbilityAvailability(player1, ABILITY.SP_AIRSTRIKE_ROCKETS, ITEM_UNLOCKED)
--~ 		Player_SetAbilityAvailability(player1, ABILITY.SP_AIR_RECON, ITEM_UNLOCKED)
	end
	
	-- M16 Chambois --------------------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission16" then
--		g_commandPointLimit = 12
--		Rule_AddInterval(Rule_CapCommandPoints, 1)
--		Modify_PlayerResourceRate(player1, RT_Action, g_defaultActionRateModifier)
		
--		Player_SetAbilityAvailability (player1, ABILITY.ALLIED_STRAFE_RUN2, ITEM_UNLOCKED )
--		Player_SetAbilityAvailability(player1, ABILITY.SP_AIRSTRIKE_ROCKETS, ITEM_UNLOCKED)
		Cmd_InstantPlayerUpgrade(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_11)						-- grant strafing run
		Cmd_InstantPlayerUpgrade(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_12)						-- grant rocket strike
		
		
	end
	
end

function TechTreeRestore()

	-- GLOBAL: Modify CC tree costs
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.INFANTRY_01, 0, 0, 0, 0, 3)					-- RANGERS cost 3
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.AIRBORNE_12, 0, 0, 0, 0, 5)					-- BOMBING RUN costs 5
	Player_SetUpgradeCost(player1, UPG.COMMANDER_TREE.ALLIES.ARMOR_01, 0, 0, 0, 0, 4)						-- CALLIOPE costs 4

	-- M01 D-Day -----------------------------------------------------------------------------------------------------------------
	if g_MissionSpeechPath == "Mission01" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
	-- M02 Paradrop ---------------------------------------------------------------------------------------------------------------
	elseif g_MissionSpeechPath == "Mission02" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
	-- M03 Carentan ---------------------------------------------------------------------------------------------------------------
	elseif g_MissionSpeechPath == "Mission03" then
		Rule_AddOneShot(Rule_DisableCCMenu, 1)
	end

end

-- Disables the Company Commander menu.  Note that this must be done 1 second after the OnInit.
function Rule_DisableCCMenu()
	UI_BindingSetEnabled( "company_commander", false )													-- CC menu disabled
end


-- Caps the player's action points at a certain amount so they can't earn more than x command points
function Rule_CapCommandPoints()
	local totalResGathered = Stats_ResGathered(player1)
--	print(g_totalResGathered.command)
--	print("checking command points..")
	if totalResGathered.command == g_commandPointLimit then
		Util_MissionTitle(39256)													-- "Maximum Command Points Earned"
		Modify_PlayerResourceRate(player1, RT_Action, 0.0)							-- FINALLY WORKS!
		UI_EnableResourceTypeKicker(RT_Action, false)								-- turn off action point kickers now that player isn't earning any more Command Points
		Rule_RemoveMe()
	end
end
