2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-09-20 13:52:40 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Use item
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-20 13:52:40 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: unit <OBJECT>
|
|
|
|
* 1: item <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* if item has been used. <BOOL>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, "gun"] call ace_common_fnc_useItem
|
|
|
|
*
|
2015-09-20 13:52:40 +00:00
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-20 13:52:40 +00:00
|
|
|
params ["_unit", "_item", ["_vehicleUsage", false]];
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _return = false;
|
2015-09-20 13:52:40 +00:00
|
|
|
|
|
|
|
if !(_vehicleUsage) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
if (_item != "") then {
|
2018-09-17 19:03:28 +00:00
|
|
|
if (_item in (_unit call EFUNC(common,uniqueItems))) then {
|
2015-01-18 19:09:19 +00:00
|
|
|
_unit removeItem _item;
|
|
|
|
_return = true;
|
|
|
|
} else {
|
2015-09-20 13:52:40 +00:00
|
|
|
if (_item in assignedItems _unit) then {
|
|
|
|
_unit unlinkItem _item;
|
2015-01-18 19:09:19 +00:00
|
|
|
_return = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-09-20 13:52:40 +00:00
|
|
|
//} else {
|
|
|
|
// @todo implement shared item functionality for with vehicles.
|
2015-01-18 15:31:40 +00:00
|
|
|
};
|
|
|
|
|
2015-09-20 13:52:40 +00:00
|
|
|
_return
|