mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
59af3e1f6d
* medical_treatment * advanced_throwing * common, csw * Update fnc_replaceRegisteredItems.sqf * Sanitised numerous components * Update XEH_postInit.sqf * Update XEH_postInit.sqf * FUNC -> LINKFUNC * Changed tagging hashmap * Reverted some changes * Reverted some changes * Update XEH_clientInit.sqf * Tweaks and fixes * Fix number replacements * Minor cleanup * Update fnc_getMagazineName.sqf * Update fnc_getMagazineName.sqf * Minor improvement * Made factions case-sensitive and added `toLowerANSI` to be safe * Update fnc_getDetectedObject.sqf * Update addons/common/functions/fnc_actionKeysNamesConverted.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Throw error if item doesn't exist --------- Co-authored-by: Salluci <69561145+Salluci@users.noreply.github.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
68 lines
1.7 KiB
Plaintext
68 lines
1.7 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: Jonpas
|
|
* Setter for toggling advanced element visibility.
|
|
*
|
|
* Arguments:
|
|
* 0: Source <STRING>
|
|
* 1: Set/Unset <BOOL>
|
|
* 2: Element Name <STRING>
|
|
* 3: Show/Hide Element <BOOL> (default: false)
|
|
*
|
|
* Return Value:
|
|
* Successfully Modified <BOOL>
|
|
*
|
|
* Example:
|
|
* _successfullyModified = ["ace_reload", true, "ammoCount", false] call ace_ui_fnc_setElementVisibility
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params [
|
|
["_source", "", [""]],
|
|
["_set", true, [true]],
|
|
["_element", "", [""]],
|
|
["_show", false, [true]]
|
|
];
|
|
|
|
if (_source == "" || {_element == ""}) exitWith {
|
|
WARNING("Source or Element may not be empty strings!");
|
|
};
|
|
|
|
_element = toLowerANSI _element;
|
|
|
|
// Verify element is bound
|
|
if !(_element in GVAR(configCache)) exitWith {
|
|
WARNING_2("Element '%1' does not exist - modification by '%2' failed.",_element,_source);
|
|
};
|
|
|
|
private _setElement = GVAR(elementsSet) get _element;
|
|
private _return = false;
|
|
|
|
if (isNil "_setElement") then {
|
|
TRACE_3("Setting element",_source,_element,_show);
|
|
private _success = [_element, _show, false, true] call FUNC(setAdvancedElement);
|
|
|
|
if (_success) then {
|
|
GVAR(elementsSet) set [_element, [_source, _show]];
|
|
_return = true;
|
|
};
|
|
} else {
|
|
_setElement params ["_sourceSet"];
|
|
|
|
if (_set) then {
|
|
if (GVAR(interfaceInitialized)) then {
|
|
WARNING_3("Element '%1' already set by '%2' - modification by '%3' failed.",_element,_sourceSet,_source);
|
|
};
|
|
} else {
|
|
TRACE_3("Unsetting element",_sourceSet,_element,_show);
|
|
GVAR(elementsSet) set [_element, nil];
|
|
|
|
[_element, _show, false, true] call FUNC(setAdvancedElement);
|
|
_return = true;
|
|
};
|
|
};
|
|
|
|
TRACE_2("Visibility set",_element,_return);
|
|
_return
|