2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
*
|
|
|
|
* Mutes the unit. It won't trigger auto generated chat messages either.
|
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 mute 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-04-11 13:46:41 +00:00
|
|
|
private ["_unit", "_reason"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_unit = _this select 0;
|
2015-04-11 13:46:41 +00:00
|
|
|
_reason = _this select 1;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isNull _unit) exitWith {};
|
|
|
|
|
2015-04-11 13:46:41 +00:00
|
|
|
// add reason to mute to the unit
|
|
|
|
private "_muteUnitReasons";
|
|
|
|
_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
|
|
|
|
|
|
|
|
if !(_reason in _muteUnitReasons) then {
|
|
|
|
_muteUnitReasons pushBack _reason;
|
|
|
|
_unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true];
|
|
|
|
};
|
|
|
|
|
|
|
|
private "_speaker";
|
2015-01-11 16:42:31 +00:00
|
|
|
_speaker = speaker _unit;
|
2015-04-11 13:46:41 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
if (_speaker == "ACE_NoVoice") exitWith {};
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-04-12 09:17:58 +00:00
|
|
|
["setSpeaker", [_unit, "ACE_NoVoice"]] call FUNC(globalEvent);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_unit setVariable ["ACE_OriginalSpeaker", _speaker, true];
|