2015-01-11 16:42:31 +00:00
|
|
|
// by commy2
|
|
|
|
|
2015-01-14 03:04:25 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-14 03:36:53 +00:00
|
|
|
_setupPlayer = {
|
|
|
|
if (!isNull ACE_player) then {
|
|
|
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-14 03:36:53 +00:00
|
|
|
[ACE_player] call EFUNC(common,muteUnit);
|
|
|
|
ACE_player setVariable [QGVAR(isMuted), true, true];
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-14 03:36:53 +00:00
|
|
|
[_setupPlayer, 0, []] call CBA_fnc_addPerFrameHandler;
|
|
|
|
|
2015-01-16 15:14:40 +00:00
|
|
|
// Mutes/unmutes units when the player changes
|
|
|
|
["playerChanged", {
|
|
|
|
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-16 15:14:40 +00:00
|
|
|
// On player change mute the new player
|
|
|
|
[_newPlayer] call EFUNC(common,muteUnit);
|
|
|
|
_newPlayer setVariable [QGVAR(isMuted), true, true];
|
|
|
|
|
|
|
|
// Unmute the old player
|
|
|
|
//@todo: sort interaction with medical system
|
|
|
|
if (!(_oldPlayer getVariable ["ACE_isUnconscious", false]) && {alive _oldPlayer}) then {
|
|
|
|
[_oldPlayer] call EFUNC(common,unMuteUnit);
|
2015-01-14 03:17:34 +00:00
|
|
|
};
|
2015-01-16 15:14:40 +00:00
|
|
|
_oldPlayer setVariable [QGVAR(isMuted), false, true];
|
|
|
|
|
|
|
|
}] call EFUNC(common,addEventhandler);
|