Skip to content

Commit

Permalink
Add support for ace_interact_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mharis001 committed Aug 4, 2019
1 parent 5fe0c3c commit e100ec3
Showing 1 changed file with 80 additions and 41 deletions.
121 changes: 80 additions & 41 deletions addons/modules/functions/fnc_moduleCreateIntelLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,52 +23,91 @@

#define MAX_DISTANCE 3

#define ADD_INTEL_TO_TARGETS \
private _targets = switch (_share) do { \
case 0: { \
call CBA_fnc_players select {side group _x == side _unit} \
}; \
case 1: { \
units _unit select {isPlayer _x} \
}; \
case 2: { \
[_unit] \
}; \
}; \
[["\a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa", 1.25], [localize LSTRING(ModuleCreateIntel_IntelFound)], true] call CBA_fnc_notify; \
[QGVAR(addIntel), [_title, _text], _targets] call CBA_fnc_targetEvent

params ["_object", "_share", "_delete", "_actionText", "_duration", "_title", "_text"];

private _actionID = _object getVariable QGVAR(intelActionID);
if (isClass (configFile >> "CfgPatches" >> "ace_interact_menu")) then {
[_object, 0, ["ACE_MainActions", QGVAR(intelAction)]] call ace_interact_menu_fnc_removeActionFromObject;

if (!isNil "_actionID") then {
[_object, _actionID] call BIS_fnc_holdActionRemove;
};
private _action = [
QGVAR(intelAction),
_actionText,
"\a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa",
{
params ["_object", "_unit", "_args"];
_args params ["_title", "_text", "_share", "_delete", "_actionText", "_duration"];

_actionID = [
_object,
_actionText,
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
QUOTE(_target distance _this < MAX_DISTANCE),
QUOTE(_target distance _caller < MAX_DISTANCE),
{},
{},
{
params ["_object", "_unit", "", "_args"];
_args params ["_title", "_text", "_share", "_delete"];
[
_duration,
[_object, _unit, _title, _text, _share, _delete],
{
(_this select 0) params ["_object", "_unit", "_title", "_text", "_share", "_delete"];

private _targets = switch (_share) do {
case 0: {
call CBA_fnc_players select {side group _x == side _unit}
};
case 1: {
units _unit select {isPlayer _x}
};
case 2: {
[_unit]
};
};
ADD_INTEL_TO_TARGETS;

if (_delete) then {
deleteVehicle _object;
} else {
[_object, 0, ["ACE_MainActions", QGVAR(intelAction)]] call ace_interact_menu_fnc_removeActionFromObject;
};
},
{},
_actionText
] call ace_common_fnc_progressBar;
},
{true},
{},
[_title, _text, _share, _delete, _actionText, _duration]
] call ace_interact_menu_fnc_createAction;

[["\a3\ui_f\data\igui\cfg\simpletasks\types\documents_ca.paa", 1.25], [localize LSTRING(ModuleCreateIntel_IntelFound)], true] call CBA_fnc_notify;
[QGVAR(addIntel), [_title, _text], _targets] call CBA_fnc_targetEvent;
[_object, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
} else {
private _actionID = _object getVariable QGVAR(intelActionID);

if (_delete) then {
deleteVehicle _object;
};
},
{},
[_title, _text, _share, _delete],
_duration,
100,
true,
false
] call BIS_fnc_holdActionAdd;
if (!isNil "_actionID") then {
[_object, _actionID] call BIS_fnc_holdActionRemove;
};

_object setVariable [QGVAR(intelActionID), _actionID];
_actionID = [
_object,
_actionText,
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
QUOTE(_target distance _this < MAX_DISTANCE),
QUOTE(_target distance _caller < MAX_DISTANCE),
{},
{},
{
params ["_object", "_unit", "", "_args"];
_args params ["_title", "_text", "_share", "_delete"];

ADD_INTEL_TO_TARGETS;

if (_delete) then {
deleteVehicle _object;
};
},
{},
[_title, _text, _share, _delete],
_duration,
100,
true,
false
] call BIS_fnc_holdActionAdd;

_object setVariable [QGVAR(intelActionID), _actionID];
};

0 comments on commit e100ec3

Please sign in to comment.