mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Scopes - Notify restart req. for enable & pressure settings (#9944)
* Moved keybinds, made settings require restart * Move keybinds
This commit is contained in:
parent
2b5ea1628f
commit
bcf1133477
@ -9,6 +9,9 @@
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
// Add keybinds
|
||||
#include "initKeybinds.inc.sqf"
|
||||
|
||||
GVAR(Optics) = ["", "", ""];
|
||||
GVAR(Guns) = ["", "", ""];
|
||||
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;
|
||||
|
||||
// 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
|
||||
["ace_firedPlayer", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
||||
["ace_firedPlayerNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
||||
|
@ -17,12 +17,13 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
if (!GVAR(enabled)) exitWith {false};
|
||||
|
||||
params ["_unit", "_turretAndDirection", "_majorStep"];
|
||||
TRACE_3("adjustScope",_unit,_turretAndDirection,_majorStep);
|
||||
|
||||
if (!(_unit isKindOf "Man")) exitWith {false};
|
||||
if (currentMuzzle _unit != currentWeapon _unit) exitWith {false};
|
||||
if (!GVAR(enabled)) exitWith {false};
|
||||
|
||||
private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex);
|
||||
if (_weaponIndex < 0) exitWith {false};
|
||||
|
95
addons/scopes/initKeybinds.inc.sqf
Normal file
95
addons/scopes/initKeybinds.inc.sqf
Normal 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;
|
@ -5,7 +5,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
|
||||
[LSTRING(enabled_displayName), LSTRING(enabled_description)],
|
||||
_category,
|
||||
true,
|
||||
1
|
||||
1,
|
||||
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
|
||||
true // Needs mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
@ -69,7 +71,9 @@ private _category = format ["ACE %1", localize LSTRING(DisplayName)];
|
||||
[LSTRING(deduceBarometricPressureFromTerrainAltitude_displayName), LSTRING(deduceBarometricPressureFromTerrainAltitude_description)],
|
||||
_category,
|
||||
false,
|
||||
1
|
||||
1,
|
||||
{[QGVAR(deduceBarometricPressureFromTerrainAltitude), _this] call EFUNC(common,cbaSettings_settingChanged)},
|
||||
true // Needs mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user