2015-01-16 23:21:47 +00:00
|
|
|
/**
|
|
|
|
* fn_useItem.sqf
|
|
|
|
* @Descr:
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: []
|
|
|
|
* @Return:
|
|
|
|
* @PublicAPI: true
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
PARAMS_2(_unit,_item);
|
2015-05-14 22:12:40 +00:00
|
|
|
|
|
|
|
private ["_return", "_vehicleUsage"];
|
|
|
|
|
2015-01-16 23:21:47 +00:00
|
|
|
_vehicleUsage = [_this, 2, false, [false]] call BIS_fnc_Param;
|
|
|
|
|
2015-01-18 15:31:40 +00:00
|
|
|
_return = false;
|
2015-01-16 23:21:47 +00:00
|
|
|
if (!_vehicleUsage) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
if (_item != "") then {
|
|
|
|
if (_item in (items _unit)) then {
|
|
|
|
_unit removeItem _item;
|
|
|
|
_return = true;
|
|
|
|
} else {
|
|
|
|
if (_item in (assignedItems _unit)) then {
|
|
|
|
_unit unassignItem _item;
|
|
|
|
_unit removeItem _item;
|
|
|
|
_return = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-01-18 15:31:40 +00:00
|
|
|
};
|
|
|
|
// TODO implement shared item functionality for with vehicles.
|
|
|
|
|
|
|
|
_return;
|