Skip to content

Commit fb2cbd7

Browse files
Artillery Tables - Don't block zeroing for turrets without elevationMode (#10810)
* Artillery Tables - Don't block vanilla zeroing for turrets without `elevationMode` * Update addons/artillerytables/functions/fnc_turretPFEH.sqf Co-authored-by: Jouni Järvinen <[email protected]> --------- Co-authored-by: Jouni Järvinen <[email protected]>
1 parent ab4fcfc commit fb2cbd7

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

addons/artillerytables/functions/fnc_turretChanged.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ if ((alive _player) && {_showGunLaying > 0} && {_player == gunner _vehicle}) the
5757
_fireModes = _fireModes apply {[getNumber (_x >> "artilleryCharge"), configName _x]};
5858
_fireModes sort true;
5959
_fireModes = _fireModes apply {_x select 1};
60+
private _elevationMode = getNumber (_turretCfg >> "elevationMode");
6061

61-
GVAR(pfID) = [LINKFUNC(turretPFEH), 0, [_vehicle, _turret, _fireModes, _useAltElevation, _turretAnimBody, _invalidGunnerMem]] call CBA_fnc_addPerFrameHandler;
62+
GVAR(pfID) = [LINKFUNC(turretPFEH), 0, [_vehicle, _turret, _fireModes, _useAltElevation, _turretAnimBody, _invalidGunnerMem, _elevationMode]] call CBA_fnc_addPerFrameHandler;
6263
TRACE_4("added pfEH",GVAR(pfID),_useAltElevation,_turretAnimBody,_invalidGunnerMem);
6364

6465
#ifdef DEBUG_MODE_FULL
6566
private _ballisticsComputer = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ballisticsComputer");
66-
private _elevationMode = getNumber (_turretCfg >> "elevationMode");
6767
private _discreteDistance = getArray (_turretCfg >> "discreteDistance");
6868
TRACE_4("",_weapon,_ballisticsComputer,_elevationMode,_discreteDistance);
6969
#endif

addons/artillerytables/functions/fnc_turretPFEH.sqf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Public: No
1616
*/
1717

18-
(_this select 0) params ["_vehicle", "_turret", "_fireModes", "_useAltElevation", "_turretAnimBody", "_invalidGunnerMem"];
18+
(_this select 0) params ["_vehicle", "_turret", "_fireModes", "_useAltElevation", "_turretAnimBody", "_invalidGunnerMem", "_elevationMode"];
1919

2020
if (shownArtilleryComputer && {GVAR(disableArtilleryComputer)}) then {
2121
// Still Don't like this solution, but it works
@@ -31,6 +31,16 @@ if (isNull (uiNamespace getVariable [QGVAR(display), displayNull])) then {
3131

3232
private _ctrlGroup = (uiNamespace getVariable [QGVAR(display), displayNull]) displayCtrl 1000;
3333

34+
if (_elevationMode == 0) then {
35+
// For turrets not using an elevation mode (i.e. mouse controls elevation instead of pageUp/Down)
36+
// Show the info 1 step below, so it doesn't block vanilla ranging (discreteDistance)
37+
// vanilla zeroing will have a negative effect, so it's best to range as low as possible
38+
private _safeZoneGrid = (((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25;
39+
private _y = 3.5 * _safeZoneGrid + (profileNamespace getVariable ['IGUI_GRID_WEAPON_Y', safeZoneY + 0.5 * _safeZoneGrid]);
40+
_ctrlGroup ctrlSetPositionY _y;
41+
_ctrlGroup ctrlCommit 0;
42+
};
43+
3444
// Need to be in gunner mode, so we can check where the optics are aiming at
3545
// However, if there are no optics, ignore the above
3646
if (!_invalidGunnerMem && {cameraView != "GUNNER"}) exitWith {

0 commit comments

Comments
 (0)