initial commit

This commit is contained in:
commy2 2015-04-11 15:46:41 +02:00
parent 5a5a1fd66a
commit 9cf44b1d32
2 changed files with 31 additions and 5 deletions

View File

@ -5,21 +5,34 @@
*
* Argument:
* 0: Unit (Object)
* 1: Reason to mute the unit (String)
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
private ["_unit", "_speaker"];
private ["_unit", "_reason"];
_unit = _this select 0;
_reason = _this select 1;
if (isNull _unit) exitWith {};
// 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";
_speaker = speaker _unit;
if (_speaker == "ACE_NoVoice") exitWith {};
[0, "{(_this select 1) setSpeaker 'ACE_NoVoice'}", _unit, "ACE_Speaker"] call FUNC(execPersistentFnc);
["setSpeaker", _unit, [_unit, "ACE_NoVoice"]] call FUNC(targetEvent);
_unit setVariable ["ACE_OriginalSpeaker", _speaker, true];

View File

@ -1,23 +1,36 @@
/*
* Author: commy2
*
* Unmutes the unit.
* Unmutes the unit. Only unmutes if the last reason was removed.
*
* Argument:
* 0: Unit (Object)
* 1: Reason to unmute the unit. (String)
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
private ["_unit", "_speaker"];
private ["_unit", "_reason"];
_unit = _this select 0;
_reason = _this select 1;
if (isNull _unit) exitWith {};
// 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];
};
private "_speaker";
_speaker = _unit getVariable ["ACE_OriginalSpeaker", ""];
if (_speaker == "") exitWith {};
[0, format ["{(_this select 1) setSpeaker '%1'}", _speaker], _unit, "ACE_Speaker"] call FUNC(execPersistentFnc);
["setSpeaker", _unit, [_unit, _speaker]] call FUNC(targetEvent);