-
Notifications
You must be signed in to change notification settings - Fork 749
Expand file tree
/
Copy pathfnc_toGunbagCallback.sqf
More file actions
42 lines (33 loc) · 976 Bytes
/
fnc_toGunbagCallback.sqf
File metadata and controls
42 lines (33 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "..\script_component.hpp"
/*
* Author: Ir0n1E
* Put weapon into gunbag.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject] call ace_gunbag_fnc_toGunbagCallback
*
* Public: No
*/
params ["_unit", "_target"];
// Set up current weapon for storing
private _gunbag = backpackContainer _target;
private _items = (getUnitLoadout _unit) select 0;
private _magazines = _items select [4, 2];
_items deleteRange [4, 2];
private _weapon = _items deleteAt 0;
private _mass = [_weapon, _items, _magazines apply {_x select 0}] call FUNC(calculateMass);
_unit removeWeapon _weapon;
// Add virtual load
[_target, _gunbag, _mass] call EFUNC(movement,addLoadToUnitContainer);
_gunbag setVariable [QGVAR(gunbagWeapon), [_weapon, _items, _magazines], true];
// Play sound
if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then {
[_target, _gunbag] call EFUNC(backpacks,backpackOpened);
};