2015-07-03 01:14:58 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike (based on unmuteUnit)
|
2015-09-17 16:25:02 +00:00
|
|
|
*
|
2015-07-03 01:14:58 +00:00
|
|
|
* 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:
|
2015-09-17 16:25:02 +00:00
|
|
|
* None
|
2015-07-03 01:14:58 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_Player, "SpectatorMode"] call ace_common_fnc_unhideUnit
|
|
|
|
*
|
2015-09-17 16:25:02 +00:00
|
|
|
* Public: Yes
|
2015-07-03 01:14:58 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-17 16:25:02 +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 deleteAt (_setHiddenReasons find _reason);
|
|
|
|
_unit setVariable [QGVAR(setHiddenReasons), _setHiddenReasons, true];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_setHiddenReasons isEqualTo []) then {
|
|
|
|
["hideObjectGlobal",[_unit,false]] call FUNC(serverEvent);
|
|
|
|
};
|