Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explosives - Add exclusion from dynamic defuse action #8171

Merged
merged 21 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/explosives/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ PREP(spawnFlare);
PREP(startDefuse);
PREP(startTimer);
PREP(triggerType);
PREP(excludeMine);
PREP(stopExcludingMine);
Walthzer marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions addons/explosives/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if (isServer) then {
if (!hasInterface) exitWith {};

GVAR(PlacedCount) = 0;
GVAR(excludedMines) = [];
GVAR(Setup) = objNull;
GVAR(pfeh_running) = false;
GVAR(CurrentSpeedDial) = 0;
Expand Down
23 changes: 23 additions & 0 deletions addons/explosives/functions/fnc_excludeMine.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: Walthzer
* Excludes a passed mine from the dynamic defuse action.
*
* Arguments:
* 0: Mine <OBJECT>
*
* Return Value:
* Index in ace_explosives_fnc_excludedMines (or -1) <NUMBER>
Walthzer marked this conversation as resolved.
Show resolved Hide resolved
*
* Example:
* [_mine] call ace_explosives_fnc_excludeMine;
Walthzer marked this conversation as resolved.
Show resolved Hide resolved
*
* Public: Yes
*/

params ["_mine"];
TRACE_1("params",_mine);

if (!(_mine in AllMines)) exitWith {-1};
Walthzer marked this conversation as resolved.
Show resolved Hide resolved

GVAR(excludedMines) pushBackUnique _mine;
2 changes: 1 addition & 1 deletion addons/explosives/functions/fnc_interactEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 _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);
Expand Down
25 changes: 25 additions & 0 deletions addons/explosives/functions/fnc_stopExcludingMine.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "script_component.hpp"
/*
* Author: Walthzer
* Reinclude a passed mine with the dynamic defuse action.
*
* Arguments:
* 0: Mine <OBJECT>
*
* Return Value:
* Succes <BOOLEAN>
Walthzer marked this conversation as resolved.
Show resolved Hide resolved
*
* Example:
* [_mine] call ace_explosives_fnc_stopExcludingMine;
Walthzer marked this conversation as resolved.
Show resolved Hide resolved
*
* Public: Yes
*/

params ["_mine"];
TRACE_1("params",_mine);

if (!(_mine in GVAR(excludedMines))) exitWith {false};

GVAR(excludedMines) = GVAR(excludedMines) - [_mine];
Walthzer marked this conversation as resolved.
Show resolved Hide resolved

true