dofile("Scripts/utils.lua");

spawn_timeout = 88;

spawn_time = 0;
spawn_interval = 440;

function Initialize()
	AIparts = utils.CreateSubsystems();
	AIparts:AddPeriodic("Spawn", spawn_timeout, Spawn);
end

function Main()
	AIparts:Run();
end

function Spawn()
	local ctime = GetGameEpoch();
--	ScreenLog("AIRCRAFT SPAWN, time= " .. ctime);
	if ctime > (spawn_time + spawn_interval) then
--		ScreenLog("AIRCRAFT SPAWNED!!!");
		local a1 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", -960, 64, 0);
		local a2 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", -1024, 64, 16);
		local a3 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", -930, 64, 100);
		local b1 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", 0, 64, 950);
		local b2 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", 20, 64, 990);
		local b3 = CreateObject("Units/Air/Planes/Interseptors/German/Messerschmitt_Bf_109G.dsc", -64, 64, 920);
--		AssignPlayer(a1, "German");
--		AssignPlayer(a1, "German");
		spawn_time = ctime;
	end
end
