Change ACE_HeadlessClientJoined event to be global and always triggered

This commit is contained in:
jonpas 2016-01-02 14:42:05 +01:00
parent 971d8d1e02
commit 6edd7ab093
2 changed files with 13 additions and 8 deletions

View File

@ -4,13 +4,13 @@
if (hasInterface && !isServer) exitWith {}; if (hasInterface && !isServer) exitWith {};
["SettingsInitialized", { ["SettingsInitialized", {
// Exit if HC transferring disabled
if (!GVAR(Enabled)) exitWith {};
if (isServer) then { if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}]; // Add disconnect EH if HC transferring enabled
if (GVAR(Enabled)) then {
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
};
} else { } else {
// Register HC on server (this part happens on HC only) // Register HC (this part happens on HC only)
["ACE_HeadlessClientJoined", [player]] call EFUNC(common,serverEvent); ["ACE_HeadlessClientJoined", [player]] call EFUNC(common,globalEvent);
}; };
}] call EFUNC(common,addEventHandler); }] call EFUNC(common,addEventHandler);

View File

@ -17,8 +17,13 @@
params ["_headlessClient"]; params ["_headlessClient"];
// Exit if already registered // Delay until settings are initialized (for checking if HC trasnferring is enabled)
if (_headlessClient in GVAR(headlessClients)) exitWith {}; if (!EGVAR(common,settingsInitFinished)) exitWith {
EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(handleConnectHC), _this];
};
// Exit if HC transferring disabled or HC already registered
if (!GVAR(Enabled) || {_headlessClient in GVAR(headlessClients)}) exitWith {};
// Register for use // Register for use
GVAR(headlessClients) pushBack _headlessClient; GVAR(headlessClients) pushBack _headlessClient;