Merge pull request #4289 from acemod/earlyAddPlayerEventHandler

Fix null ace_player from early call to addPlayerEH
This commit is contained in:
Glowbal 2016-08-27 10:32:12 +02:00 committed by GitHub
commit 1366a6f15f
2 changed files with 12 additions and 0 deletions

View File

@ -295,6 +295,13 @@ enableCamShake true;
// Set up numerous eventhanders for player controlled units
//////////////////////////////////////////////////
// It is possible that CBA_fnc_addPlayerEventHandler has allready been called and run
// We will NOT get any events for the initial state, so manually set ACE_player
if (!isNull (missionNamespace getVariable ["cba_events_oldUnit", objNull])) then {
INFO("CBA_fnc_addPlayerEventHandler has already run - manually setting ace_player");
ACE_player = cba_events_oldUnit;
};
// "playerChanged" event
["unit", {
ACE_player = (_this select 0);

View File

@ -10,6 +10,11 @@ if (isServer) then {
if (!hasInterface) exitWith {};
// Handle early CBA_fnc_addPlayerEventHandler
if (!isNull ace_player) then {
[ace_player, "isPlayer"] call EFUNC(common,muteUnit);
};
// mutes/unmutes units when the player changes
["unit", {
params ["_newPlayer", "_oldPlayer"];