57 lines
2.1 KiB
Plaintext
57 lines
2.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Create action to copy map markers on all inheritors of CAManBase
|
|
////////////////////////////////////////////////////////////////////
|
|
private _mapCopyAction =
|
|
[
|
|
QGVAR(actionID),
|
|
"Copy Map",
|
|
"\a3\ui_f\data\igui\cfg\actions\talk_ca.paa",
|
|
{
|
|
params ["_target", "_player", "_params"];
|
|
format["Copying map markers from %1", name _target] call CBA_fnc_notify;
|
|
[QGVAR(mapCopyRequest), _this, _target] call CBA_fnc_targetEvent;
|
|
},
|
|
{
|
|
params ["_target", "_player", "_params"];
|
|
[QGVAR(setting_enable)] call CBA_settings_fnc_get && {
|
|
('ItemMap' in (assignedItems _player)) &&
|
|
('ItemMap' in (assignedItems _target)) &&
|
|
([_player, _target, []] call ace_common_fnc_canInteractWith)
|
|
};
|
|
}
|
|
] call ace_interact_menu_fnc_createAction;
|
|
["CAManBase", 0, ["ACE_MainActions"], _mapCopyAction, true] call ace_interact_menu_fnc_addActionToClass;
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Create CBA event to receive requests
|
|
////////////////////////////////////////////////////////////////////
|
|
[QGVAR(mapCopyRequest), {
|
|
params ["_me", "_requester", "_params"];
|
|
format["Your map is being copied by %1", name _requester] call CBA_fnc_notify;
|
|
private _myMarkers = _this call FUNC(getMapMarkers);
|
|
[QGVAR(mapCopyResponse), [_me, _myMarkers], _requester] call CBA_fnc_targetEvent;
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
// Create CBA event to receive responses
|
|
////////////////////////////////////////////////////////////////////
|
|
[QGVAR(mapCopyResponse), {
|
|
params [["_responder", objNull, [objNull]], ["_markerList", [], [[]]]];
|
|
if ('ItemMap' in (assignedItems player)) then {
|
|
[_markerList] call FUNC(loadMapMarkers);
|
|
format["Copied %1 markers from %2", count _markerList, name _responder] call CBA_fnc_notify;
|
|
} else {
|
|
format["You need a map to copy onto!"] call CBA_fnc_notify;
|
|
};
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
[
|
|
LEVEL_DEBUG,
|
|
QUOTE(COMPONENT),
|
|
"initClient complete",
|
|
[]
|
|
] call EFUNC(common,log);
|
|
|
|
localNamespace setVariable [QGVAR(complete), true]; |