2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-07-03 01:14:58 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike (based on muteUnit)
|
|
|
|
* Globally hides a unit. This allows the handling of more than one reason to hide an object globally.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Reason to hide the unit <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None <NIL>
|
2015-07-03 01:14:58 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit
|
|
|
|
*
|
2015-12-14 12:08:19 +00:00
|
|
|
* Public: Yes
|
2015-07-03 01:14:58 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-18 14:33:53 +00:00
|
|
|
params ["_unit", "_reason"];
|
2015-07-03 01:14:58 +00:00
|
|
|
|
|
|
|
if (isNull _unit) exitWith {};
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
|
2015-07-03 01:14:58 +00:00
|
|
|
|
|
|
|
if !(_reason in _setHiddenReasons) then {
|
|
|
|
_setHiddenReasons pushBack _reason;
|
|
|
|
_unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true];
|
|
|
|
};
|
|
|
|
|
2015-09-18 14:33:53 +00:00
|
|
|
if !(isObjectHidden _unit) then {
|
2016-06-03 19:38:16 +00:00
|
|
|
[QGVAR(hideObjectGlobal), [_unit, true]] call CBA_fnc_serverEvent;
|
2015-09-18 14:33:53 +00:00
|
|
|
};
|