mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleanup - partly merged #4658
* Removed getVariable QGVAR(Adjustment) boilerplate * Less calls to setVariablePublic * Removed vanilla zeroing element hiding (fixes warning in log file) * Moved settings evaluation into ace_settingsInitialized event handler
This commit is contained in:
parent
10cc0ba951
commit
7fa73744e9
@ -16,122 +16,132 @@ GVAR(canAdjustWindage) = [false, false, false];
|
|||||||
GVAR(boreHeight) = [0, 0, 0];
|
GVAR(boreHeight) = [0, 0, 0];
|
||||||
GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]];
|
GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]];
|
||||||
|
|
||||||
// Check inventory when it changes
|
["ace_settingsInitialized", {
|
||||||
["loadout", FUNC(inventoryCheck)] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
|
||||||
// Instantly hide knobs when scoping in
|
if (!GVAR(enabled)) exitWith {};
|
||||||
["cameraView", {
|
|
||||||
params ["_player", "_newCameraView"];
|
if (GVAR(deduceBarometricPressureFromTerrainAltitude)) then {
|
||||||
|
GVAR(zeroReferenceBarometricPressure) = 1013.25 * (1 - (0.0065 * EGVAR(common,mapAltitude)) / 288.15) ^ 5.255754495;
|
||||||
if (_newCameraView == "GUNNER") then {
|
|
||||||
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
|
||||||
_layer cutText ["", "PLAIN", 0];
|
|
||||||
|
|
||||||
if !(isNil QGVAR(fadePFH)) then {
|
|
||||||
[GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler;
|
|
||||||
GVAR(fadePFH) = nil;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addPlayerEventHandler;
|
|
||||||
|
|
||||||
// Add keybinds
|
// Check inventory when it changes
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), {
|
["loadout", FUNC(inventoryCheck), true] call CBA_fnc_addPlayerEventHandler;
|
||||||
// Conditions: canInteract
|
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
// Instantly hide knobs when scoping in
|
||||||
|
["cameraView", {
|
||||||
|
params ["_player", "_newCameraView"];
|
||||||
|
|
||||||
// Statement
|
if (_newCameraView == "GUNNER") then {
|
||||||
[ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
|
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
||||||
}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind;
|
_layer cutText ["", "PLAIN", 0];
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), {
|
if !(isNil QGVAR(fadePFH)) then {
|
||||||
// Conditions: canInteract
|
[GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler;
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
GVAR(fadePFH) = nil;
|
||||||
// Conditions: specific
|
};
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
};
|
||||||
|
}] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
// Add keybinds
|
||||||
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [209, [false, false, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [209, [false, false, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [201, [true, false, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [209, [true, false, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [201, [true, false, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [209, [true, true, false]], true] call CBA_fnc_addKeybind;
|
|
||||||
|
|
||||||
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), {
|
// Statement
|
||||||
// Conditions: canInteract
|
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
}, {false}, [209, [true, false, false]], true] call CBA_fnc_addKeybind;
|
||||||
// Conditions: specific
|
|
||||||
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player] call FUNC(inventoryCheck);
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
// Statement
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
|
||||||
}, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind;
|
// Statement
|
||||||
|
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||||
|
}, {false}, [209, [true, true, false]], true] call CBA_fnc_addKeybind;
|
||||||
|
|
||||||
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), {
|
||||||
|
// Conditions: canInteract
|
||||||
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
// Conditions: specific
|
||||||
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
||||||
|
|
||||||
|
[ACE_player] call FUNC(inventoryCheck);
|
||||||
|
|
||||||
|
// Statement
|
||||||
|
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
||||||
|
}, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind;
|
||||||
|
|
||||||
|
|
||||||
// Register fire event handler
|
// Register fire event handler
|
||||||
["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
||||||
["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -28,10 +28,7 @@ if (!GVAR(enabled)) exitWith {false};
|
|||||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||||
if (_weaponIndex < 0) exitWith {false};
|
if (_weaponIndex < 0) exitWith {false};
|
||||||
|
|
||||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
_adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]; // [Windage, Elevation, Zero]
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!(GVAR(canAdjustElevation) select _weaponIndex) && (_turretAndDirection in [ELEVATION_UP, ELEVATION_DOWN])) exitWith {false};
|
if (!(GVAR(canAdjustElevation) select _weaponIndex) && (_turretAndDirection in [ELEVATION_UP, ELEVATION_DOWN])) exitWith {false};
|
||||||
if (!(GVAR(canAdjustWindage) select _weaponIndex) && (_turretAndDirection in [WINDAGE_UP, WINDAGE_DOWN])) exitWith {false};
|
if (!(GVAR(canAdjustWindage) select _weaponIndex) && (_turretAndDirection in [WINDAGE_UP, WINDAGE_DOWN])) exitWith {false};
|
||||||
|
@ -24,12 +24,7 @@ if (vehicle _unit != _unit) exitWith {false};
|
|||||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||||
if (_weaponIndex < 0) exitWith {false};
|
if (_weaponIndex < 0) exitWith {false};
|
||||||
|
|
||||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
_adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
|
||||||
// [Windage, Elevation, Zero]
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
||||||
};
|
|
||||||
|
|
||||||
_zeroing = _adjustment select _weaponIndex;
|
_zeroing = _adjustment select _weaponIndex;
|
||||||
_zeroing params ["_elevation", "_windage", "_zero"];
|
_zeroing params ["_elevation", "_windage", "_zero"];
|
||||||
|
|
||||||
|
@ -24,13 +24,7 @@ params ["_unit", "_elevation", "_windage", "_zero"];
|
|||||||
|
|
||||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||||
|
|
||||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
_adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
|
||||||
// [Windage, Elevation, Zero]
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
||||||
_unit setVariable [QGVAR(Adjustment), _adjustment];
|
|
||||||
};
|
|
||||||
|
|
||||||
_adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero];
|
_adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero];
|
||||||
if (_adjustmentDifference isEqualTo [0,0,0]) exitWith {false}; // Don't coninue if no adjustment is made
|
if (_adjustmentDifference isEqualTo [0,0,0]) exitWith {false}; // Don't coninue if no adjustment is made
|
||||||
|
|
||||||
|
@ -26,12 +26,7 @@ if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])
|
|||||||
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||||
if (_weaponIndex < 0) exitWith {false};
|
if (_weaponIndex < 0) exitWith {false};
|
||||||
|
|
||||||
_adjustment = _unit getVariable QGVAR(Adjustment);
|
_adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
|
||||||
// [Windage, Elevation, Zero]
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
||||||
};
|
|
||||||
|
|
||||||
_elevation = (_adjustment select _weaponIndex) select 0;
|
_elevation = (_adjustment select _weaponIndex) select 0;
|
||||||
|
|
||||||
// You can only adjust your zero reference, if your relative elevation setting is not 0
|
// You can only adjust your zero reference, if your relative elevation setting is not 0
|
||||||
|
@ -15,12 +15,10 @@
|
|||||||
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
|
||||||
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
|
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
|
||||||
|
|
||||||
private _adjustment = _unit getVariable [QGVAR(Adjustment), []];
|
|
||||||
if (_adjustment isEqualTo []) exitWith {};
|
|
||||||
|
|
||||||
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||||
if (_weaponIndex < 0) exitWith {};
|
if (_weaponIndex < 0) exitWith {};
|
||||||
|
|
||||||
|
private _adjustment = ACE_player getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
private _zeroing = +(_adjustment select _weaponIndex);
|
private _zeroing = +(_adjustment select _weaponIndex);
|
||||||
TRACE_1("Adjusting With",_zeroing);
|
TRACE_1("Adjusting With",_zeroing);
|
||||||
|
|
||||||
|
@ -30,7 +30,3 @@ GVAR(defaultZeroRange) = 0 max GVAR(defaultZeroRange) min 1000;
|
|||||||
GVAR(zeroReferenceTemperature) = -55 max GVAR(zeroReferenceTemperature) max 55;
|
GVAR(zeroReferenceTemperature) = -55 max GVAR(zeroReferenceTemperature) max 55;
|
||||||
GVAR(zeroReferenceBarometricPressure) = 0 max GVAR(zeroReferenceBarometricPressure) min 1013.25;
|
GVAR(zeroReferenceBarometricPressure) = 0 max GVAR(zeroReferenceBarometricPressure) min 1013.25;
|
||||||
GVAR(zeroReferenceHumidity) = 0 max GVAR(zeroReferenceHumidity) min 1.0;
|
GVAR(zeroReferenceHumidity) = 0 max GVAR(zeroReferenceHumidity) min 1.0;
|
||||||
|
|
||||||
if (GVAR(deduceBarometricPressureFromTerrainAltitude)) then {
|
|
||||||
GVAR(zeroReferenceBarometricPressure) = 1013.25 * (1 - (0.0065 * EGVAR(common,mapAltitude)) / 288.15) ^ 5.255754495;
|
|
||||||
};
|
|
||||||
|
@ -17,13 +17,8 @@
|
|||||||
|
|
||||||
params ["_player"];
|
params ["_player"];
|
||||||
|
|
||||||
private _adjustment = ACE_player getVariable QGVAR(Adjustment);
|
private _adjustment = ACE_player getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
private _updateAdjustment = false;
|
||||||
// [Windage, Elevation, Zero]
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
||||||
ACE_player setVariable [QGVAR(Adjustment), _adjustment];
|
|
||||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
|
||||||
};
|
|
||||||
|
|
||||||
private _newOptics = [_player] call FUNC(getOptics);
|
private _newOptics = [_player] call FUNC(getOptics);
|
||||||
private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player];
|
private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapon _player];
|
||||||
@ -33,7 +28,7 @@ private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapo
|
|||||||
// The optic for this weapon changed, set adjustment to zero
|
// The optic for this weapon changed, set adjustment to zero
|
||||||
if (!((_adjustment select _forEachIndex) isEqualTo [0, 0, 0])) then {
|
if (!((_adjustment select _forEachIndex) isEqualTo [0, 0, 0])) then {
|
||||||
_adjustment set [_forEachIndex, [0, 0, 0]];
|
_adjustment set [_forEachIndex, [0, 0, 0]];
|
||||||
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
_updateAdjustment;
|
||||||
};
|
};
|
||||||
private _opticConfig = configFile >> "CfgWeapons" >> (_newOptics select _forEachIndex);
|
private _opticConfig = configFile >> "CfgWeapons" >> (_newOptics select _forEachIndex);
|
||||||
private _verticalIncrement = -1;
|
private _verticalIncrement = -1;
|
||||||
@ -69,8 +64,6 @@ private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapo
|
|||||||
(GVAR(scopeAdjust) select _forEachIndex) set [3, _horizontalIncrement];
|
(GVAR(scopeAdjust) select _forEachIndex) set [3, _horizontalIncrement];
|
||||||
GVAR(canAdjustElevation) set [_forEachIndex, (_verticalIncrement > 0) && !(_maxVertical isEqualTo [0, 0])];
|
GVAR(canAdjustElevation) set [_forEachIndex, (_verticalIncrement > 0) && !(_maxVertical isEqualTo [0, 0])];
|
||||||
GVAR(canAdjustWindage) set [_forEachIndex, (_horizontalIncrement > 0) && !(_maxHorizontal isEqualTo [0, 0])];
|
GVAR(canAdjustWindage) set [_forEachIndex, (_horizontalIncrement > 0) && !(_maxHorizontal isEqualTo [0, 0])];
|
||||||
private _hideVanillaZeroing = (GVAR(enabled) && getNumber(_opticConfig >> "ItemInfo" >> "opticType") == 2 && {GVAR(canAdjustElevation) select _forEachIndex}) || {isNumber (_opticConfig >> "ACE_ScopeZeroRange")};
|
|
||||||
["ace_scopes", true, "zeroing", !_hideVanillaZeroing] call EFUNC(ui,setElementVisibility);
|
|
||||||
};
|
};
|
||||||
} forEach GVAR(Optics);
|
} forEach GVAR(Optics);
|
||||||
|
|
||||||
@ -134,7 +127,9 @@ private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapo
|
|||||||
}
|
}
|
||||||
} forEach [0, 1, 2];
|
} forEach [0, 1, 2];
|
||||||
|
|
||||||
_adjustment = ACE_player getVariable QGVAR(Adjustment);
|
if (_updateAdjustment) then {
|
||||||
|
[ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic);
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(Optics) = _newOptics;
|
GVAR(Optics) = _newOptics;
|
||||||
GVAR(Guns) = _newGuns;
|
GVAR(Guns) = _newGuns;
|
||||||
|
|
||||||
|
@ -20,11 +20,7 @@ disableSerialization;
|
|||||||
private _weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex);
|
private _weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex);
|
||||||
if (_weaponIndex < 0) exitWith {};
|
if (_weaponIndex < 0) exitWith {};
|
||||||
|
|
||||||
private _adjustment = ACE_player getVariable QGVAR(Adjustment);
|
private _adjustment = ACE_player getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]];
|
||||||
if (isNil "_adjustment") then {
|
|
||||||
// [Windage, Elevation, Zero]
|
|
||||||
_adjustment = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
|
|
||||||
};
|
|
||||||
|
|
||||||
// Display the adjustment knobs
|
// Display the adjustment knobs
|
||||||
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user