mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
showHud handler
This commit is contained in:
parent
cb65a67a3e
commit
bec884e581
@ -165,6 +165,7 @@ PREP(setVariableJIP);
|
||||
PREP(setVariablePublic);
|
||||
PREP(setVolume);
|
||||
PREP(sortAlphabeticallyBy);
|
||||
PREP(showHud);
|
||||
PREP(stringCompare);
|
||||
PREP(stringToColoredText);
|
||||
PREP(stringRemoveWhiteSpace);
|
||||
@ -288,6 +289,7 @@ PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
GVAR(syncedEvents) = HASH_CREATE;
|
||||
GVAR(showHudHash) = [] call FUNC(hashCreate);
|
||||
|
||||
//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute
|
||||
GVAR(waitAndExecArray) = [];
|
||||
|
58
addons/common/functions/fnc_showHud.sqf
Normal file
58
addons/common/functions/fnc_showHud.sqf
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Allows multiple sources to not overwrite showHud command
|
||||
* Bitwise AND Logic (a single false in a mask will make it false)
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Source ID <STRING><OPTIONAL>
|
||||
* 1: Show Hud Bool Array (8 to set, empty to remove) <ARRAY><OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* Resulting ShowHud Array <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* ["hideHud", [false, true, true, true, true, true, true, false]] call ace_common_fnc_showHud; //This is equivalent to the old showHud false
|
||||
* [] call ace_common_fnc_showHud
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitWith {[-1]};
|
||||
|
||||
params [["_reason", "", [""]], ["_mask", [], [[]], [0,8]]];
|
||||
|
||||
if (isArray (missionConfigFile >> "showHUD")) then {
|
||||
//(showHud = 0;) is fine - the array is the problem
|
||||
ACE_LOGWARNING("showHUD[] in Description.ext breaks the showHud command");
|
||||
};
|
||||
|
||||
if (_reason != "") then {
|
||||
_reason = toLower _reason;
|
||||
if (_mask isEqualTo []) then {
|
||||
TRACE_2("Setting", _reason, _mask);
|
||||
[GVAR(showHudHash), _reason] call FUNC(hashRem);
|
||||
} else {
|
||||
TRACE_2("Removing", _reason, _mask);
|
||||
[GVAR(showHudHash), _reason, _mask] call FUNC(hashSet);
|
||||
};
|
||||
};
|
||||
|
||||
GVAR(showHudHash) params ["_reasons", "_masks"];
|
||||
local _resultMask = [];
|
||||
|
||||
for "_index" from 0 to 7 do {
|
||||
local _set = true; //Default to true
|
||||
{
|
||||
if (!(_x select _index)) exitWith {
|
||||
_set = false; //Any false will make it false
|
||||
};
|
||||
} forEach _masks;
|
||||
_resultMask pushBack _set;
|
||||
};
|
||||
|
||||
TRACE_2("showHud", _resultMask, _reasons);
|
||||
showHud _resultMask;
|
||||
|
||||
_resultMask
|
Loading…
Reference in New Issue
Block a user