From 594a53bb8e11cd7806334514bc4a6424eda71d86 Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Sun, 10 Jun 2018 17:06:09 +0200 Subject: [PATCH 1/4] Add artillery precision option --- .../addons/language_f/stringtable.xml | 6 ++++++ .../fn_FireSupportArtilleryFireMission.sqf | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/@AresModAchillesExpansion/addons/language_f/stringtable.xml b/@AresModAchillesExpansion/addons/language_f/stringtable.xml index 6ed25d00..91704fc4 100644 --- a/@AresModAchillesExpansion/addons/language_f/stringtable.xml +++ b/@AresModAchillesExpansion/addons/language_f/stringtable.xml @@ -2293,6 +2293,12 @@ 距離 距离 + + Precision [m] + Precision [m] + Précision [m] + Ungenauigkeit [m] + Range [m] Range [m] diff --git a/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf b/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf index 11d32983..41ad88e7 100644 --- a/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf @@ -7,7 +7,7 @@ #include "\achilles\modules_f_ares\module_header.hpp" -private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName"]; +private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName", "_precision"]; _objects = nearestObjects [(_this select 0), ["All"], 150, true]; @@ -93,7 +93,8 @@ if (_mode == 0) then [localize "STR_AMAE_NUMBER_OF_UNITS_INVOLVED", _numberOfGuns], [localize "STR_AMAE_ROUNDS", "", "1"], [localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName], - [format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1] + [format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1], + [localize "STR_AMAE_PRECISION", "", "0"] ]] call Ares_fnc_ShowChooseDialog; if (_pickFireMissionResult isEqualTo []) exitWith {}; @@ -102,6 +103,7 @@ if (_mode == 0) then _rounds = parseNumber (_pickFireMissionResult select 1); _ammo = (_artilleryAmmo select (_pickFireMissionResult select 2)); _ammoSelectedDisplayName = (_artilleryAmmoDisplayName select (_pickFireMissionResult select 2)); + _precision = parseNumber (_pickFireMissionResult select 4); private _targetChooseAlgorithm = _pickFireMissionResult select 3; @@ -142,7 +144,8 @@ if (_mode == 0) then [localize "STR_AMAE_ROUNDS", "", "1"], [localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName], [localize "STR_AMAE_GRID_EAST_WEST_XXX", "","000"], - [localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"] + [localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"], + [localize "STR_AMAE_PRECISION", "", "0"] ]] call Ares_fnc_ShowChooseDialog; if (_pickFireMissionResult isEqualTo []) exitWith {}; @@ -154,6 +157,7 @@ if (_mode == 0) then private _targetX = _pickFireMissionResult select 3; private _targetY = _pickFireMissionResult select 4; _targetPos = [_targetX,_targetY] call CBA_fnc_mapGridToPos; + _precision = parseNumber (_pickFireMissionResult select 5); }; if (isNil "_targetPos") exitWith {[localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ares_fnc_ShowZeusMessage; playSound "FD_Start_F"}; @@ -174,7 +178,9 @@ if (_roundEta == -1) exitWith { [localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ar // Fire the guns { - [_x, [_targetPos, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x]; + private _theta = random 360; + private _deviation = [sin _theta, cos _theta, 0] vectorMultiply (random _precision); + [_x, [_targetPos vectorAdd _deviation, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x]; } forEach _gunsToFire; [localize "STR_AMAE_FIRE_ROUNDS_AND_ETA", _rounds, _ammoSelectedDisplayName, _roundEta] call Ares_fnc_ShowZeusMessage; From d562914b28f09f82ec852199a818d9a6a2f24d52 Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Sun, 10 Jun 2018 17:06:09 +0200 Subject: [PATCH 2/4] Add artillery precision option (resolves #133) --- .../addons/language_f/stringtable.xml | 6 ++++++ .../fn_FireSupportArtilleryFireMission.sqf | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/@AresModAchillesExpansion/addons/language_f/stringtable.xml b/@AresModAchillesExpansion/addons/language_f/stringtable.xml index 6ed25d00..91704fc4 100644 --- a/@AresModAchillesExpansion/addons/language_f/stringtable.xml +++ b/@AresModAchillesExpansion/addons/language_f/stringtable.xml @@ -2293,6 +2293,12 @@ 距離 距离 + + Precision [m] + Precision [m] + Précision [m] + Ungenauigkeit [m] + Range [m] Range [m] diff --git a/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf b/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf index 11d32983..41ad88e7 100644 --- a/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf +++ b/@AresModAchillesExpansion/addons/modules_f_ares/FireSupport/functions/fn_FireSupportArtilleryFireMission.sqf @@ -7,7 +7,7 @@ #include "\achilles\modules_f_ares\module_header.hpp" -private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName"]; +private ["_objects","_guns","_rounds","_ammo","_targetPos", "_artilleryAmmoDisplayName", "_ammoSelectedDisplayName", "_precision"]; _objects = nearestObjects [(_this select 0), ["All"], 150, true]; @@ -93,7 +93,8 @@ if (_mode == 0) then [localize "STR_AMAE_NUMBER_OF_UNITS_INVOLVED", _numberOfGuns], [localize "STR_AMAE_ROUNDS", "", "1"], [localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName], - [format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1] + [format [localize "STR_AMAE_TARGET"," "], _targetChoices, 1], + [localize "STR_AMAE_PRECISION", "", "0"] ]] call Ares_fnc_ShowChooseDialog; if (_pickFireMissionResult isEqualTo []) exitWith {}; @@ -102,6 +103,7 @@ if (_mode == 0) then _rounds = parseNumber (_pickFireMissionResult select 1); _ammo = (_artilleryAmmo select (_pickFireMissionResult select 2)); _ammoSelectedDisplayName = (_artilleryAmmoDisplayName select (_pickFireMissionResult select 2)); + _precision = parseNumber (_pickFireMissionResult select 4); private _targetChooseAlgorithm = _pickFireMissionResult select 3; @@ -142,7 +144,8 @@ if (_mode == 0) then [localize "STR_AMAE_ROUNDS", "", "1"], [localize "STR_AMAE_FS_AMMO", _artilleryAmmoDisplayName], [localize "STR_AMAE_GRID_EAST_WEST_XXX", "","000"], - [localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"] + [localize "STR_AMAE_GRID_NORTH_SOUTH_XXX", "","000"], + [localize "STR_AMAE_PRECISION", "", "0"] ]] call Ares_fnc_ShowChooseDialog; if (_pickFireMissionResult isEqualTo []) exitWith {}; @@ -154,6 +157,7 @@ if (_mode == 0) then private _targetX = _pickFireMissionResult select 3; private _targetY = _pickFireMissionResult select 4; _targetPos = [_targetX,_targetY] call CBA_fnc_mapGridToPos; + _precision = parseNumber (_pickFireMissionResult select 5); }; if (isNil "_targetPos") exitWith {[localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ares_fnc_ShowZeusMessage; playSound "FD_Start_F"}; @@ -174,7 +178,9 @@ if (_roundEta == -1) exitWith { [localize "STR_AMAE_NO_TARGET_IN_RANGE"] call Ar // Fire the guns { - [_x, [_targetPos, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x]; + private _theta = random 360; + private _deviation = [sin _theta, cos _theta, 0] vectorMultiply (random _precision); + [_x, [_targetPos vectorAdd _deviation, _ammo, _rounds]] remoteExecCall ["commandArtilleryFire", _x]; } forEach _gunsToFire; [localize "STR_AMAE_FIRE_ROUNDS_AND_ETA", _rounds, _ammoSelectedDisplayName, _roundEta] call Ares_fnc_ShowZeusMessage; From 713f582a5b12bf98674229d5115399a125bc78bc Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Sun, 10 Jun 2018 17:57:35 +0200 Subject: [PATCH 3/4] Revise paradrop: Drops below 150 => HALO (resolves #112) --- .../functions/features/fn_chute.sqf | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf index 214fe506..8fe99095 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf @@ -28,19 +28,29 @@ if (!isPlayer _unit) then moveOut _unit; unassignVehicle _unit; [_unit] orderGetIn false; - sleep 1; - // if the unit already has a chute - if (backpack _unit != "" and {getText (configfile >> "CfgVehicles" >> backpack _unit >> "backpackSimulation") isEqualTo "ParachuteSteerable"}) then + private _backpackClass = backpack _unit; + if (_backpackClass != "") then { + private _container = backpackContainer _unit; + private _weapon_cargo = getWeaponCargo _container; + private _magazine_cargo = getMagazineCargo _container; + private _item_cargo = getItemCargo _container; + removeBackpack _unit; + waitUntil {sleep 1; !alive _unit || getPos _unit select 2 < 150}; + private _chuteClass = ["b_parachute", _backpackClass] select (getText (configfile >> "CfgVehicles" >> _backpackClass >> "backpackSimulation") isEqualTo "ParachuteSteerable"); + _unit addBackpack _chuteClass; _unit action ["openParachute"]; + _unit addBackpack _backpackClass; + _container = backpackContainer _unit; + {_container addWeaponCargo [_x, (_weapon_cargo select 1) select _forEachIndex]} forEach (_weapon_cargo select 0); + {_container addMagazineCargo [_x, (_magazine_cargo select 1) select _forEachIndex]} forEach (_magazine_cargo select 0); + {_container addItemCargo [_x, (_item_cargo select 1) select _forEachIndex]} forEach (_item_cargo select 0); } else { - private _chute = "Steerable_Parachute_F" createVehicle [0,0,0]; - _chute setPos (getPos _unit); - _chute setDir (getDir _unit); - _chute setVelocity (velocity _unit); - _unit moveInDriver _chute; + waitUntil {sleep 1; !alive _unit || getPos _unit select 2 < 150}; + _unit addBackpack "b_parachute"; + _unit action ["openParachute"]; }; // prevent AI to be killed by fall damage waitUntil {isTouchingGround _unit or (!alive _unit)}; From 205e8755c787e6103a2559228cc01ff10465becf Mon Sep 17 00:00:00 2001 From: oOKexOo Date: Fri, 15 Jun 2018 21:55:27 +0200 Subject: [PATCH 4/4] Add spaces for readability --- .../addons/functions_f_achilles/functions/features/fn_chute.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf index 8fe99095..33a532eb 100644 --- a/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf +++ b/@AresModAchillesExpansion/addons/functions_f_achilles/functions/features/fn_chute.sqf @@ -36,6 +36,7 @@ if (!isPlayer _unit) then private _weapon_cargo = getWeaponCargo _container; private _magazine_cargo = getMagazineCargo _container; private _item_cargo = getItemCargo _container; + removeBackpack _unit; waitUntil {sleep 1; !alive _unit || getPos _unit select 2 < 150}; private _chuteClass = ["b_parachute", _backpackClass] select (getText (configfile >> "CfgVehicles" >> _backpackClass >> "backpackSimulation") isEqualTo "ParachuteSteerable"); @@ -71,6 +72,7 @@ if (!isPlayer _unit) then private _weapon_cargo = getWeaponCargo _container; private _magazine_cargo = getMagazineCargo _container; private _item_cargo = getItemCargo _container; + removeBackpack _unit; _unit addBackpack "b_parachute"; private _packHolder = createVehicle ["groundWeaponHolder", [0,0,0], [], 0, "can_collide"];