mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
ASDG- Fail gracefully if attachments not compatible
This commit is contained in:
parent
a872b8b9e5
commit
1dd34199d6
@ -4,6 +4,12 @@
|
|||||||
// fixes laser when being captured. Needed, because the selectionpsoition of the right hand is used
|
// fixes laser when being captured. Needed, because the selectionpsoition of the right hand is used
|
||||||
["SetHandcuffed", {if (_this select 1) then {(_this select 0) action ["GunLightOff", _this select 0]};}] call EFUNC(common,addEventHandler);
|
["SetHandcuffed", {if (_this select 1) then {(_this select 0) action ["GunLightOff", _this select 0]};}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
|
//If user has ASDG JR without the compat patch, then ace's' laser pointers won't be compatible with anything
|
||||||
|
if ((isClass (configFile >> "CfgPatches" >> "asdg_jointrails")) && {!(isClass (configFile >> "CfgPatches" >> "ace_asdg_comp"))}) then {
|
||||||
|
diag_log text format ["[ACE_laserpointer] - ASDG Joint Rails but no ace_asdg_comp"];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if !(hasInterface) exitWith {};
|
if !(hasInterface) exitWith {};
|
||||||
|
|
||||||
GVAR(nearUnits) = [];
|
GVAR(nearUnits) = [];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// by commy2
|
// by commy2
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_unit", "_weapon"];
|
private ["_unit", "_weapon", "_error"];
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_weapon = _this select 1;
|
_weapon = _this select 1;
|
||||||
@ -44,21 +44,41 @@ private ["_description", "_picture"];
|
|||||||
|
|
||||||
_description = getText (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_modeDescription");
|
_description = getText (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_modeDescription");
|
||||||
_picture = getText (configFile >> "CfgWeapons" >> _nextPointer >> "picture");
|
_picture = getText (configFile >> "CfgWeapons" >> _nextPointer >> "picture");
|
||||||
|
_error = false;
|
||||||
|
|
||||||
switch (_currentWeaponType) do {
|
switch (_currentWeaponType) do {
|
||||||
case 1: {
|
case 1: {
|
||||||
_unit removePrimaryWeaponItem _pointer;
|
_unit removePrimaryWeaponItem _pointer;
|
||||||
_unit addPrimaryWeaponItem _nextPointer;
|
_unit addPrimaryWeaponItem _nextPointer;
|
||||||
|
if (((primaryWeaponItems _unit) select 1) != _nextPointer) then {
|
||||||
|
ERROR("NextPointer not compatible");
|
||||||
|
_unit addPrimaryWeaponItem _pointer;
|
||||||
|
_error = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
case 2: {
|
case 2: {
|
||||||
_unit removeSecondaryWeaponItem _pointer;
|
_unit removeSecondaryWeaponItem _pointer;
|
||||||
_unit addSecondaryWeaponItem _nextPointer;
|
_unit addSecondaryWeaponItem _nextPointer;
|
||||||
|
if (((secondaryWeaponItems _unit) select 1) != _nextPointer) then {
|
||||||
|
ERROR("NextPointer not compatible");
|
||||||
|
_unit addSecondaryWeaponItem _pointer;
|
||||||
|
_error = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
case 3: {
|
case 3: {
|
||||||
_unit removeHandgunItem _pointer;
|
_unit removeHandgunItem _pointer;
|
||||||
_unit addHandgunItem _nextPointer;
|
_unit addHandgunItem _nextPointer;
|
||||||
|
if (((handgunItems _unit) select 1) != _nextPointer) then {
|
||||||
|
ERROR("NextPointer not compatible");
|
||||||
|
_unit addHandgunItem _pointer;
|
||||||
|
_error = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
[_description, _picture] call EFUNC(common,displayTextPicture);
|
if (!_error) then {
|
||||||
|
[_description, _picture] call EFUNC(common,displayTextPicture);
|
||||||
|
} else {
|
||||||
|
diag_log text format ["Failed to add %1 to %2 - reverting to %3", _nextPointer, _weapon, _pointer];
|
||||||
|
};
|
||||||
playSound "ACE_Sound_Click";
|
playSound "ACE_Sound_Click";
|
||||||
|
Loading…
Reference in New Issue
Block a user