ACE3/addons/cargo/functions/fnc_canUnloadItem.sqf

31 lines
734 B
Plaintext
Raw Normal View History

2015-08-10 21:07:47 +00:00
/*
* Author: Glowbal, ViperMaul
2015-08-16 20:41:35 +00:00
* Check if item can be unloaded.
2015-08-10 21:07:47 +00:00
*
* Arguments:
2015-08-16 20:41:35 +00:00
* 0: loaded Object <OBJECT>
2015-08-10 21:07:47 +00:00
* 1: Object <OBJECT>
2016-01-27 00:01:01 +00:00
* 2: Unloader (player) <OPTIONAL><OBJECT>
2015-08-10 21:07:47 +00:00
*
2016-06-18 09:50:41 +00:00
* Return Value:
2015-08-10 21:07:47 +00:00
* Can be unloaded <BOOL>
*
2015-08-16 20:41:35 +00:00
* Example:
* [item, holder] call ace_cargo_fnc_canUnloadItem
*
2015-08-10 21:07:47 +00:00
* Public: No
*/
#include "script_component.hpp"
2016-01-27 00:01:01 +00:00
params ["_item", "_vehicle", ["_unloader", objNull]];
2016-01-19 03:53:48 +00:00
TRACE_2("params",_item,_vehicle);
2015-08-16 20:41:35 +00:00
2016-01-19 03:53:48 +00:00
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
2015-08-16 20:41:35 +00:00
if !(_item in _loaded) exitWith {false};
2015-08-10 21:07:47 +00:00
2016-01-19 03:53:48 +00:00
private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item};
2016-01-27 00:01:01 +00:00
private _emptyPos = [_vehicle, _itemClass, _unloader] call EFUNC(common,findUnloadPosition);
2015-08-10 21:07:47 +00:00
2016-01-27 00:01:01 +00:00
(count _emptyPos) == 3