2015-09-19 18:17:38 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Send a request to an unit and execute code based upon results.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-19 18:17:38 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: caller <OBJECT>
|
|
|
|
* 1: target <OBJECT>
|
2017-06-08 13:31:51 +00:00
|
|
|
* 2: requestID <STRING>
|
|
|
|
* 3: requestMessage Will be localized for other target object. <STRING>
|
|
|
|
* 4: callback Code called upon accept or decline. <CODE>
|
2015-09-19 18:17:38 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, kevin, "ID", "Message", {callback}] call ace_common_fnc_sendRequest
|
|
|
|
*
|
2015-09-19 18:17:38 +00:00
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-19 18:17:38 +00:00
|
|
|
params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
if (isPlayer _target) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
// Pass request on to target locality for player accept/decline.
|
2016-06-03 00:59:18 +00:00
|
|
|
[QGVAR(receiveRequest), [_caller, _target, _requestID, _requestMessage, _callBack], _target] call CBA_fnc_targetEvent;
|
2015-01-16 23:21:47 +00:00
|
|
|
} else {
|
2015-01-18 19:09:19 +00:00
|
|
|
// accept it, since it's an AI.
|
|
|
|
[_caller, _target, true] call compile _callBack;
|
2015-01-16 23:21:47 +00:00
|
|
|
};
|