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 {};
["SettingsInitialized", {
// Exit if HC transferring disabled
if (!GVAR(Enabled)) exitWith {};
if (isServer) then {
// Add disconnect EH if HC transferring enabled
if (GVAR(Enabled)) then {
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
};
} else {
// Register HC on server (this part happens on HC only)
["ACE_HeadlessClientJoined", [player]] call EFUNC(common,serverEvent);
// Register HC (this part happens on HC only)
["ACE_HeadlessClientJoined", [player]] call EFUNC(common,globalEvent);
};
}] call EFUNC(common,addEventHandler);

View File

@ -17,8 +17,13 @@
params ["_headlessClient"];
// Exit if already registered
if (_headlessClient in GVAR(headlessClients)) exitWith {};
// Delay until settings are initialized (for checking if HC trasnferring is enabled)
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
GVAR(headlessClients) pushBack _headlessClient;