ACE3/addons/common/functions/fnc_showHud.sqf
PabstMirror 46c041e6bc Merge branch 'rearm_supply' of https://github.com/GitHawk/ACE3 into GitHawk-rearm_supply
Conflicts:
	addons/attach/functions/fnc_getChildrenAttachActions.sqf
	addons/common/functions/fnc_dumpArray.sqf
	addons/common/functions/fnc_removeAllEventHandlers.sqf
	addons/common/functions/fnc_removeEventHandler.sqf
	addons/common/functions/fnc_serverEvent.sqf
	addons/common/functions/fnc_waitUntilAndExecute.sqf
	addons/explosives/functions/fnc_scriptedExplosive.sqf
	addons/finger/config.cpp
	addons/frag/config.cpp
	addons/interact_menu/functions/fnc_handlePlayerChanged.sqf
	addons/laser/functions/fnc_laserOn.sqf
	addons/laser/functions/fnc_seekerFindLaserSpot.sqf
	addons/laser/functions/fnc_unitTurretCanLockLaser.sqf
	addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf
	addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf
	addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf
	addons/main/config.cpp
	addons/main/script_mod.hpp
	addons/map/functions/fnc_flashlightGlow.sqf
	addons/maptools/functions/fnc_addLineMarker.sqf
	addons/maptools/functions/fnc_canDraw.sqf
	addons/maptools/functions/fnc_cancelDrawing.sqf
	addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf
	addons/maptools/functions/fnc_copyMapRemoteSend.sqf
	addons/maptools/functions/fnc_copyMapStart.sqf
	addons/maptools/functions/fnc_handleKeyDown.sqf
	addons/maptools/functions/fnc_handleMouseZChanged.sqf
	addons/maptools/functions/fnc_removeLineMarker.sqf
	addons/maptools/functions/fnc_updateLineMarker.sqf
	addons/missileguidance/functions/fnc_checkLos.sqf
	addons/missileguidance/functions/fnc_checkSeekerAngle.sqf
	addons/overheating/CfgWeapons.hpp
	addons/overheating/functions/fnc_swapBarrelCallback.sqf
	addons/rearm/XEH_postInit.sqf
	addons/rearm/XEH_respawn.sqf
	addons/rearm/functions/fnc_canRearm.sqf
	addons/rearm/functions/fnc_dropAmmo.sqf
	addons/rearm/functions/fnc_getMaxMagazines.sqf
	addons/rearm/functions/fnc_grabAmmo.sqf
	addons/rearm/functions/fnc_pickUpAmmo.sqf
	addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf
	addons/rearm/functions/fnc_rearmEntireVehicleSuccessLocal.sqf
	addons/rearm/functions/fnc_rearmSuccess.sqf
	addons/rearm/functions/fnc_rearmSuccessLocal.sqf
	addons/rearm/functions/fnc_storeAmmo.sqf
	addons/repair/functions/fnc_useItem.sqf
	addons/tagging/CfgVehicles.hpp
	addons/ui/ACE_UI.hpp
	optionals/tracers/config.cpp
2017-05-17 18:21:11 -05:00

67 lines
2.2 KiB
Plaintext

/*
* 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)
* - [hud, info, radar, compass, direction, menu, group, cursors]
* - hud: Boolean - show scripted HUD (same as normal showHUD true/false)
* - info: Boolean - show vehicle + soldier info (hides weapon info from the HUD as well)
* - radar: Boolean - show vehicle radar
* - compass: Boolean - show vehicle compass
* - direction: Boolean - show tank direction indicator (not present in vanilla Arma 3)
* - menu: Boolean - show commanding menu (hides HC related menus)
* - group: Boolean - show group info bar (hides squad leader info bar)
* - cursors: Boolean - show HUD weapon cursors (connected with scripted HUD)
*
* 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; //sets `showHud` and returns the result array used
*
* Public: Yes
*/
#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
WARNING("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 CBA_fnc_hashRem;
} else {
TRACE_2("Removing", _reason, _mask);
[GVAR(showHudHash), _reason, _mask] call CBA_fnc_hashSet;
};
};
GVAR(showHudHash) params ["", "_reasons", "_masks"];
private _resultMask = [];
for "_index" from 0 to 7 do {
private _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