mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #4289 from acemod/earlyAddPlayerEventHandler
Fix null ace_player from early call to addPlayerEH
This commit is contained in:
commit
1366a6f15f
@ -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);
|
||||
|
@ -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"];
|
||||
|
Loading…
Reference in New Issue
Block a user