noradio: ace local event for playerChanged

This commit is contained in:
Nicolás Badano 2015-01-16 12:14:40 -03:00
parent 34135ffdd4
commit e1b1edc961

View File

@ -13,13 +13,19 @@ _setupPlayer = {
[_setupPlayer, 0, []] call CBA_fnc_addPerFrameHandler;
[missionNamespace, "playerChanged", {
//On player change, mute old unit and unmute new player
[_this select 0] call EFUNC(common,muteUnit);
(_this select 0) setVariable [QGVAR(isMuted), true, true];
// Mutes/unmutes units when the player changes
["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
if (!((_this select 1) getVariable ["ACE_isUnconscious", false]) && {alive (_this select 1)}) then { //@todo: ACE_isUnconscious???
[_this select 1] call EFUNC(common,unMuteUnit);
// 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);
};
(_this select 1) setVariable [QGVAR(isMuted), false, true];
}] call EFUNC(common,addCustomEventHandler);
_oldPlayer setVariable [QGVAR(isMuted), false, true];
}] call EFUNC(common,addEventhandler);