mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
noradio: ace local event for playerChanged
This commit is contained in:
parent
34135ffdd4
commit
e1b1edc961
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user