2015-01-16 12:15:14 +00:00
|
|
|
/*
|
2015-04-11 12:02:44 +00:00
|
|
|
* Author: KoffeinFlummi, esteldunedain, Ruthberg
|
2015-01-16 12:15:14 +00:00
|
|
|
*
|
2015-01-18 20:01:07 +00:00
|
|
|
* Watches for scope changes.
|
|
|
|
* Defines key bindings
|
2015-01-16 12:15:14 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-01-18 07:13:37 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-11 14:58:26 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-01-16 12:15:14 +00:00
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
// Check inventory when it changes
|
2016-06-21 23:39:20 +00:00
|
|
|
["loadout", FUNC(inventoryCheck)] call CBA_fnc_addPlayerEventHandler;
|
2015-02-10 04:22:10 +00:00
|
|
|
|
|
|
|
// Instantly hide knobs when scoping in
|
2016-06-21 23:39:20 +00:00
|
|
|
["cameraView", {
|
|
|
|
params ["_player", "_newCameraView"];
|
|
|
|
|
2015-02-10 04:22:10 +00:00
|
|
|
if (_newCameraView == "GUNNER") then {
|
2016-06-21 23:39:20 +00:00
|
|
|
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
2015-01-18 20:01:07 +00:00
|
|
|
_layer cutText ["", "PLAIN", 0];
|
2015-02-10 04:22:10 +00:00
|
|
|
|
|
|
|
if !(isNil QGVAR(fadePFH)) then {
|
2015-11-30 15:45:20 +00:00
|
|
|
[GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler;
|
2015-02-10 04:22:10 +00:00
|
|
|
GVAR(fadePFH) = nil;
|
|
|
|
};
|
2015-01-16 12:15:14 +00:00
|
|
|
};
|
2016-06-21 23:39:20 +00:00
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
|
|
|
// Add keybinds
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
2015-04-30 20:02:20 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [209, [false, false, false]], true] call CBA_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind;
|
2015-04-02 20:40:21 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), {
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-04-10 17:41:34 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [201, [true, false, false]], true] call CBA_fnc_addKeybind;
|
2015-04-10 17:41:34 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), {
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-04-10 17:41:34 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [209, [true, false, false]], true] call CBA_fnc_addKeybind;
|
2015-04-10 17:41:34 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), {
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-04-10 17:41:34 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [209, [true, true, false]], true] call CBA_fnc_addKeybind;
|
2015-04-10 17:41:34 +00:00
|
|
|
|
2016-06-21 23:39:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), {
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: canInteract
|
2016-05-20 02:39:15 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-04-10 17:41:34 +00:00
|
|
|
// Conditions: specific
|
2016-05-20 06:10:12 +00:00
|
|
|
if (!([ACE_player] call CBA_fnc_canUseWeapon)) exitWith {false};
|
2016-05-20 02:39:15 +00:00
|
|
|
|
2015-04-10 17:41:34 +00:00
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2016-06-21 23:39:20 +00:00
|
|
|
}, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind;
|
2016-02-06 21:24:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Register fire event handler
|
2016-05-24 13:13:11 +00:00
|
|
|
["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
|
|
|
["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler;
|