mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add check for invalid proxyWeapon
This commit is contained in:
parent
4b92ef2ade
commit
e5a9fadcec
@ -26,19 +26,20 @@ if (_vehicle getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exit
|
|||||||
private _proxyWeapon = getText (configOf _vehicle >> "ace_csw" >> "proxyWeapon");
|
private _proxyWeapon = getText (configOf _vehicle >> "ace_csw" >> "proxyWeapon");
|
||||||
|
|
||||||
TRACE_2("",typeOf _vehicle,_proxyWeapon);
|
TRACE_2("",typeOf _vehicle,_proxyWeapon);
|
||||||
if (_proxyWeapon == "") exitWith {};
|
if (_proxyWeapon isEqualTo "") exitWith {};
|
||||||
|
|
||||||
private _currentWeapon = (_vehicle weaponsTurret [0]) param [0, "#none"];
|
private _currentWeapon = (_vehicle weaponsTurret [0]) param [0, "#none"];
|
||||||
if ((missionNamespace getVariable [_proxyWeapon, objNull]) isEqualType {}) then { // check if string is a function
|
if ((missionNamespace getVariable [_proxyWeapon, objNull]) isEqualType {}) then { // check if string is a function
|
||||||
TRACE_1("Calling proxyWeapon function",_proxyWeapon);
|
TRACE_1("Calling proxyWeapon function",_proxyWeapon);
|
||||||
// This function may replace magazines or do other things to the static weapon
|
// This function may replace magazines or do other things to the static weapon
|
||||||
_proxyWeapon = [_vehicle, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon);
|
_proxyWeapon = [_vehicle, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon);
|
||||||
_needed = _proxyWeapon != "";
|
_needed = _proxyWeapon isNotEqualTo "" && {_proxyWeapon isNotEqualTo _currentWeapon};
|
||||||
};
|
};
|
||||||
if (!_needed) exitWith { TRACE_2("not needed",_needed,_proxyWeapon); };
|
if (!_needed) exitWith { TRACE_2("not needed",_needed,_proxyWeapon); };
|
||||||
|
|
||||||
// Config case for hashmap key
|
// Config case for hashmap key
|
||||||
_proxyWeapon = configName (configFile >> "CfgWeapons" >> _proxyWeapon);
|
_proxyWeapon = configName (configFile >> "CfgWeapons" >> _proxyWeapon);
|
||||||
|
if (_proxyWeapon isEqualTo "") exitWith {ERROR_1("proxy weapon non-existent for [%1]", _currentWeapon)}
|
||||||
|
|
||||||
// Cache compatible magazines
|
// Cache compatible magazines
|
||||||
if !(_proxyWeapon in GVAR(compatibleMagsCache)) then {
|
if !(_proxyWeapon in GVAR(compatibleMagsCache)) then {
|
||||||
|
Loading…
Reference in New Issue
Block a user