Added new ace_scopes module setting 'correctZeroing' (default on)

This commit is contained in:
ulteq 2016-11-12 12:06:17 +01:00 committed by ulteq
parent 2f23f1ca6c
commit 8c49433b49
6 changed files with 32 additions and 9 deletions

View File

@ -12,6 +12,14 @@ class ACE_Settings {
displayName = CSTRING(forceUseOfAdjustmentTurrets_displayName);
description = CSTRING(forceUseOfAdjustmentTurrets_description);
};
// Auto corrects the zeroing in both vanilla- and advanced ballistics
class GVAR(correctZeroing) {
typeName = "BOOL";
value = 1;
displayName = CSTRING(correctZeroing_displayName);
description = CSTRING(correctZeroing_description);
};
// Only affects scopes with elevation adjustment turrets (ACE_ScopeAdjust_Vertical != [0,0])
class GVAR(defaultZeroRange) {
typeName = "SCALAR";

View File

@ -40,6 +40,12 @@ class CfgVehicles {
typeName = "BOOL";
defaultValue = 0;
};
class correctZeroing {
displayName = CSTRING(correctZeroing_DisplayName);
description = CSTRING(correctZeroing_Description);
typeName = "BOOL";
defaultValue = 1;
};
class defaultZeroRange {
displayName = CSTRING(defaultZeroRange_DisplayName);
description = CSTRING(defaultZeroRange_Description);

View File

@ -27,15 +27,17 @@ TRACE_1("Adjusting With",_zeroing);
// Convert zeroing from mils to degrees
_zeroing = _zeroing vectorMultiply 0.05625;
private _advancedBallistics = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false];
private _boreHeight = GVAR(boreHeight) select _weaponIndex;
private _oldZeroRange = currentZeroing _unit;
private _newZeroRange = [_unit] call FUNC(getCurrentZeroRange);
private _zeroCorrection = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5_%6_%7), _oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics];
if (isNil "_zeroCorrection") then {
_zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection);
if (GVAR(correctZeroing)) then {
private _advancedBallistics = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false];
private _boreHeight = GVAR(boreHeight) select _weaponIndex;
private _oldZeroRange = currentZeroing _unit;
private _newZeroRange = [_unit] call FUNC(getCurrentZeroRange);
private _zeroCorrection = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5_%6_%7), _oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics];
if (isNil "_zeroCorrection") then {
_zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection);
};
_zeroing = _zeroing vectorAdd [0, 0, _zeroCorrection];
};
_zeroing = _zeroing vectorAdd [0, 0, _zeroCorrection];
if (_zeroing isEqualTo [0, 0, 0]) exitWith {};

View File

@ -20,6 +20,7 @@ if !(_activated) exitWith {};
[_logic, QGVAR(enabled), "enabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(forceUseOfAdjustmentTurrets), "forceUseOfAdjustmentTurrets"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(correctZeroing), "correctZeroing"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(defaultZeroRange), "defaultZeroRange"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(zeroReferenceTemperature), "zeroReferenceTemperature"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(zeroReferenceBarometricPressure), "zeroReferenceBarometricPressure"] call EFUNC(common,readSettingFromModule);

View File

@ -28,7 +28,7 @@ private _newGuns = [primaryWeapon _player, secondaryWeapon _player, handgunWeapo
// The optic for this weapon changed, set adjustment to zero
if (!((_adjustment select _forEachIndex) isEqualTo [0, 0, 0])) then {
_adjustment set [_forEachIndex, [0, 0, 0]];
_updateAdjustment;
_updateAdjustment = true;
};
private _opticConfig = configFile >> "CfgWeapons" >> (_newOptics select _forEachIndex);
private _verticalIncrement = -1;

View File

@ -16,6 +16,12 @@
<Key ID="STR_ACE_Scopes_forceUseOfAdjustmentTurrets_description">
<English>Force usage of adjustmet turrets on high powered scopes</English>
</Key>
<Key ID="STR_ACE_Scopes_correctZeroing_displayName">
<English>Correct zeroing</English>
</Key>
<Key ID="STR_ACE_Scopes_correctZeroing_description">
<English>Corrects the zeroing of all small arms sights</English>
</Key>
<Key ID="STR_ACE_Scopes_defaultZeroRange_displayName">
<English>Default zero distance</English>
</Key>