Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10 from acemod/newEvents
Browse files Browse the repository at this point in the history
Update to new CBA event system
  • Loading branch information
PabstMirror committed Jun 9, 2016
2 parents 71f9e40 + 2bc4518 commit 547c3e9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions addons/headless/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// Exit on player clients that are not hosts
if (hasInterface && !isServer) exitWith {};

["SettingsInitialized", {
["ace_settingsInitialized", {
if (isServer) then {
// Add disconnect EH if HC transferring enabled
if (GVAR(Enabled)) then {
addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}];
};
} else {
// Register HC (this part happens on HC only)
["ACE_HeadlessClientJoined", [player]] call ACEFUNC(common,globalEvent);
[QGVAR(headlessClientJoined), [player]] call CBA_fnc_globalEvent;
};
}] call ACEFUNC(common,addEventHandler);
}] call CBA_fnc_addEventHandler;
2 changes: 1 addition & 1 deletion addons/headless/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ADDON = false;
if (isServer) then {
GVAR(headlessClients) = [];
GVAR(inRebalance) = false;
["ACE_HeadlessClientJoined", FUNC(handleConnectHC)] call ACEFUNC(common,addEventHandler);
[QGVAR(headlessClientJoined), FUNC(handleConnectHC)] call CBA_fnc_addEventHandler;
};

ADDON = true;
4 changes: 4 additions & 0 deletions addons/headless/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ class CfgPatches {
#include "ACE_Settings.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"

class ACE_newEvents {
ACE_HeadlessClientJoined = QGVAR(headlessClientJoined);
};
2 changes: 1 addition & 1 deletion addons/headless/functions/fnc_rebalance.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TRACE_3("Rebalance",GVAR(inRebalance),GVAR(headlessClients),_force);
if (GVAR(inRebalance) || {GVAR(headlessClients) isEqualTo []}) exitWith {};

// Transfer after rebalance delay
[FUNC(transferGroups), [_force], GVAR(Delay)] call ACEFUNC(common,waitAndExecute);
[FUNC(transferGroups), [_force], GVAR(Delay)] call CBA_fnc_waitAndExecute;

// Currently in rebalance flag
GVAR(inRebalance) = true;
12 changes: 6 additions & 6 deletions addons/sitting/XEH_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ DFUNC(onInitEvent) = {
["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call ACEFUNC(common,addCanInteractWithCondition);

// Handle interruptions
["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call ACEFUNC(common,addEventhandler);
["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call ACEFUNC(common,addEventhandler);
["ace_unconscious", {_this call DFUNC(handleInterrupt)}] call CBA_fnc_addEventHandler;
["ace_captives_SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call CBA_fnc_addEventHandler;
};

["SettingsInitialized", {
["ace_settingsInitialized", {
call FUNC(onInitEvent);
}] call ACEFUNC(common,addEventHandler);
}] call CBA_fnc_addEventHandler;

["SettingChanged", {
["ace_settingChanged", {
params ["_name", "_value", "_force"];
call FUNC(onInitEvent);
}] call ACEFUNC(common,addEventhandler);
}] call CBA_fnc_addEventHandler;
12 changes: 6 additions & 6 deletions addons/viewrestriction/XEH_clientInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Exit on Headless Client
if !(hasInterface) exitWith {};

["SettingsInitialized", {
["ace_settingsInitialized", {
// Exit if module is disabled
if (GVAR(mode) == 0) exitWith {};

Expand All @@ -24,14 +24,14 @@ if !(hasInterface) exitWith {};
};

// Add Event Handler for changing camera - also happens on spawn
["cameraViewChanged", {
["ace_cameraViewChanged", {
call FUNC(changeCamera);
}] call ACEFUNC(common,addEventHandler);
}] call CBA_fnc_addEventHandler;

// Add Event Hander for exiting and entering a vehicle when on Selective mode
if (GVAR(mode) == 3) then {
["playerVehicleChanged", {
["ace_playerVehicleChanged", {
call FUNC(changeCamera);
}] call ACEFUNC(common,addEventHandler);
}] call CBA_fnc_addEventHandler;
};
}] call ACEFUNC(common,addEventHandler);
}] call CBA_fnc_addEventHandler;

0 comments on commit 547c3e9

Please sign in to comment.