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:
|
|
|
|
* nil
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-18 14:33:53 +00:00
|
|
|
params ["_unit", "_reason"];
|
2015-07-03 01:14:58 +00:00
|
|
|
|
|
|
|
if (isNull _unit) exitWith {};
|
|
|
|
|
|
|
|
private "_setHiddenReasons";
|
|
|
|
_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
|
|
|
|
|
|
|
|
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 {
|
|
|
|
["hideObjectGlobal", [_unit, true]] call FUNC(serverEvent);
|
|
|
|
};
|