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