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;
|
[_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);
|
||||||
|
Loading…
Reference in New Issue
Block a user