mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
initial commit
This commit is contained in:
parent
5a5a1fd66a
commit
9cf44b1d32
@ -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];
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user