From a7352de8b7325bf2ee5e25f19bd2f200d0df2c60 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Mon, 15 Mar 2021 16:44:09 +0100 Subject: [PATCH 01/19] Add GVAR(noDefusalAction) --- addons/explosives/XEH_postInit.sqf | 1 + addons/explosives/functions/fnc_interactEH.sqf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index f01a3ad20d3..2a77a46773b 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -46,6 +46,7 @@ if (isServer) then { if (!hasInterface) exitWith {}; GVAR(PlacedCount) = 0; +GVAR(noDefusalAction) = []; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; diff --git a/addons/explosives/functions/fnc_interactEH.sqf b/addons/explosives/functions/fnc_interactEH.sqf index 950c376400f..71365a9bdec 100644 --- a/addons/explosives/functions/fnc_interactEH.sqf +++ b/addons/explosives/functions/fnc_interactEH.sqf @@ -47,7 +47,7 @@ if ( if (_playerPos distanceSqr _setPosition > 25) then { private _cfgAmmo = configFile >> "CfgAmmo"; { - if (_x distanceSqr _player < 225 && {!(_x in _minesHelped)} && {getModelInfo _x select 0 isNotEqualTo "empty.p3d"}) then { + if (_x distanceSqr _player < 225 && {!(_x in GVAR(noDefusalAction))} && {!(_x in _minesHelped)} && {getModelInfo _x select 0 isNotEqualTo "empty.p3d"}) then { private _config = _cfgAmmo >> typeOf _x; private _size = getNumber (_config >> QGVAR(size)); private _defuseClass = ["ACE_DefuseObject", "ACE_DefuseObject_Large"] select (_size == 1); From 755afdf20108ee27ec92b4b5e3f12ee2d531b011 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 16 Mar 2021 02:19:46 +0100 Subject: [PATCH 02/19] add changes --- addons/explosives/XEH_postInit.sqf | 2 +- .../explosives/functions/fnc_excludeMine.sqf | 23 +++++++++++++++++ .../explosives/functions/fnc_interactEH.sqf | 2 +- .../functions/fnc_stopExcludingMine.sqf | 25 +++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 addons/explosives/functions/fnc_excludeMine.sqf create mode 100644 addons/explosives/functions/fnc_stopExcludingMine.sqf diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 2a77a46773b..0e89add6e9f 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -46,7 +46,7 @@ if (isServer) then { if (!hasInterface) exitWith {}; GVAR(PlacedCount) = 0; -GVAR(noDefusalAction) = []; +GVAR(excludedMines) = []; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; diff --git a/addons/explosives/functions/fnc_excludeMine.sqf b/addons/explosives/functions/fnc_excludeMine.sqf new file mode 100644 index 00000000000..6c2b682c81b --- /dev/null +++ b/addons/explosives/functions/fnc_excludeMine.sqf @@ -0,0 +1,23 @@ +#include "script_component.hpp" +/* + * Author: Walthzer + * Excludes a passed mine from the dynamic defuse action. + * + * Arguments: + * 0: Mine + * + * Return Value: + * Index in ace_explosives_fnc_excludedMines (or -1) + * + * Example: + * [_mine] call ace_explosives_fnc_excludeMine; + * + * Public: Yes + */ + +params ["_mine"]; +TRACE_1("params",_mine); + +if (!(_mine in AllMines)) exitWith {-1}; + +GVAR(excludedMines) pushBackUnique _mine; \ No newline at end of file diff --git a/addons/explosives/functions/fnc_interactEH.sqf b/addons/explosives/functions/fnc_interactEH.sqf index 71365a9bdec..da7215bb810 100644 --- a/addons/explosives/functions/fnc_interactEH.sqf +++ b/addons/explosives/functions/fnc_interactEH.sqf @@ -47,7 +47,7 @@ if ( if (_playerPos distanceSqr _setPosition > 25) then { private _cfgAmmo = configFile >> "CfgAmmo"; { - if (_x distanceSqr _player < 225 && {!(_x in GVAR(noDefusalAction))} && {!(_x in _minesHelped)} && {getModelInfo _x select 0 isNotEqualTo "empty.p3d"}) then { + if (_x distanceSqr _player < 225 && {!(_x in _minesHelped)} && {!(_x in GVAR(excludedMines))} && {getModelInfo _x select 0 isNotEqualTo "empty.p3d"}) then { private _config = _cfgAmmo >> typeOf _x; private _size = getNumber (_config >> QGVAR(size)); private _defuseClass = ["ACE_DefuseObject", "ACE_DefuseObject_Large"] select (_size == 1); diff --git a/addons/explosives/functions/fnc_stopExcludingMine.sqf b/addons/explosives/functions/fnc_stopExcludingMine.sqf new file mode 100644 index 00000000000..cd0cec9c2fe --- /dev/null +++ b/addons/explosives/functions/fnc_stopExcludingMine.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: Walthzer + * Reinclude a passed mine with the dynamic defuse action. + * + * Arguments: + * 0: Mine + * + * Return Value: + * Succes + * + * Example: + * [_mine] call ace_explosives_fnc_stopExcludingMine; + * + * Public: Yes + */ + +params ["_mine"]; +TRACE_1("params",_mine); + +if (!(_mine in GVAR(excludedMines))) exitWith {false}; + +GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; + +true \ No newline at end of file From e43ddeaea88b341a3ae82e35be32aee6ed9a519e Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 16 Mar 2021 02:38:00 +0100 Subject: [PATCH 03/19] Prep functions --- addons/explosives/XEH_PREP.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index c04e0d31339..d14a46ff4f0 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -37,3 +37,5 @@ PREP(spawnFlare); PREP(startDefuse); PREP(startTimer); PREP(triggerType); +PREP(excludeMine); +PREP(stopExcludingMine); \ No newline at end of file From e010ed302442aa005ad5ba7448464b07920ac892 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 16 Mar 2021 11:42:54 +0100 Subject: [PATCH 04/19] Update addons/explosives/functions/fnc_excludeMine.sqf Uhm, strange. Its clearly allMines, yet Allmines didn't only build it also worked properly. Undocumented variable? Co-authored-by: BaerMitUmlaut --- addons/explosives/functions/fnc_excludeMine.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/explosives/functions/fnc_excludeMine.sqf b/addons/explosives/functions/fnc_excludeMine.sqf index 6c2b682c81b..bb031f85a1f 100644 --- a/addons/explosives/functions/fnc_excludeMine.sqf +++ b/addons/explosives/functions/fnc_excludeMine.sqf @@ -18,6 +18,6 @@ params ["_mine"]; TRACE_1("params",_mine); -if (!(_mine in AllMines)) exitWith {-1}; +if (!(_mine in allMines)) exitWith {-1}; -GVAR(excludedMines) pushBackUnique _mine; \ No newline at end of file +GVAR(excludedMines) pushBackUnique _mine; From f567aba20b06ac63f6f3240b2a14d0117797f42e Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 16 Mar 2021 11:43:28 +0100 Subject: [PATCH 05/19] Update addons/explosives/functions/fnc_stopExcludingMine.sqf Co-authored-by: BaerMitUmlaut --- addons/explosives/functions/fnc_stopExcludingMine.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/explosives/functions/fnc_stopExcludingMine.sqf b/addons/explosives/functions/fnc_stopExcludingMine.sqf index cd0cec9c2fe..ea73878f08f 100644 --- a/addons/explosives/functions/fnc_stopExcludingMine.sqf +++ b/addons/explosives/functions/fnc_stopExcludingMine.sqf @@ -20,6 +20,6 @@ TRACE_1("params",_mine); if (!(_mine in GVAR(excludedMines))) exitWith {false}; -GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; +GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; -true \ No newline at end of file +true From d8aec569917a6a782ce0e9d561acb8c8125d983e Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 13:45:13 +0200 Subject: [PATCH 06/19] Header Fixes Fix information in the function headers Co-authored-by: jonpas --- addons/explosives/functions/fnc_excludeMine.sqf | 4 ++-- addons/explosives/functions/fnc_stopExcludingMine.sqf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/explosives/functions/fnc_excludeMine.sqf b/addons/explosives/functions/fnc_excludeMine.sqf index bb031f85a1f..00fb5e5d00d 100644 --- a/addons/explosives/functions/fnc_excludeMine.sqf +++ b/addons/explosives/functions/fnc_excludeMine.sqf @@ -7,10 +7,10 @@ * 0: Mine * * Return Value: - * Index in ace_explosives_fnc_excludedMines (or -1) + * Index in ace_explosives_excludedMines (or -1) * * Example: - * [_mine] call ace_explosives_fnc_excludeMine; + * [_mine] call ace_explosives_fnc_excludeMine * * Public: Yes */ diff --git a/addons/explosives/functions/fnc_stopExcludingMine.sqf b/addons/explosives/functions/fnc_stopExcludingMine.sqf index ea73878f08f..c3daf343e3d 100644 --- a/addons/explosives/functions/fnc_stopExcludingMine.sqf +++ b/addons/explosives/functions/fnc_stopExcludingMine.sqf @@ -7,10 +7,10 @@ * 0: Mine * * Return Value: - * Succes + * Success * * Example: - * [_mine] call ace_explosives_fnc_stopExcludingMine; + * [_mine] call ace_explosives_fnc_stopExcludingMine * * Public: Yes */ From fcde48bd80010ccfd442ff22f2aefc9d30dd9028 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 16:01:00 +0200 Subject: [PATCH 07/19] Remove Individual Functions --- .../explosives/functions/fnc_excludeMine.sqf | 23 ----------------- .../functions/fnc_stopExcludingMine.sqf | 25 ------------------- 2 files changed, 48 deletions(-) delete mode 100644 addons/explosives/functions/fnc_excludeMine.sqf delete mode 100644 addons/explosives/functions/fnc_stopExcludingMine.sqf diff --git a/addons/explosives/functions/fnc_excludeMine.sqf b/addons/explosives/functions/fnc_excludeMine.sqf deleted file mode 100644 index bb031f85a1f..00000000000 --- a/addons/explosives/functions/fnc_excludeMine.sqf +++ /dev/null @@ -1,23 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Walthzer - * Excludes a passed mine from the dynamic defuse action. - * - * Arguments: - * 0: Mine - * - * Return Value: - * Index in ace_explosives_fnc_excludedMines (or -1) - * - * Example: - * [_mine] call ace_explosives_fnc_excludeMine; - * - * Public: Yes - */ - -params ["_mine"]; -TRACE_1("params",_mine); - -if (!(_mine in allMines)) exitWith {-1}; - -GVAR(excludedMines) pushBackUnique _mine; diff --git a/addons/explosives/functions/fnc_stopExcludingMine.sqf b/addons/explosives/functions/fnc_stopExcludingMine.sqf deleted file mode 100644 index ea73878f08f..00000000000 --- a/addons/explosives/functions/fnc_stopExcludingMine.sqf +++ /dev/null @@ -1,25 +0,0 @@ -#include "script_component.hpp" -/* - * Author: Walthzer - * Reinclude a passed mine with the dynamic defuse action. - * - * Arguments: - * 0: Mine - * - * Return Value: - * Succes - * - * Example: - * [_mine] call ace_explosives_fnc_stopExcludingMine; - * - * Public: Yes - */ - -params ["_mine"]; -TRACE_1("params",_mine); - -if (!(_mine in GVAR(excludedMines))) exitWith {false}; - -GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; - -true From 25f43f2686be59e316cdce01afb412ddfd332eea Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 16:01:35 +0200 Subject: [PATCH 08/19] Compacter Functions --- addons/explosives/XEH_PREP.hpp | 4 +-- .../explosives/functions/fnc_allowDefuse.sqf | 31 +++++++++++++++++++ .../functions/fnc_isAllowedDefuse.sqf | 21 +++++++++++++ 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 addons/explosives/functions/fnc_allowDefuse.sqf create mode 100644 addons/explosives/functions/fnc_isAllowedDefuse.sqf diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index d14a46ff4f0..292a8fe54c3 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -37,5 +37,5 @@ PREP(spawnFlare); PREP(startDefuse); PREP(startTimer); PREP(triggerType); -PREP(excludeMine); -PREP(stopExcludingMine); \ No newline at end of file +PREP(allowDefuse); +PREP(isAllowedDefuse); \ No newline at end of file diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf new file mode 100644 index 00000000000..a032c0a18a6 --- /dev/null +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/* + * Author: Walthzer + * Excludes a passed mine from the dynamic defuse action. + * + * Arguments: + * 0: Mine + * 1: Allow Ace defusal + * + * Return Value: + * Succes + * + * Example: + * [_mine] call ace_explosives_fnc_allowDefuse + * + * Public: Yes + */ + +params [["_mine", objNull, [objNull]], ["_allow", true, [true]]]; +TRACE_1("params",_mine,_allow); + +if (!(_mine in allMines)) exitWith {false}; + +if (_allow) then { + if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; + GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; +} else { + if((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; +}; + +true diff --git a/addons/explosives/functions/fnc_isAllowedDefuse.sqf b/addons/explosives/functions/fnc_isAllowedDefuse.sqf new file mode 100644 index 00000000000..67a6c12f5be --- /dev/null +++ b/addons/explosives/functions/fnc_isAllowedDefuse.sqf @@ -0,0 +1,21 @@ +#include "script_component.hpp" +/* + * Author: Walthzer + * Check if Ace is allowed to add a defusal action to a mine. + * + * Arguments: + * 0: Mine + * + * Return Value: + * Allowed + * + * Example: + * [_mine] call ace_explosives_fnc_isAllowedDefuse + * + * Public: Yes + */ + +params [["_mine", objNull, [objNull]]]; +TRACE_1("params",_mine); + +!(_mine in GVAR(excludedMines)); From 7ec7febe0892c7e051ffa8ee9bd3f60a1b4c9e90 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 16:01:41 +0200 Subject: [PATCH 09/19] Event --- addons/explosives/XEH_postInit.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 0e89add6e9f..340cabdf210 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -66,3 +66,8 @@ GVAR(CurrentSpeedDial) = 0; params ["_player"]; [_player, QGVAR(explosiveActions)] call EFUNC(common,eraseCache); }] call CBA_fnc_addPlayerEventHandler; + +["ace_allowDefuse", { + params["_mine", "_allow"]; + [_mine, _allow] call FUNC(allowDefuse); +}] call CBA_fnc_addEventHandler; \ No newline at end of file From 5583291a71949516f904bdbc45fae150ef0204d1 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 16:12:38 +0200 Subject: [PATCH 10/19] remove tab (facepalm) --- addons/explosives/functions/fnc_allowDefuse.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index a032c0a18a6..ac742e62516 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -20,12 +20,12 @@ params [["_mine", objNull, [objNull]], ["_allow", true, [true]]]; TRACE_1("params",_mine,_allow); if (!(_mine in allMines)) exitWith {false}; - + if (_allow) then { - if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; - GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; + if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; + GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; } else { - if((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; + if((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; }; true From 196060fcac30338ddaed0d142daea510b07905f3 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 16:59:49 +0200 Subject: [PATCH 11/19] Jonpass' Review Fixes Co-authored-by: jonpas --- addons/explosives/XEH_PREP.hpp | 2 +- addons/explosives/XEH_postInit.sqf | 2 +- addons/explosives/functions/fnc_allowDefuse.sqf | 8 ++++---- addons/explosives/functions/fnc_isAllowedDefuse.sqf | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index 292a8fe54c3..d5491186238 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -38,4 +38,4 @@ PREP(startDefuse); PREP(startTimer); PREP(triggerType); PREP(allowDefuse); -PREP(isAllowedDefuse); \ No newline at end of file +PREP(isAllowedDefuse); diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 340cabdf210..d5bf4182356 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -70,4 +70,4 @@ GVAR(CurrentSpeedDial) = 0; ["ace_allowDefuse", { params["_mine", "_allow"]; [_mine, _allow] call FUNC(allowDefuse); -}] call CBA_fnc_addEventHandler; \ No newline at end of file +}] call CBA_fnc_addEventHandler; diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index ac742e62516..2af15fea3a0 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -5,13 +5,13 @@ * * Arguments: * 0: Mine - * 1: Allow Ace defusal + * 1: Allow defusal * * Return Value: * Succes * * Example: - * [_mine] call ace_explosives_fnc_allowDefuse + * [_mine, false] call ace_explosives_fnc_allowDefuse * * Public: Yes */ @@ -19,13 +19,13 @@ params [["_mine", objNull, [objNull]], ["_allow", true, [true]]]; TRACE_1("params",_mine,_allow); -if (!(_mine in allMines)) exitWith {false}; +if !(_mine in allMines) exitWith {false}; if (_allow) then { if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; } else { - if((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; + if ((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; }; true diff --git a/addons/explosives/functions/fnc_isAllowedDefuse.sqf b/addons/explosives/functions/fnc_isAllowedDefuse.sqf index 67a6c12f5be..f69e375e941 100644 --- a/addons/explosives/functions/fnc_isAllowedDefuse.sqf +++ b/addons/explosives/functions/fnc_isAllowedDefuse.sqf @@ -18,4 +18,4 @@ params [["_mine", objNull, [objNull]]]; TRACE_1("params",_mine); -!(_mine in GVAR(excludedMines)); +!(_mine in GVAR(excludedMines)) From 38fe92e43cd78c0af3d9200fcf495682f745bc32 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 17:21:40 +0200 Subject: [PATCH 12/19] Fix exitWith mistake --- addons/explosives/functions/fnc_allowDefuse.sqf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index 2af15fea3a0..7e2aa4f0c3c 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -20,12 +20,11 @@ params [["_mine", objNull, [objNull]], ["_allow", true, [true]]]; TRACE_1("params",_mine,_allow); if !(_mine in allMines) exitWith {false}; - + if (_allow) then { if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; + true } else { - if ((GVAR(excludedMines) pushBackUnique _mine) == -1) exitWith {false}; + not ((GVAR(excludedMines) pushBackUnique _mine) == -1); }; - -true From ced426cfc0890c2a57463e906b52a092bd30c9a0 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 17:49:21 +0200 Subject: [PATCH 13/19] Refractor of allowDefuse Co-authored-by: jonpas --- addons/explosives/functions/fnc_allowDefuse.sqf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index 7e2aa4f0c3c..6d7d85d7ee2 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -21,10 +21,13 @@ TRACE_1("params",_mine,_allow); if !(_mine in allMines) exitWith {false}; -if (_allow) then { - if ([_mine] call FUNC(isAllowedDefuse)) exitWith {false}; +if (_allow && {!([_mine] call FUNC(isAllowedDefuse))}) exitWith { GVAR(excludedMines) = GVAR(excludedMines) - [_mine]; true -} else { - not ((GVAR(excludedMines) pushBackUnique _mine) == -1); }; + +if (!_allow) exitWith { + (GVAR(excludedMines) pushBackUnique _mine != -1 +}; + +false From 85a674e57af45bcf4f4ac2dd53a2dd262e5764eb Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 17:51:49 +0200 Subject: [PATCH 14/19] Update addons/explosives/functions/fnc_allowDefuse.sqf Co-authored-by: jonpas --- addons/explosives/functions/fnc_allowDefuse.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index 6d7d85d7ee2..d5f1e9fcf1b 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -27,7 +27,7 @@ if (_allow && {!([_mine] call FUNC(isAllowedDefuse))}) exitWith { }; if (!_allow) exitWith { - (GVAR(excludedMines) pushBackUnique _mine != -1 + GVAR(excludedMines) pushBackUnique _mine != -1 }; false From 87c340b3f021d4260864d49a92a05f4f516a0da4 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 22:27:55 +0200 Subject: [PATCH 15/19] Update Documentation --- addons/explosives/functions/fnc_allowDefuse.sqf | 2 +- addons/explosives/functions/fnc_isAllowedDefuse.sqf | 2 +- docs/wiki/framework/events-framework.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index d5f1e9fcf1b..ec65c465d95 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Walthzer - * Excludes a passed mine from the dynamic defuse action. + * Sets if a dynamic defuse action is allowed to be added to a mine. * * Arguments: * 0: Mine diff --git a/addons/explosives/functions/fnc_isAllowedDefuse.sqf b/addons/explosives/functions/fnc_isAllowedDefuse.sqf index f69e375e941..2d2846d27c0 100644 --- a/addons/explosives/functions/fnc_isAllowedDefuse.sqf +++ b/addons/explosives/functions/fnc_isAllowedDefuse.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Walthzer - * Check if Ace is allowed to add a defusal action to a mine. + * Check if a mine is allowed to recieve a dynamic defuse action. * * Arguments: * 0: Mine diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index d1cc6d01d09..b5cdf263cf9 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -81,6 +81,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction | Event Key | Parameters | Locality | Type | Description | |----------|---------|---------|---------|---------|---------| +|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Exclude or Include a mine from the dynamic defuse action |`ace_tripflareTriggered` | [_flareObject, [_posX, _posY, _posZ]] | Global | Listen | Tripflare triggered |`ace_explosives_clackerAdded` | [_unit, _explosive, _id] | Local | Listen | Clacker added to explosive From 5b0be717be95d55f346784f332a5f6a329dce57a Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 22:39:17 +0200 Subject: [PATCH 16/19] Rephrase documentation --- docs/wiki/framework/events-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index b5cdf263cf9..2f7a78551a1 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -81,7 +81,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction | Event Key | Parameters | Locality | Type | Description | |----------|---------|---------|---------|---------|---------| -|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Exclude or Include a mine from the dynamic defuse action +|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Set allowment of the dynamic defusal action on a mine |`ace_tripflareTriggered` | [_flareObject, [_posX, _posY, _posZ]] | Global | Listen | Tripflare triggered |`ace_explosives_clackerAdded` | [_unit, _explosive, _id] | Local | Listen | Clacker added to explosive From cbf46165d5f1e8552e16a69bc29211e08f57267a Mon Sep 17 00:00:00 2001 From: Walthzer Date: Tue, 20 Apr 2021 22:45:17 +0200 Subject: [PATCH 17/19] Another rephrase --- docs/wiki/framework/events-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index 2f7a78551a1..52762989ff2 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -81,7 +81,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction | Event Key | Parameters | Locality | Type | Description | |----------|---------|---------|---------|---------|---------| -|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Set allowment of the dynamic defusal action on a mine +|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Set allowance of the dynamic defusal action on a mine |`ace_tripflareTriggered` | [_flareObject, [_posX, _posY, _posZ]] | Global | Listen | Tripflare triggered |`ace_explosives_clackerAdded` | [_unit, _explosive, _id] | Local | Listen | Clacker added to explosive From 6e0e9e718280a03b2b08e988c90f5514115d8c44 Mon Sep 17 00:00:00 2001 From: Walthzer Date: Wed, 21 Apr 2021 22:18:26 +0200 Subject: [PATCH 18/19] Relabel Locality --- docs/wiki/framework/events-framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/wiki/framework/events-framework.md b/docs/wiki/framework/events-framework.md index 52762989ff2..3cde6293b60 100644 --- a/docs/wiki/framework/events-framework.md +++ b/docs/wiki/framework/events-framework.md @@ -81,7 +81,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction | Event Key | Parameters | Locality | Type | Description | |----------|---------|---------|---------|---------|---------| -|`ace_allowDefuse` | [_mine, _allow] | Global | Callable | Set allowance of the dynamic defusal action on a mine +|`ace_allowDefuse` | [_mine, _allow] | Global or Target | Callable | Set allowance of the dynamic defusal action on a mine |`ace_tripflareTriggered` | [_flareObject, [_posX, _posY, _posZ]] | Global | Listen | Tripflare triggered |`ace_explosives_clackerAdded` | [_unit, _explosive, _id] | Local | Listen | Clacker added to explosive From ea2e78d5393c833f177cd6ef1b1863a0a6d93fe8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 11 Oct 2021 00:45:56 -0500 Subject: [PATCH 19/19] Update addons/explosives/functions/fnc_allowDefuse.sqf --- addons/explosives/functions/fnc_allowDefuse.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/explosives/functions/fnc_allowDefuse.sqf b/addons/explosives/functions/fnc_allowDefuse.sqf index ec65c465d95..15042e4ca56 100644 --- a/addons/explosives/functions/fnc_allowDefuse.sqf +++ b/addons/explosives/functions/fnc_allowDefuse.sqf @@ -17,7 +17,7 @@ */ params [["_mine", objNull, [objNull]], ["_allow", true, [true]]]; -TRACE_1("params",_mine,_allow); +TRACE_2("params",_mine,_allow); if !(_mine in allMines) exitWith {false};