Skip to content

Commit

Permalink
Fix exception handling and add support LWIRCM from RHS (#369)
Browse files Browse the repository at this point in the history
* Fix exception handling and add support lwircm from RHS

* Use localization
  • Loading branch information
Kexanone authored Sep 22, 2018
1 parent 7e46192 commit e461131
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#define ALL_SL_WEAP_CLASSES ["SmokeLauncher","rhs_weap_smokegen","rhs_weap_902a","rhs_weap_902b","rhsusf_weap_M259"]
#define ALL_CM_WEAP_CLASSES ["CMFlareLauncher", "CMFlareLauncher_Singles", "CMFlareLauncher_Triples", "rhs_weap_CMFlareLauncher","rhsusf_weap_CMFlareLauncher"]
#define ALL_CM_WEAP_CLASSES ["CMFlareLauncher", "CMFlareLauncher_Singles", "CMFlareLauncher_Triples", "rhs_weap_CMFlareLauncher","rhsusf_weap_CMFlareLauncher","rhsusf_weap_LWIRCM"]

params[["_vehicle", objNull, [objNull]], ["_flareParams", [6, 0.1], [[]], 2]];

Expand All @@ -41,7 +41,7 @@ if (_vehicle isKindOf "Man") then
] call BIS_fnc_sortBy;

// Display different messages if the unit doesn't have any smokes
if (_allSmokeMagazines isEqualTo []) exitWith {[format ["Smoke grenades unavailable for %1!", name _vehicle]] call Achilles_fnc_showZeusErrorMessage};
if (_allSmokeMagazines isEqualTo []) exitWith {[localize "STR_AMAE_HAS_NO_SMOKES_ERROR"] call Achilles_fnc_showZeusErrorMessage};

// Make the unit throw the smoke grenade
private _smokeMuzzle = (_allSmokeMagazines select 0) select 4;
Expand All @@ -59,12 +59,13 @@ else
{((getText (configfile >> "CfgMagazines" >> (_x select 0) >> "nameSound")) == _smokeType) && ((_x select 2) > 0)}
] call BIS_fnc_sortBy;

if (_allSmokeMagazines isEqualTo [] && !_isVehicleAir) exitWith {[format ["Smoke dispensers unavailable for %1!", name _vehicle]] call Achilles_fnc_showZeusErrorMessage};
if (_allSmokeMagazines isEqualTo [] && _isVehicleAir) exitWith {[format ["Countermeasures unavailable for %1!", name _vehicle]] call Achilles_fnc_showZeusErrorMessage};
if (_allSmokeMagazines isEqualTo [] && !_isVehicleAir) exitWith {[localize "STR_AMAE_HAS_NO_SMOKES_ERROR"] call Achilles_fnc_showZeusErrorMessage};
if (_allSmokeMagazines isEqualTo [] && _isVehicleAir) exitWith {[localize "STR_AMAE_HAS_NO_CM_ERROR"] call Achilles_fnc_showZeusErrorMessage};

private _turretPath = (_allSmokeMagazines select 0) select 1;
private _weapons = _vehicle weaponsTurret _turretPath;
private _CMWeapons = _weapons arrayIntersect _weaponClasses;
if (_CMWeapons isEqualTo []) exitWith {[localize "STR_AMAE_HAS_NO_SMOKES_ERROR"] call Achilles_fnc_showZeusErrorMessage};
private _CMWeapon = _CMWeapons select 0;

// If the vehicle is any kind of land vehicle (cars, tanks, trucks etc.)
Expand Down
12 changes: 12 additions & 0 deletions @AresModAchillesExpansion/addons/language_f/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,18 @@
<German>Kein Fahrzeug verfügbar! Überprüfe deine Fraktionsfilter Einstellungen!</German>
<Japanese>利用可能車両はありません! 陣営フィルタ設定を確認して下さい!</Japanese>
</Key>
<Key ID="STR_AMAE_HAS_NO_SMOKES_ERROR">
<Original>Error: Unit has no smokes</Original>
<English>Error: Unit has no smokes</English>
<French>Erreur: L'unité n'as pas de fumigène</French>
<German>Fehler: Die Einheit hat keine Nebelwurfkörper</German>
</Key>
<Key ID="STR_AMAE_HAS_NO_CM_ERROR">
<Original>Error: Unit has no countermeasures</Original>
<English>Error: Unit has no countermeasures</English>
<French>Erreur: L'unité n'as pas de fumigène</French>
<German>Fehler: Die Einheit hat keine Nebelwurfkörper</German>
</Key>
</Container>
</Package>
<Package name="Ares Curator Dialogs">
Expand Down

0 comments on commit e461131

Please sign in to comment.