From 7480ae377dc19e0ce74c76479fe6c41e3eee7a8c Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:27:04 +0200 Subject: [PATCH] Scopes - Stop changing CBA setting value directly (#9954) Update XEH_postInit.sqf --- addons/scopes/XEH_postInit.sqf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 4ce8d6d11c..997fe8d6dd 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -19,11 +19,13 @@ GVAR(canAdjustWindage) = [false, false, false]; GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]]; ["CBA_settingsInitialized", { - if (!GVAR(enabled)) exitWith {}; - if (GVAR(deduceBarometricPressureFromTerrainAltitude)) then { - GVAR(zeroReferenceBarometricPressure) = 1013.25 * (1 - (0.0065 * EGVAR(common,mapAltitude)) / 288.15) ^ 5.255754495; + // Overwrite setting if automatic pressure deduction is wanted + if (isServer && GVAR(deduceBarometricPressureFromTerrainAltitude)) then { + private _referencePressure = 1013.25 * (1 - (0.0065 * EGVAR(common,mapAltitude)) / 288.15) ^ 5.255754495; + + [QGVAR(zeroReferenceBarometricPressure), _referencePressure, 2, "server"] call CBA_settings_fnc_set; }; // Check inventory when it changes @@ -47,5 +49,4 @@ GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]]; // Register fire event handler ["ace_firedPlayer", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler; ["ace_firedPlayerNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler; - }] call CBA_fnc_addEventHandler;