client/addons/arsenal/functions/fnc_addArmoryItem.sqf
Jacob Schmidt c6daf95415
All checks were successful
Build / Build (push) Successful in 53s
Initial Repo Setup
2025-01-01 14:35:12 -06:00

30 lines
835 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Adds item to player's armory unlocks and updates virtual arsenal
*/
params [["_class","",[""]],["_type",0,[0]]];
private _default = [[],[],[],[]];
private _armory_unlocks = GETVAR(player,Armory_Unlocks,_default);
private _index = (_armory_unlocks select _type) pushBackUnique _class;
if (_index > -1) then {
SETVAR(player,Armory_Unlocks,_armory_unlocks);
if (GVAR(armory_type) == 0) then {
[GVAR(gear_box),[_class],false,true,1,_type] call BFUNC(addVirtualItemCargo);
} else {
[GVAR(gear_box),[_class]] call AFUNC(arsenal,addVirtualItems);
};
["armory",_armory_unlocks] call FUNC(updateUnlocks);
["armory"] call FUNC(saveUnlocks);
TRACE_2("Item added to armory",_class,_type);
true
} else {
false
};