2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-06-12 11:51:23 +00:00
|
|
|
/*
|
|
|
|
* Author: Ir0n1E
|
2016-06-12 21:56:00 +00:00
|
|
|
* Put weapon into gunbag.
|
2016-06-12 11:51:23 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Target <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2016-06-12 21:56:00 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2024-06-05 13:22:19 +00:00
|
|
|
* [player, cursorObject] call ace_gunbag_fnc_toGunbagCallback
|
2016-06-12 11:51:23 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit", "_target"];
|
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
// Set up current weapon for storing
|
2016-06-12 11:51:23 +00:00
|
|
|
private _gunbag = backpackContainer _target;
|
2024-06-05 13:22:19 +00:00
|
|
|
private _items = (getUnitLoadout _unit) select 0;
|
2016-06-12 11:51:23 +00:00
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
private _magazines = _items select [4, 2];
|
|
|
|
_items deleteRange [4, 2];
|
2016-06-12 11:51:23 +00:00
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
private _weapon = _items deleteAt 0;
|
2016-06-12 11:51:23 +00:00
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
private _mass = [_weapon, _items, _magazines apply {_x select 0}] call FUNC(calculateMass);
|
2016-06-12 11:51:23 +00:00
|
|
|
|
|
|
|
_unit removeWeapon _weapon;
|
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
// Add virtual load
|
2016-06-12 11:51:23 +00:00
|
|
|
[_target, _gunbag, _mass] call EFUNC(movement,addLoadToUnitContainer);
|
2024-06-05 13:22:19 +00:00
|
|
|
|
2016-06-12 11:51:23 +00:00
|
|
|
_gunbag setVariable [QGVAR(gunbagWeapon), [_weapon, _items, _magazines], true];
|
|
|
|
|
2024-06-05 13:22:19 +00:00
|
|
|
// Play sound
|
2016-06-12 22:03:33 +00:00
|
|
|
if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then {
|
2016-06-12 11:51:23 +00:00
|
|
|
[_target, _gunbag] call EFUNC(backpacks,backpackOpened);
|
|
|
|
};
|