FCS - Skip adding firedEH until needed (#6965)

This commit is contained in:
PabstMirror 2019-04-27 14:04:47 -05:00 committed by GitHub
parent 0d7709673a
commit 2cfe7ebd0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -15,13 +15,9 @@ if (!hasInterface) exitWith {};
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
// Register fire event handler
["ace_firedPlayerVehicle", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicleNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
// Register event for global updates // Register event for global updates
[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call CBA_fnc_addEventHandler; [QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call CBA_fnc_addEventHandler;
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
call compile preprocessFileLineNumbers QPATHTOF(functions\dev_debugConfigs.sqf); call compile preprocessFileLineNumbers QPATHTOF(dev\test_debugConfigs.sqf);
#endif #endif

View File

@ -21,6 +21,13 @@ params ["_vehicle"];
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath);
if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then { if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then {
if (missionNamespace getVariable [QGVAR(needToAddFiredEH), true]) then {
["ace_firedPlayerVehicle", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
["ace_firedPlayerVehicleNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
GVAR(needToAddFiredEH) = false;
TRACE_1("Registered fired event handlers for all vehicles",GVAR(needToAddFiredEH));
};
_vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true];
_vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true]; _vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true];
_vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true]; _vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true];