-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn_doLoadout.sqf
33 lines (25 loc) · 1.15 KB
/
fn_doLoadout.sqf
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
#include "component.hpp"
params ["_loadoutHash", "_loadoutTarget"];
if (typeName _loadoutHash != "ARRAY") then {
throw "loadoutHash is not of type array (and thus, no cba hash) :(("
};
private _unitLoadout = [
[], [], [], // weapons
[], [], [], // containers
"", "", // helm, goggles
[], // binos (weap4)
["", "", "", "", "", "" ] // assignedItems
];
private _resetLoadout = [(missionConfigFile >> "Loadouts"), "resetLoadout", 0] call BIS_fnc_returnConfigEntry;
if (_resetLoadout == 0) then {
_unitLoadout = getUnitLoadout _loadoutTarget;
};
if (count _unitLoadout == 0) exitWith {};
_unitLoadout = [_loadoutHash, _unitLoadout] call FUNC(HashToUnitLoadout);
if (_loadoutTarget == player) then {
INFO_1("player loadout: %1", _unitLoadout);
};
_loadoutTarget setVariable [QGVAR(applicationCount), (_loadoutTarget getVariable [QGVAR(applicationCount), 0]) + 1, true];
_loadoutTarget setVariable [QGVAR(lastLoadoutApplicationTime), CBA_missionTime, true];
[_loadoutTarget, [_unitLoadout, true]] remoteExec ["setUnitLoadout", _loadoutTarget, false];
[QGVAR(loadoutApplied), [_loadoutTarget, _unitLoadout], _loadoutTarget] call CBA_fnc_targetEvent;