ACE3/addons/common/functions/fnc_unhideUnit.sqf
2015-09-20 15:52:40 +02:00

34 lines
815 B
Plaintext

/*
* Author: SilentSpike (based on unmuteUnit)
* Globally unhides a unit. Only unhides if the last reason was removed.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Reason to unhide the unit <STRING>
*
* Return Value:
* None
*
* Example:
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_unhideUnit
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
private "_setHiddenReasons";
_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []];
if (_reason in _setHiddenReasons) then {
_setHiddenReasons deleteAt (_setHiddenReasons find _reason);
_unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true];
};
if (_setHiddenReasons isEqualTo []) then {
["hideObjectGlobal",[_unit,false]] call FUNC(serverEvent);
};