ACE3/addons/arsenal/functions/fnc_buttonFavorites.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

33 lines
731 B
Plaintext

#include "..\script_component.hpp"
#include "..\defines.hpp"
/*
* Author: LinkIsGrim
* Switches the arsenal between displaying all items and favorites
*
* Arguments:
* 0: Arsenal display <DISPLAY>
* 1: Button control <CONTROL>
*
* Return Value:
* None
*
* Public: No
*/
params ["_display", "_control"];
private _firstRun = false;
if (isNil QGVAR(favoritesOnly)) then {
GVAR(favoritesOnly) = GVAR(defaultToFavorites);
_firstRun = true;
} else {
GVAR(favoritesOnly) = !GVAR(favoritesOnly);
};
_control ctrlSetText format ["%1: %2", localize "STR_GEAR_ITEMS", localize (["str_word_all", "STR_3DEN_Favorite_textPlural"] select GVAR(favoritesOnly))];
if (_firstRun) exitWith {};
[false] call FUNC(refresh);