Skip to content

Commit

Permalink
Optimise mine interaction code
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 committed Jan 15, 2025
1 parent 35c325b commit 163ada4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions addons/explosives/functions/fnc_interactEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ if (

// Rescan if player has moved more than 5 meters from last position
if (_playerPos distanceSqr _setPosition > 25) then {
private _cfgAmmo = configFile >> "CfgAmmo";
{
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;
if (!(_x in _minesHelped) && {!(_x in GVAR(excludedMines))} && {getModelInfo _x select 0 isNotEqualTo "empty.p3d"}) then {
private _config = configOf _x;
private _size = getNumber (_config >> QGVAR(size));
private _defuseClass = ["ACE_DefuseObject", "ACE_DefuseObject_Large"] select (_size == 1);
private _defusePos = getArray (_config >> QGVAR(defuseObjectPosition));
Expand All @@ -64,10 +63,10 @@ if (
_addedHelpers pushBack _helper;
_minesHelped pushBack _x;
};
} forEach allMines;
} forEach (nearestMines [_player, [], 15, false, false]);

_args set [0, _playerPos];
};
};
END_COUNTER(interactEH);
}, 0.5, [getPosASL ACE_player vectorAdd [-100, 0, 0], [], []]] call CBA_fnc_addPerFrameHandler;
}, 0.5, [[0, 0, -100], [], []]] call CBA_fnc_addPerFrameHandler;

0 comments on commit 163ada4

Please sign in to comment.