2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
2015-04-11 13:46:41 +00:00
|
|
|
* Unmutes the unit. Only unmutes if the last reason was removed.
|
2015-01-12 04:02:33 +00:00
|
|
|
*
|
2015-01-11 16:42:31 +00:00
|
|
|
* Argument:
|
|
|
|
* 0: Unit (Object)
|
2015-04-11 13:46:41 +00:00
|
|
|
* 1: Reason to unmute the unit. (String)
|
2015-01-12 04:02:33 +00:00
|
|
|
*
|
2015-01-11 16:42:31 +00:00
|
|
|
* Return value:
|
|
|
|
* Nothing
|
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
PARAMS_2(_unit,_reason);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isNull _unit) exitWith {};
|
|
|
|
|
2015-04-11 13:46:41 +00:00
|
|
|
// remove reason to mute to the unit
|
|
|
|
private "_muteUnitReasons";
|
|
|
|
_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
|
|
|
|
|
|
|
|
if (_reason in _muteUnitReasons) then {
|
|
|
|
_muteUnitReasons deleteAt (_muteUnitReasons find _reason);
|
|
|
|
_unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true];
|
|
|
|
};
|
|
|
|
|
2015-04-11 18:26:43 +00:00
|
|
|
// don't unmute if there is another mute reason!
|
|
|
|
if (count _muteUnitReasons > 0) exitWith {};
|
|
|
|
|
2015-04-11 13:46:41 +00:00
|
|
|
private "_speaker";
|
2015-01-12 04:02:33 +00:00
|
|
|
_speaker = _unit getVariable ["ACE_OriginalSpeaker", ""];
|
2015-04-11 13:46:41 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
if (_speaker == "") exitWith {};
|
|
|
|
|
2015-04-11 13:46:41 +00:00
|
|
|
["setSpeaker", _unit, [_unit, _speaker]] call FUNC(targetEvent);
|