From c26107bc5c00dd5e4c70d278771a1e2f50f59580 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Tue, 8 Sep 2015 14:07:16 +0200 Subject: [PATCH 1/8] Added ability to pass a magazine --- addons/interaction/CfgVehicles.hpp | 26 ++++++++++ addons/interaction/XEH_preInit.sqf | 2 + .../functions/fnc_canPassMagazine.sqf | 25 ++++++++++ .../functions/fnc_passMagazine.sqf | 50 +++++++++++++++++++ addons/interaction/stringtable.xml | 16 ++++++ 5 files changed, 119 insertions(+) create mode 100644 addons/interaction/functions/fnc_canPassMagazine.sqf create mode 100644 addons/interaction/functions/fnc_passMagazine.sqf diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index abfdb976ab..2587869803 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -32,6 +32,32 @@ class CfgVehicles { icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; selection = "pelvis"; + class ACE_PassMagazine { + displayName = CSTRING(PassMagazine); + condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine)); + statement = ""; + showDisabled = 0; + priority = 3.3; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\cargomag_ca.paa"; + + class ACE_PassMagazinePrimary { + displayName = CSTRING(PassMagazinePrimary); + condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine)); + statement = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(passMagazine)); + showDisabled = 0; + priority = 3; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\primaryweapon_ca.paa"; + }; + class ACE_PassMagazineHandgun { + displayName = CSTRING(PassMagazineHandgun); + condition = QUOTE([ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine)); + statement = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(passMagazine)); + showDisabled = 0; + priority = 1; + icon = "\a3\ui_f\data\gui\Rsc\RscDisplayArsenal\handgun_ca.paa"; + }; + }; + class ACE_TeamManagement { displayName = CSTRING(TeamManagement); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {GVAR(EnableTeamManagement)}); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index c2534b44b9..7c64e7df75 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -10,6 +10,7 @@ PREP(canBecomeLeader); PREP(canInteractWithCivilian); PREP(canJoinGroup); PREP(canJoinTeam); +PREP(canPassMagazine); PREP(canTapShoulder); PREP(doBecomeLeader); PREP(getDoor); @@ -27,6 +28,7 @@ PREP(onSelectMenuDblClick); PREP(openDoor); PREP(openMenuSelectUI); PREP(openSelectMenu); +PREP(passMagazine); PREP(prepareSelectMenu); PREP(push); PREP(removeTag); diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf new file mode 100644 index 0000000000..3a99c3924f --- /dev/null +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -0,0 +1,25 @@ +/* + * Author: BaerMitUmlaut + * Checks if unit has a spare magazine for the specified weapon. + * + * Arguments: + * 0: Unit that gets searched + * 1: Weapon classname + * + * Return Value: + * None + * + * Example: + * [_player, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine + * + * Public: No + */ + +#include "script_component.hpp" +params ["_player", "_weapon"]; +private ["_compatibleMags", "_filterFunc"]; + +_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); +_filterFunc = compile format ["((_this select 0) in %1) && (!(_this select 2))", _compatibleMags]; + +count ([magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter)) > 0 \ No newline at end of file diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf new file mode 100644 index 0000000000..75762e6dea --- /dev/null +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -0,0 +1,50 @@ +/* + * Author: BaerMitUmlaut + * Pass spare magazine for the specified weapon. + * + * Arguments: + * 0: Unit that passes the magazine + * 1: Unit to pass the magazine to + * 2: Weapon classname + * + * Return Value: + * None + * + * Example: + * [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_magToPassazine + * + * Public: No + */ + +#include "script_component.hpp" +params ["_player", "_target", "_weapon"]; +private ["_compatibleMags", "_filterFunc", "_filteredMags", "_magToPass", "_magToPassIndex"]; + +_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); +_filterFunc = compile format ["((_this select 0) in %1) && !(_this select 2)", _compatibleMags]; + +_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); + +//select magazine with most ammo +_magToPass = _filteredMags select 0; +_magToPassIndex = 0; +{ + if ((_x select 1) > (_magToPass select 1)) then { + _magToPass = _x; + _magToPassIndex = _forEachIndex; + }; +} foreach _filteredMags; + +//remove all magazines and add them again, except the one to be passed +//needed because of missing commands, see http://feedback.arma3.com/view.php?id=12782 +_player removeMagazines (_magToPass select 0); +{ + if ((_x select 0) == (_magToPass select 0) && (_forEachIndex != _magToPassIndex)) then { + _player addMagazine [_x select 0, _x select 1]; + }; +} foreach _filteredMags; + +_player playActionNow "PutDown"; + +_target addMagazine [_magToPass select 0, _magToPass select 1]; +[[parseText format [CSTRING(PassMagazineHint), name _player, _magToPass select 0]], QUOTE(FUNC(common,displayTextStructured)), _target] call EFUNC(common,execRemoteFnc); \ No newline at end of file diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 65ca6df016..068d5ff751 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -816,5 +816,21 @@ A csapatkezelés engedélyezi a tagok színének meghatározását, a vezetés átvételét, és csapatoknál be-és kilépést. O módulo de gestão de equipe é composto por: a atribuição de cores para os membros da equipe, comando das equipes, juntando-se / deixando equipes. + + Pass magazine + Magazin geben + + + Primary magazine + Gewehrmagazin + + + Pistol magazine + Pistolenmagazin + + + %1 passed you a %2 magazine. + %1 hat dir ein %2 Magazin gegeben. + From 45bfa3eaf51f52dc954b16dd7e1003a7df42437c Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Thu, 10 Sep 2015 22:23:37 +0200 Subject: [PATCH 2/8] Fixed vanishing mags and localized hint --- addons/interaction/CfgVehicles.hpp | 6 ++--- addons/interaction/XEH_preInit.sqf | 1 + .../functions/fnc_canPassMagazine.sqf | 18 ++++++++----- .../functions/fnc_passMagazine.sqf | 5 ++-- .../functions/fnc_passMagazineLocal.sqf | 26 +++++++++++++++++++ 5 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 addons/interaction/functions/fnc_passMagazineLocal.sqf diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 2587869803..eff8a32f3d 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -34,7 +34,7 @@ class CfgVehicles { class ACE_PassMagazine { displayName = CSTRING(PassMagazine); - condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine)); + condition = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_3(_player,_target,handgunWeapon _target)] call FUNC(canPassMagazine)); statement = ""; showDisabled = 0; priority = 3.3; @@ -42,7 +42,7 @@ class CfgVehicles { class ACE_PassMagazinePrimary { displayName = CSTRING(PassMagazinePrimary); - condition = QUOTE([ARR_2(_player,primaryWeapon _target)] call FUNC(canPassMagazine)); + condition = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(canPassMagazine)); statement = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(passMagazine)); showDisabled = 0; priority = 3; @@ -50,7 +50,7 @@ class CfgVehicles { }; class ACE_PassMagazineHandgun { displayName = CSTRING(PassMagazineHandgun); - condition = QUOTE([ARR_2(_player,handgunWeapon _target)] call FUNC(canPassMagazine)); + condition = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(canPassMagazine)); statement = QUOTE([ARR_3(_player,_target,handgunWeapon _target)] call FUNC(passMagazine)); showDisabled = 0; priority = 1; diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 7c64e7df75..5b3283da51 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -29,6 +29,7 @@ PREP(openDoor); PREP(openMenuSelectUI); PREP(openSelectMenu); PREP(passMagazine); +PREP(passMagazineLocal); PREP(prepareSelectMenu); PREP(push); PREP(removeTag); diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 3a99c3924f..20920ef63b 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -3,23 +3,29 @@ * Checks if unit has a spare magazine for the specified weapon. * * Arguments: - * 0: Unit that gets searched - * 1: Weapon classname + * 0: Unit that passes the magazine + * 1: Unit to pass the magazine to + * 2: Weapon classname * * Return Value: * None * * Example: - * [_player, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine + * [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine * * Public: No */ #include "script_component.hpp" -params ["_player", "_weapon"]; -private ["_compatibleMags", "_filterFunc"]; +params ["_player", "_target", "_weapon"]; +private ["_compatibleMags", "_filterFunc", "_filteredMags"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); _filterFunc = compile format ["((_this select 0) in %1) && (!(_this select 2))", _compatibleMags]; +_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); -count ([magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter)) > 0 \ No newline at end of file +if (count _filteredMags > 0) then { + ({(_target canAddItemToUniform (_x select 0)) || (_target canAddItemToVest (_x select 0)) || (_target canAddItemToBackpack (_x select 0))} count _filteredMags) > 0 +} else { + false +}; \ No newline at end of file diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf index 75762e6dea..f126577e10 100644 --- a/addons/interaction/functions/fnc_passMagazine.sqf +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -29,7 +29,7 @@ _filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filte _magToPass = _filteredMags select 0; _magToPassIndex = 0; { - if ((_x select 1) > (_magToPass select 1)) then { + if (((_x select 1) > (_magToPass select 1)) && ((_target canAddItemToUniform (_x select 0)) || (_target canAddItemToVest (_x select 0)) || (_target canAddItemToBackpack (_x select 0)))) then { _magToPass = _x; _magToPassIndex = _forEachIndex; }; @@ -46,5 +46,4 @@ _player removeMagazines (_magToPass select 0); _player playActionNow "PutDown"; -_target addMagazine [_magToPass select 0, _magToPass select 1]; -[[parseText format [CSTRING(PassMagazineHint), name _player, _magToPass select 0]], QUOTE(FUNC(common,displayTextStructured)), _target] call EFUNC(common,execRemoteFnc); \ No newline at end of file +[[_player, _target, _magToPass select 0, _magToPass select 1], QUOTE(FUNC(passMagazineLocal)), _target] call EFUNC(common,execRemoteFnc); \ No newline at end of file diff --git a/addons/interaction/functions/fnc_passMagazineLocal.sqf b/addons/interaction/functions/fnc_passMagazineLocal.sqf new file mode 100644 index 0000000000..631a7c0250 --- /dev/null +++ b/addons/interaction/functions/fnc_passMagazineLocal.sqf @@ -0,0 +1,26 @@ +/* + * Author: BaerMitUmlaut + * Pass spare magazine for the specified weapon. + * + * Arguments: + * 0: Unit that passes the magazine + * 1: Unit to pass the magazine to + * 2: Magazine classname + * 3: Amount of rounds in magazine + * + * Return Value: + * None + * + * Example: + * [_unit, _player, "30Rnd_65x39_caseless_mag", 30] call ace_interaction_fnc_magToPassazine + * + * Public: No + */ + +#include "script_component.hpp" +params ["_unit", "_target", "_magazine", "_ammoCount"]; + +_target addMagazine [_magazine, _ammoCount]; +if (_target == ACE_player) then { + [parseText format [localize LSTRING(PassMagazineHint), name _unit, getText (configFile >> "CfgMagazines" >> _magazine >> "displayName")]] call EFUNC(common,displayTextStructured); +}; \ No newline at end of file From a29902ddb3fe5a9efc909ec4b6ce91bb0226ec5a Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Fri, 11 Sep 2015 15:36:23 +0200 Subject: [PATCH 3/8] More use of params, event system, removed compile --- addons/interaction/XEH_preInit.sqf | 1 - .../functions/fnc_canPassMagazine.sqf | 12 +++++---- .../functions/fnc_passMagazine.sqf | 26 ++++++++++++------- .../functions/fnc_passMagazineLocal.sqf | 26 ------------------- 4 files changed, 24 insertions(+), 41 deletions(-) delete mode 100644 addons/interaction/functions/fnc_passMagazineLocal.sqf diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 5b3283da51..7c64e7df75 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -29,7 +29,6 @@ PREP(openDoor); PREP(openMenuSelectUI); PREP(openSelectMenu); PREP(passMagazine); -PREP(passMagazineLocal); PREP(prepareSelectMenu); PREP(push); PREP(removeTag); diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 20920ef63b..ddcfec7804 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -18,14 +18,16 @@ #include "script_component.hpp" params ["_player", "_target", "_weapon"]; -private ["_compatibleMags", "_filterFunc", "_filteredMags"]; +private ["_compatibleMags", "_filteredMags"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filterFunc = compile format ["((_this select 0) in %1) && (!(_this select 2))", _compatibleMags]; -_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); +_filteredMags = [magazinesAmmoFull _player, { + params ["_className", "", "_loaded"]; + _className in _compatibleMags && !_loaded +}] call EFUNC(common,filter); -if (count _filteredMags > 0) then { - ({(_target canAddItemToUniform (_x select 0)) || (_target canAddItemToVest (_x select 0)) || (_target canAddItemToBackpack (_x select 0))} count _filteredMags) > 0 +if !(_filteredMags isEqualTo []) then { + ({_target canAdd (_x select 0)} count _filteredMags) > 0 } else { false }; \ No newline at end of file diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf index f126577e10..2afe2f3817 100644 --- a/addons/interaction/functions/fnc_passMagazine.sqf +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -18,18 +18,20 @@ #include "script_component.hpp" params ["_player", "_target", "_weapon"]; -private ["_compatibleMags", "_filterFunc", "_filteredMags", "_magToPass", "_magToPassIndex"]; +private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filterFunc = compile format ["((_this select 0) in %1) && !(_this select 2)", _compatibleMags]; - -_filteredMags = [magazinesAmmoFull _player, _filterFunc] call EFUNC(common,filter); +_filteredMags = [magazinesAmmoFull _player, { + params ["_className", "", "_loaded"]; + _className in _compatibleMags && !_loaded +}] call EFUNC(common,filter); //select magazine with most ammo _magToPass = _filteredMags select 0; _magToPassIndex = 0; { - if (((_x select 1) > (_magToPass select 1)) && ((_target canAddItemToUniform (_x select 0)) || (_target canAddItemToVest (_x select 0)) || (_target canAddItemToBackpack (_x select 0)))) then { + _x params ["_className", "_ammoCount"]; + if ((_ammoCount > (_magToPass select 1)) && (_target canAdd _className)) then { _magToPass = _x; _magToPassIndex = _forEachIndex; }; @@ -37,13 +39,19 @@ _magToPassIndex = 0; //remove all magazines and add them again, except the one to be passed //needed because of missing commands, see http://feedback.arma3.com/view.php?id=12782 -_player removeMagazines (_magToPass select 0); +_magToPass params ["_magToPassClassName", "_magToPassAmmoCount"]; +_player removeMagazines _magToPassClassName; { - if ((_x select 0) == (_magToPass select 0) && (_forEachIndex != _magToPassIndex)) then { - _player addMagazine [_x select 0, _x select 1]; + _x params ["_className", "_ammoCount"]; + if ((_className == _magToPassClassName) && (_forEachIndex != _magToPassIndex)) then { + _player addMagazine [_className, _ammoCount]; }; } foreach _filteredMags; _player playActionNow "PutDown"; -[[_player, _target, _magToPass select 0, _magToPass select 1], QUOTE(FUNC(passMagazineLocal)), _target] call EFUNC(common,execRemoteFnc); \ No newline at end of file +_target addMagazine [_magToPassClassName, _magToPassAmmoCount]; + +_playerName = [_player] call EFUNC(common,getName); +_magToPassDisplayName = getText (configFile >> "CfgMagazines" >> _magToPassClassName >> "displayName"); +["displayTextStructured", [_target], [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target]] call EFUNC(common,targetEvent); \ No newline at end of file diff --git a/addons/interaction/functions/fnc_passMagazineLocal.sqf b/addons/interaction/functions/fnc_passMagazineLocal.sqf deleted file mode 100644 index 631a7c0250..0000000000 --- a/addons/interaction/functions/fnc_passMagazineLocal.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Author: BaerMitUmlaut - * Pass spare magazine for the specified weapon. - * - * Arguments: - * 0: Unit that passes the magazine - * 1: Unit to pass the magazine to - * 2: Magazine classname - * 3: Amount of rounds in magazine - * - * Return Value: - * None - * - * Example: - * [_unit, _player, "30Rnd_65x39_caseless_mag", 30] call ace_interaction_fnc_magToPassazine - * - * Public: No - */ - -#include "script_component.hpp" -params ["_unit", "_target", "_magazine", "_ammoCount"]; - -_target addMagazine [_magazine, _ammoCount]; -if (_target == ACE_player) then { - [parseText format [localize LSTRING(PassMagazineHint), name _unit, getText (configFile >> "CfgMagazines" >> _magazine >> "displayName")]] call EFUNC(common,displayTextStructured); -}; \ No newline at end of file From ccf1bf1de7f3770ad5a5fe1ca09cf40b212a7989 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Fri, 11 Sep 2015 18:24:46 +0200 Subject: [PATCH 4/8] Cleaned up canPassMagazine condition --- addons/interaction/functions/fnc_canPassMagazine.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index ddcfec7804..66108b5a63 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -26,8 +26,8 @@ _filteredMags = [magazinesAmmoFull _player, { _className in _compatibleMags && !_loaded }] call EFUNC(common,filter); -if !(_filteredMags isEqualTo []) then { - ({_target canAdd (_x select 0)} count _filteredMags) > 0 +if (!(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}) then { + true } else { false }; \ No newline at end of file From 8ee11367582ca7f3f70cb559c05bdfa851d9cbe9 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Fri, 11 Sep 2015 23:52:00 +0200 Subject: [PATCH 5/8] Rewrite canPassMagazine condition --- .../interaction/functions/fnc_canPassMagazine.sqf | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 66108b5a63..4e6f70be0f 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -18,16 +18,11 @@ #include "script_component.hpp" params ["_player", "_target", "_weapon"]; -private ["_compatibleMags", "_filteredMags"]; +private ["_compatibleMags"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filteredMags = [magazinesAmmoFull _player, { - params ["_className", "", "_loaded"]; - _className in _compatibleMags && !_loaded -}] call EFUNC(common,filter); - -if (!(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}) then { - true -} else { +{ + _x params ["_className", "", "_loaded"]; + if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true}; false -}; \ No newline at end of file +} foreach (magazinesAmmoFull _player); \ No newline at end of file From 090384c014c4b88f7cd84d1abe8049b279c456b7 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Tue, 6 Oct 2015 17:56:32 +0200 Subject: [PATCH 6/8] Fixed canPassMagazine header --- addons/interaction/functions/fnc_canPassMagazine.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 4e6f70be0f..0555d3b57f 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -6,9 +6,9 @@ * 0: Unit that passes the magazine * 1: Unit to pass the magazine to * 2: Weapon classname - * + * * Return Value: - * None + * Unit can pass magazine * * Example: * [_player, _target, "arifle_MX_F"] call ace_interaction_fnc_canPassMagazine @@ -25,4 +25,4 @@ _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines" _x params ["_className", "", "_loaded"]; if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true}; false -} foreach (magazinesAmmoFull _player); \ No newline at end of file +} foreach (magazinesAmmoFull _player); From 1effe61aa9d2c57c2263788ffe71f7083ab001c3 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Tue, 6 Oct 2015 19:09:51 +0200 Subject: [PATCH 7/8] Removed parent condition --- addons/interaction/CfgVehicles.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index a434d12934..fe86670499 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -37,7 +37,7 @@ class CfgVehicles { class ACE_PassMagazine { displayName = CSTRING(PassMagazine); - condition = QUOTE([ARR_3(_player,_target,primaryWeapon _target)] call FUNC(canPassMagazine) || [ARR_3(_player,_target,handgunWeapon _target)] call FUNC(canPassMagazine)); + condition = ""; statement = ""; showDisabled = 0; priority = 3.3; From 818466d2968e58c6bae834d942914163d1e08c56 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Tue, 24 Nov 2015 19:07:17 +0100 Subject: [PATCH 8/8] Added ACE setting to hide interaction --- addons/interaction/ACE_Settings.hpp | 7 +++++++ addons/interaction/functions/fnc_canPassMagazine.sqf | 2 ++ addons/interaction/stringtable.xml | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/addons/interaction/ACE_Settings.hpp b/addons/interaction/ACE_Settings.hpp index 075c1f056d..a4e6dad42c 100644 --- a/addons/interaction/ACE_Settings.hpp +++ b/addons/interaction/ACE_Settings.hpp @@ -4,4 +4,11 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(enableMagazinePassing) { + value = 1; + typeName = "BOOL"; + isClientSettable = 1; + displayName = CSTRING(PassMagazineSetting); + category = ECSTRING(interact_menu,Category_InteractionMenu); + }; }; diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 0555d3b57f..1c1dd1bb2d 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -20,6 +20,8 @@ params ["_player", "_target", "_weapon"]; private ["_compatibleMags"]; +if (!GVAR(enableMagazinePassing)) exitWith {false}; + _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); { _x params ["_className", "", "_loaded"]; diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 73be7f5c73..8a425358b9 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -839,5 +839,9 @@ %1 passed you a %2 magazine. %1 hat dir ein %2 Magazin gegeben. + + Show "pass magazine" interaction + Zeige "Magazine geben" Interaktion +