--/////////////////////////////////////////////////////////////////////////////////////////////////
--  (c) Galyana's Ultimate Empire at War Modifications
--  
--     ******    ***        *** ************           ***         ***
--    *      *    *          *   *         *            *           *
--   *        *   *          *   *                      *           *
--  *         *   *          *   *                      *           *
--  *             *          *   *    *         **** *  *           *
--  *             *          *   ******        *    *   *           *
--  *      ****   *          *   *    *       *     *   *    ***    *
--  *         *   *          *   *           *      *   *     *     *
--   *        *    *        *    *           *      *    *    *    *
--    *      *      *      *     *         *  *    **     *   *   *
--     ******        ******     ************   **** **     *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L   S O U R C E   C O D E -- D O   N O T   D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
--            File: GUEaW/Data/Scripts/AI/UpgradeGroundbasePlan.LUA
--
-- Original Editor: Giovanni Galyana
--
--   Final Edit By: Giovanni Galyana
--
--            Date: 10 May, 2014
--
--       Revisions: 1
--
--/////////////////////////////////////////////////////////////////////////////////////////////////

require("pgevents")


function Definitions()
	DebugMessage("%s -- In Definitions", tostring(Script))

	-- Now doing groundbase upgrades via base component construction plans
	Category = "AlwaysOff"
	--Category = "Upgrade_Groundbase | Build_Initial_Groundbase_Only"
	IgnoreTarget = true
	TaskForce = {
	{
		"BaseForce",
		"E_Ground_Barracks | R_Ground_Barracks | H_Ground_Barracks | E_Ground_Light_Vehicle_Factory | R_Ground_Light_Vehicle_Factory | H_Ground_Factory | E_Ground_Research_Facility | H_Ground_Advanced_Technologies_Facility | E_Ground_Communications_Array | R_Ground_Communications_Array | H_Ground_Communications_Array | E_Ground_Heavy_Vehicle_Factory | R_Ground_Heavy_Vehicle_Factory | E_Ground_Officer_Academy | R_Ground_Officer_Academy | E_Ground_Advanced_Vehicle_Factory | E_Ground_Power_Generator | R_Ground_Power_Generator | H_Ground_Power_Generator | H_Ground_Command_Center = 1"
	}
	}

	DebugMessage("%s -- Done Definitions", tostring(Script))
end

function BaseForce_Thread()
	DebugMessage("%s -- In BaseForce_Thread.", tostring(Script))
	
	Sleep(1)
	
--	BaseForce.Set_As_Goal_System_Removable(false)
	AssembleForce(BaseForce)
	
	BaseForce.Set_Plan_Result(true)
	DebugMessage("%s -- BaseForce done!", tostring(Script));
	ScriptExit()
end

function BaseForce_Production_Failed(tf, failed_object_type)
	DebugMessage("%s -- Abandonning plan owing to production failure.", tostring(Script))
	ScriptExit()
end