2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2016-05-03 08:21:21 +00:00
|
|
|
/*
|
|
|
|
* Author: Ir0n1E
|
2019-06-05 01:00:55 +00:00
|
|
|
* Check if client is able to interact with gunbag.
|
2016-05-03 08:21:21 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Target <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2020-06-19 15:35:19 +00:00
|
|
|
* -1: can't interact 0: empty gunbag 1: full gunbag 2: full gunbag & has primary <NUMBER>
|
2016-05-03 08:21:21 +00:00
|
|
|
*
|
2016-06-12 21:56:00 +00:00
|
|
|
* Example:
|
|
|
|
* _canInteract = [player, target] call ace_gunbag_fnc_canInteract
|
|
|
|
*
|
2016-05-03 08:21:21 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2016-06-12 11:51:23 +00:00
|
|
|
params ["_unit", "_target"];
|
2016-05-03 08:21:21 +00:00
|
|
|
|
2016-06-12 11:51:23 +00:00
|
|
|
private _result = -1;
|
|
|
|
private _gunbag = backpackContainer _target;
|
2016-07-07 07:44:29 +00:00
|
|
|
private _weapon = primaryWeapon _unit;
|
2016-05-03 08:21:21 +00:00
|
|
|
|
2016-07-07 07:44:29 +00:00
|
|
|
if ((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo [] && {_weapon != ""} && {!(_weapon call FUNC(isMachineGun))}) then {
|
2016-05-17 09:21:48 +00:00
|
|
|
_result = 0;
|
2016-05-03 08:21:21 +00:00
|
|
|
};
|
|
|
|
|
2021-02-27 17:05:05 +00:00
|
|
|
if ((_gunbag getVariable [QGVAR(gunbagWeapon), []] isNotEqualTo []) && {_weapon == ""}) then {
|
2016-05-17 09:21:48 +00:00
|
|
|
_result = 1;
|
2016-05-03 08:21:21 +00:00
|
|
|
};
|
2021-02-27 17:05:05 +00:00
|
|
|
if ((_gunbag getVariable [QGVAR(gunbagWeapon), []] isNotEqualTo []) && {_weapon != ""}) then {
|
2020-06-19 15:35:19 +00:00
|
|
|
_result = 2;
|
|
|
|
};
|
2016-05-03 08:21:21 +00:00
|
|
|
_result
|