From Savage Game Design Wiki
Revision as of 12:47, 16 September 2019 by vn>Unknown user
Jump to navigation
Jump to search
Description
/*
FILE: fn_whitelisted_arsenal_lbcolor.sqf
DATE: 10-06-2019
AUTHOR: Ethan Johnson
DESCRIPTION:
Color codes loadouts in the arsenal based on the availability of the items inside them.
PARAMETERS:
(0): DISPLAY - Arsenal display that should be used for messages, gui etc.
RETURNS:
NONE
*/
params ["_display"];
if !(ctrlText (_display displayCtrl IDC_RSCDISPLAYARSENAL_TEMPLATE_TITLE) isEqualTo "Load") exitWith {};
private _templatevalues = _display displayCtrl IDC_RSCDISPLAYARSENAL_TEMPLATE_VALUENAME;
private _loadoutdata = profileNamespace getVariable ["bis_fnc_saveInventory_data",[]];
['showMessage',[_display,localize "STR_VN_WA_FEEDBACK_ARSENAL_LOADOUT_BLACKLIST"]] call bis_fnc_arsenal;
private _alloweditems = ([""] + (missionNamespace getVariable ["vn_whitelisted_arsenal_alloweditems",[]]));
for "_i" from 0 to (count _loadoutdata - 1) step 2 do
{
private _name = _loadoutdata select _i;
private _data = _loadoutdata select (_i + 1);
private _allowed = true;
_data params ["_uniformdata","_vestdata","_backpackdata","_headgeardata","_gogglesdata","_binoculardata","_primarydata","_secondarydata","_handgundata","_assigneddata"];
{
private _type = _x;
switch (true) do
{
case (_type isEqualType ""):
{
if !(_type in _alloweditems) then
{
_allowed = false;
};
};
case (_type isEqualType []):
{
{
private _item = _x;
if (_item isEqualType []) then
{
{
if !(_x in _alloweditems) then
{
_allowed = false;
};
} foreach _item;
}
else
{
if !(_item in _alloweditems) then
{
_allowed = false;
};
};
}foreach _type;
};
};
}foreach [_uniformdata,_vestdata,_backpackdata,_headgeardata,_googlesdata,_binoculardata,_primarydata,_secondarydata,_handgundata];
private _color = [[0.867,0.369,0.031,1],[1,1,1,1]] select _allowed;
for "_i" from 0 to (( lnbSize _templatevalues ) select 0 ) - 1 do
{
if (_templatevalues lnbText [ _i, 0 ] isEqualTo _name) then
{
_templatevalues lnbSetColor [[ _i, 0 ], _color];
_templatevalues lbSetValue [_i, 1];
};
};
};
(Placeholder description extracted from the function header by LM_exportFunctionsToWiki.sqf)
Syntax
- Syntax
- [] call VN_fnc_whitelisted_arsenal_lbcolor;
- Return value
- Nothing
Examples
- Example 1
-