dofile("Scripts/utils.lua");
dofile("Scripts/Init/units.lua");

function Main()
	AIparts:Run();
end

function InitArmor()
	local data = object.desc.LuaData;
	if data then
		armor_turret = data.TurretArmor or DEFAULT_ARMOR;
		armor_front = data.CorpusArmorFront or DEFAULT_ARMOR;
		armor_back = data.CorpusArmorRear or DEFAULT_ARMOR;
		armor_left = data.CorpusArmorSide or DEFAULT_ARMOR;
		armor_right = data.CorpusArmorSide or DEFAULT_ARMOR;
	else
		log("Error: there is no LuaData for (" .. object.desc.DescFileName .. ")");
	end
end

function Initialize()
	BasicInit();
	InitArmor();
	locator_body = object.GetLocatorId("locator_body");
	locator_turret = object.GetLocatorId("locator_turret");

	front_dz = object.GetDamageZoneId("damagezone_front");	object.ActivateDamageZone(true, front_dz);
	left_dz = object.GetDamageZoneId("damagezone_left");	object.ActivateDamageZone(true, left_dz);
	right_dz = object.GetDamageZoneId("damagezone_right");	object.ActivateDamageZone(true, right_dz);
	back_dz = object.GetDamageZoneId("damagezone_back");	object.ActivateDamageZone(true, back_dz);

	body = object.GetFrameGroupId("body");
	body_damaged = object.GetFrameGroupId("body_destroyed");
	if body_damaged < 0 then body_damaged = nil end;

	track_left = object.GetFrameGroupId("track_left");
	track_right = object.GetFrameGroupId("track_right");
end
