ACE3/addons/backpacks/functions/fnc_onOpenInventory.sqf

31 lines
739 B
Plaintext
Raw Normal View History

2015-01-18 06:56:09 +00:00
/*
* Author: commy2
2015-01-18 06:56:09 +00:00
*
* Handle the open inventory event. Display message on traget client.
2015-01-18 06:56:09 +00:00
*
* Argument:
* Input from "InventoryOpened" eventhandler
*
* Return value:
* false. Always open the inventory dialog. (Bool)
2015-01-18 06:56:09 +00:00
*/
#include "script_component.hpp"
private ["_unit", "_backpack"];
2015-01-18 06:56:09 +00:00
_unit = _this select 0;
_backpack = _this select 1;
2015-01-18 06:56:09 +00:00
// exit if the target is not a backpack
if !([_backpack] call FUNC(isBackpack)) exitWith {};
2015-01-18 06:56:09 +00:00
// get the unit that wears the backpack object
private "_target";
_target = [_backpack] call FUNC(getBackpackAssignedUnit);
2015-01-18 06:56:09 +00:00
// raise event on target unit
["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent);
2015-01-18 06:56:09 +00:00
// return false to open inventory as usual
false