2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-18 06:56:09 +00:00
|
|
|
/*
|
2015-03-10 16:18:21 +00:00
|
|
|
* Author: commy2
|
2015-09-26 18:29:08 +00:00
|
|
|
* Handle the open inventory event. Camshake and sound on target client.
|
2015-01-18 06:56:09 +00:00
|
|
|
*
|
2015-09-26 18:29:08 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Backpack <OBJECT>
|
2015-08-04 23:12:55 +00:00
|
|
|
*
|
2015-09-26 18:29:08 +00:00
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* false. Always open the inventory dialog. <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [bob, backpack] call ace_backpacks_fnc_onOpenInventory
|
2015-09-26 18:29:08 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-18 06:56:09 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-26 18:29:08 +00:00
|
|
|
params ["_unit", "_backpack"];
|
2015-01-18 06:56:09 +00:00
|
|
|
|
2015-08-30 08:45:14 +00:00
|
|
|
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
|
2016-01-06 21:42:02 +00:00
|
|
|
if !(_backpack call FUNC(isBackpack)) exitWith {false};
|
2015-01-18 06:56:09 +00:00
|
|
|
|
2015-03-10 16:18:21 +00:00
|
|
|
// get the unit that wears the backpack object
|
2016-01-06 21:42:02 +00:00
|
|
|
private _target = objectParent _backpack;
|
2015-01-18 06:56:09 +00:00
|
|
|
|
2015-08-04 23:12:55 +00:00
|
|
|
if (isNull _target) exitWith {false};
|
2015-08-30 08:45:14 +00:00
|
|
|
|
2015-03-10 16:18:21 +00:00
|
|
|
// raise event on target unit
|
2016-05-24 13:13:11 +00:00
|
|
|
["ace_backpackOpened", [_target, _backpack], _target] call CBA_fnc_targetEvent;
|
2015-01-18 06:56:09 +00:00
|
|
|
|
2015-03-10 16:18:21 +00:00
|
|
|
// return false to open inventory as usual
|
|
|
|
false
|