2015-05-27 19:09:06 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
|
|
|
* When interact_menu starts rendering (from "interact_keyDown" event)
|
|
|
|
* Add defuse helpers to all nearby mines
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* Interact Menu Type (0 - world, 1 - self) <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [0] call ace_explosives_fnc_interactEH
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-15 19:35:33 +00:00
|
|
|
params ["_interactionType"];
|
|
|
|
TRACE_1("params",_interactionType);
|
2015-05-27 19:09:06 +00:00
|
|
|
|
|
|
|
//Ignore self-interaction menu
|
|
|
|
if (_interactionType != 0) exitWith {};
|
|
|
|
//Ignore while mounted:
|
|
|
|
if ((vehicle ACE_player) != ACE_player) exitWith {};
|
|
|
|
//Ignore if we don't have defuse kit
|
|
|
|
if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
|
|
|
|
|
|
|
|
[{
|
2015-08-15 19:35:33 +00:00
|
|
|
params ["_args", "_pfID"];
|
|
|
|
_args params ["_setPosition", "_addedDefuseHelpers", "_minesHelped"];
|
2015-05-27 19:09:06 +00:00
|
|
|
|
|
|
|
if (!EGVAR(interact_menu,keyDown)) then {
|
|
|
|
TRACE_1("Cleaning Defuse Helpers",(count _addedDefuseHelpers));
|
|
|
|
{deleteVehicle _x;} forEach _addedDefuseHelpers;
|
|
|
|
[_pfID] call CBA_fnc_removePerFrameHandler;
|
|
|
|
} else {
|
|
|
|
// Prevent Rare Error when ending mission with interact key down:
|
|
|
|
if (isNull ace_player) exitWith {};
|
|
|
|
|
|
|
|
//If player moved >5 meters from last pos, then rescan
|
|
|
|
if (((getPosASL ace_player) distance _setPosition) > 5) then {
|
|
|
|
{
|
|
|
|
if (((_x distance ACE_player) < 15) && {!(_x in _minesHelped)}) then {
|
2016-08-02 23:29:31 +00:00
|
|
|
TRACE_3("Making Defuse Helper",(_x),(typeOf _x),(_x isKindOf "UnderwaterMine_Range_Ammo"));
|
|
|
|
private _defuseHelper = if (_x isKindOf "UnderwaterMine_Range_Ammo") then {
|
|
|
|
"ACE_DefuseObject_Large" createVehicleLocal (getPos _x);
|
|
|
|
} else {
|
|
|
|
"ACE_DefuseObject" createVehicleLocal (getPos _x);
|
|
|
|
};
|
2015-12-30 08:11:57 +00:00
|
|
|
|
|
|
|
private _config = configFile >> "CfgAmmo" >> typeOf _x;
|
|
|
|
|
|
|
|
private _defuseObjectPosition = getArray (_config >> QGVAR(defuseObjectPosition));
|
|
|
|
if (_defuseObjectPosition isEqualTo []) then {
|
|
|
|
_defuseObjectPosition = [0,0,0];
|
|
|
|
};
|
|
|
|
|
|
|
|
TRACE_1("DefuseObjectPosition",(_defuseObjectPosition));
|
|
|
|
|
|
|
|
_defuseHelper attachTo [_x, _defuseObjectPosition];
|
2015-05-27 19:09:06 +00:00
|
|
|
_defuseHelper setVariable [QGVAR(Explosive),_x];
|
|
|
|
_addedDefuseHelpers pushBack _defuseHelper;
|
|
|
|
_minesHelped pushBack _x;
|
|
|
|
};
|
|
|
|
} forEach allMines;
|
|
|
|
_args set [0, (getPosASL ace_player)];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}, 0.5, [((getPosASL ace_player) vectorAdd [-100,0,0]), [], []]] call CBA_fnc_addPerFrameHandler;
|