-- Soldier with Metis

GT_t.LN_t.Saxhorn = {}
GT_t.LN_t.Saxhorn.type = 33
GT_t.LN_t.Saxhorn.beamWidth = math.rad(1);
GT_t.LN_t.Saxhorn.distanceMin = 80
GT_t.LN_t.Saxhorn.distanceMax = 2500
GT_t.LN_t.Saxhorn.max_trg_alt = 2000
GT_t.LN_t.Saxhorn.reactionTime = 10
GT_t.LN_t.Saxhorn.launch_delay = 3
GT_t.LN_t.Saxhorn.radialDisperse = 1.0;
GT_t.LN_t.Saxhorn.dispertionReductionFactor = 0.995;
GT_t.LN_t.Saxhorn.missileControlInterval = 0.16;
GT_t.LN_t.Saxhorn.maxShootingSpeed = 0
GT_t.LN_t.Saxhorn.show_external_missile = false
GT_t.LN_t.Saxhorn.sensor = {}
set_recursive_metatable(GT_t.LN_t.Saxhorn.sensor, GT_t.WSN_t[0])
GT_t.LN_t.Saxhorn.PL = {}
GT_t.LN_t.Saxhorn.PL[1] = {}
GT_t.LN_t.Saxhorn.PL[1].automaticLoader = false;
GT_t.LN_t.Saxhorn.PL[1].shot_delay = 10;
GT_t.LN_t.Saxhorn.PL[1].ammo_capacity = 4;
GT_t.LN_t.Saxhorn.PL[1].reload_time = 4*20;
GT_t.LN_t.Saxhorn.PL[1].type_ammunition={4,4,11,128}
GT_t.LN_t.Saxhorn.PL[1].name_ammunition="9M113"
GT_t.LN_t.Saxhorn.inclination_correction_upper_limit = math.rad(45);
GT_t.LN_t.Saxhorn.inclination_correction_bias = math.rad(0.4);
GT_t.LN_t.Saxhorn.BR = { {pos = {1.5,0,0}, drawArgument = 4 } }

GT_t.CH_t.ATSOLDIER = {
	life = 1.5,
	mass = 150,
	length = 2,
	width = 2,
	max_road_velocity = 2,
	max_slope = 0.87,
	engine_power = 0.5,
	fordingDepth = 1.0,
	max_vert_obstacle = 1,
	max_acceleration = 3.0,
	min_turn_radius = 0.1,
	X_gear_1 = 1,
	Y_gear_1 = 0,
	Z_gear_1 = 1,
	X_gear_2 = -1,
	Y_gear_2 = 0,
	Z_gear_2 = 1,
	gear_type = GT_t.GEAR_TYPES.HUMAN,
	r_max = 0.53,
	armour_thickness = 0,
	human_figure = true,
}

GT = {};

GT_t.ws = 0;
set_recursive_metatable(GT, GT_t.generic_human);
set_recursive_metatable(GT.chassis, GT_t.CH_t.ATSOLDIER);

GT.visual.shape = "soldier_9k115";
GT.visual.shape_dstr = "soldier_9k115_dead";

GT.mobile = true;
GT.humanPlayable = true;

GT.sensor = {};
set_recursive_metatable(GT.sensor, GT_t.SN_visual);
GT.sensor.height = 1.8;
GT.sensor.max_range_finding_target = 3000;

GT.WS = {};
GT.WS.maxTargetDetectionRange = 3000;
GT.WS.fire_on_march = false;

local ws = GT_t.inc_ws();
GT.WS[ws] = {};
GT.WS[ws].new_rotation = false;
GT.WS[ws].laser = true;
GT.WS[ws].pos = {0,1,0};
GT.WS[ws].angles = {
					{math.rad(180), math.rad(-180), math.rad(-10), math.rad(30)},
					};
GT.WS[ws].drawArgument1 = 0;
GT.WS[ws].drawArgument2 = 1;
GT.WS[ws].new_rotation = false;
GT.WS[ws].omegaY = math.rad(100);
GT.WS[ws].omegaZ = math.rad(100);
GT.WS[ws].pidY = {p=100,i=1.5,d=9,inn=10};
GT.WS[ws].pidZ = {p=100,i=1.5,d=9,inn=10,};
GT.WS[ws].pointer = 'POINT_SIGHT_1';

__LN = add_launcher(GT.WS[ws], GT_t.LN_t.Saxhorn)
--__LN.BR = { {connector_name = 'POINT_ROCKET', drawArgument = 4}, }
__LN.customViewPoint = { "genericMissileAT", {0.0, 0.0, 0.0}, };
__LN.sightMasterMode = 1;
__LN.sightIndicationMode = 1;


GT.Name = "Infantry AT-7 Soldier";
GT.DisplayName = _("Infantry AT-7 'Saxhorn' Soldier");
GT.Rate = 5;

GT.Sensors = { OPTIC = {"TKN-3B day", "TKN-3B night", -- командирский
						--"1PN22M1 day", "1PN22M1 night" -- наводчика,
						},
			};

GT.DetectionRange = 0;
GT.ThreatRange = GT.WS[1].LN[1].distanceMax;
GT.mapclasskey = "P0091000201";
GT.attribute = {wsType_Ground,wsType_Tank,wsType_Gun,wsType_GenericInfantry,
				"Infantry",
				"ATGM",
				"Datalink"
				};
GT.category = "Infantry";
GT.Countries = { "Russia","BELARUS","Ukraine","Hungary","Iran","Syria","POLAND","Aggressors"};
GT.Transportable = {
	size = 150
}

add_surface_unit(GT)