Scopes - Notify restart req. for enable & pressure settings (#9944)

* Moved keybinds, made settings require restart

* Move keybinds
This commit is contained in:
johnb432 2024-04-11 17:43:19 +02:00 committed by GitHub
parent 2b5ea1628f
commit bcf1133477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 106 additions and 101 deletions

View File

@ -9,6 +9,9 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
// Add keybinds
#include "initKeybinds.inc.sqf"
GVAR(Optics) = ["", "", ""]; GVAR(Optics) = ["", "", ""];
GVAR(Guns) = ["", "", ""]; GVAR(Guns) = ["", "", ""];
GVAR(canAdjustElevation) = [false, false, false]; GVAR(canAdjustElevation) = [false, false, false];
@ -41,104 +44,6 @@ GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]];
}; };
}] call CBA_fnc_addPlayerEventHandler; }] call CBA_fnc_addPlayerEventHandler;
// Add keybinds
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, 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), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, 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), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, 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), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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_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", "isNotSwimming"]] 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", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler; ["ace_firedPlayer", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
["ace_firedPlayerNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler; ["ace_firedPlayerNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;

View File

@ -17,12 +17,13 @@
* Public: No * Public: No
*/ */
if (!GVAR(enabled)) exitWith {false};
params ["_unit", "_turretAndDirection", "_majorStep"]; params ["_unit", "_turretAndDirection", "_majorStep"];
TRACE_3("adjustScope",_unit,_turretAndDirection,_majorStep); TRACE_3("adjustScope",_unit,_turretAndDirection,_majorStep);
if (!(_unit isKindOf "Man")) exitWith {false}; if (!(_unit isKindOf "Man")) exitWith {false};
if (currentMuzzle _unit != currentWeapon _unit) exitWith {false}; if (currentMuzzle _unit != currentWeapon _unit) exitWith {false};
if (!GVAR(enabled)) exitWith {false};
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
if (_weaponIndex < 0) exitWith {false}; if (_weaponIndex < 0) exitWith {false};

View File

@ -0,0 +1,95 @@
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), LLSTRING(AdjustUpMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), LLSTRING(AdjustDownMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [209, [false, false, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), LLSTRING(AdjustLeftMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), LLSTRING(AdjustRightMinor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, MINOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), LLSTRING(AdjustUpMajor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [201, [true, false, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), LLSTRING(AdjustDownMajor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [209, [true, false, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), LLSTRING(AdjustLeftMajor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
}, {false}, [209, [true, true, false]], true] call CBA_fnc_addKeybind;
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), LLSTRING(AdjustRightMajor), {
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside", "isNotSwimming"]] 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;

View File

@ -5,7 +5,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
[LSTRING(enabled_displayName), LSTRING(enabled_description)], [LSTRING(enabled_displayName), LSTRING(enabled_description)],
_category, _category,
true, true,
1 1,
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[ [
@ -69,7 +71,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
[LSTRING(deduceBarometricPressureFromTerrainAltitude_displayName), LSTRING(deduceBarometricPressureFromTerrainAltitude_description)], [LSTRING(deduceBarometricPressureFromTerrainAltitude_displayName), LSTRING(deduceBarometricPressureFromTerrainAltitude_description)],
_category, _category,
false, false,
1 1,
{[QGVAR(deduceBarometricPressureFromTerrainAltitude), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
[ [