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-01-18 20:01:07 +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
|
|
|
|
["playerInventoryChanged", {
|
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
}] call EFUNC(common,addEventhandler);
|
|
|
|
|
|
|
|
|
|
|
|
// Instantly hide knobs when scoping in
|
|
|
|
["cameraViewChanged", {
|
|
|
|
EXPLODE_2_PVT(_this,_player,_newCameraView);
|
|
|
|
if (_newCameraView == "GUNNER") then {
|
|
|
|
private "_layer";
|
|
|
|
_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 {
|
|
|
|
[GVAR(fadePFH)] call cba_fnc_removePerFrameHandler;
|
|
|
|
GVAR(fadePFH) = nil;
|
|
|
|
};
|
2015-01-16 12:15:14 +00:00
|
|
|
};
|
2015-02-10 04:22:10 +00:00
|
|
|
}] call EFUNC(common,addEventhandler);
|
2015-01-18 20:01:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Add keybinds
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize "STR_ACE_Scopes_AdjustUpMinor",
|
2015-03-05 07:32:26 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
2015-03-20 22:55:39 +00:00
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
|
|
|
[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);
|
2015-03-05 07:32:26 +00:00
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-04-09 12:31:18 +00:00
|
|
|
[201, [false, false, false]], true] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize "STR_ACE_Scopes_AdjustDownMinor",
|
2015-03-05 07:32:26 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
2015-03-20 22:55:39 +00:00
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
|
|
|
[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);
|
2015-03-05 07:32:26 +00:00
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-04-09 12:31:18 +00:00
|
|
|
[209, [false, false, false]], true] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize "STR_ACE_Scopes_AdjustLeftMinor",
|
2015-03-05 07:32:26 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
2015-03-20 22:55:39 +00:00
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
|
|
|
[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);
|
2015-03-05 07:32:26 +00:00
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-04-09 12:31:18 +00:00
|
|
|
[209, [false, true, false]], true] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize "STR_ACE_Scopes_AdjustRightMinor",
|
2015-03-05 07:32:26 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
2015-03-20 22:55:39 +00:00
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
|
|
|
[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);
|
2015-03-05 07:32:26 +00:00
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-04-09 12:31:18 +00:00
|
|
|
[201, [false, true, false]], true] call cba_fnc_addKeybind;
|
2015-04-02 20:40:21 +00:00
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize "STR_ACE_Scopes_AdjustUpMajor",
|
2015-04-10 17:41:34 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2015-04-10 17:41:34 +00:00
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[201, [true, false, false]], true] call cba_fnc_addKeybind;
|
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize "STR_ACE_Scopes_AdjustDownMajor",
|
2015-04-10 17:41:34 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2015-04-10 17:41:34 +00:00
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[209, [true, false, false]], true] call cba_fnc_addKeybind;
|
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize "STR_ACE_Scopes_AdjustLeftMajor",
|
2015-04-10 17:41:34 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2015-04-10 17:41:34 +00:00
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[209, [true, true, false]], true] call cba_fnc_addKeybind;
|
|
|
|
|
2015-04-30 20:02:20 +00:00
|
|
|
["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize "STR_ACE_Scopes_AdjustRightMajor",
|
2015-04-10 17:41:34 +00:00
|
|
|
{
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
[ACE_player] call FUNC(inventoryCheck);
|
|
|
|
|
|
|
|
// Statement
|
2015-04-11 12:02:44 +00:00
|
|
|
[ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope);
|
2015-04-10 17:41:34 +00:00
|
|
|
},
|
|
|
|
{false},
|
|
|
|
[201, [true, true, false]], true] call cba_fnc_addKeybind;
|
|
|
|
|
2015-04-02 20:40:21 +00:00
|
|
|
// init shortdot
|
2015-04-02 22:03:08 +00:00
|
|
|
GVAR(showShortdot) = false;
|
2015-04-02 20:40:21 +00:00
|
|
|
|
2015-04-02 22:03:08 +00:00
|
|
|
["playerInventoryChanged", {
|
2015-04-02 22:41:11 +00:00
|
|
|
if (_this select 1 isEqualTo []) exitWith {}; //@todo fix eh
|
|
|
|
|
2015-04-02 22:03:08 +00:00
|
|
|
private "_showShortdot";
|
|
|
|
_showShortdot = _this select 1 select 9 select 2 == "ACE_optic_DMS";
|
|
|
|
|
|
|
|
if (GVAR(showShortdot)) then {
|
|
|
|
if (!_showShortdot) then {
|
|
|
|
// hide control and turn onDraw handler off
|
|
|
|
(uiNamespace getVariable ["ACE_ctrlShortdotReticle", controlNull]) ctrlShow false;
|
|
|
|
GVAR(showShortdot) = false;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if (_showShortdot) then {
|
|
|
|
// create control and turn onDraw handler on
|
|
|
|
([QGVAR(reticle)] call BIS_fnc_rscLayer) cutRsc ["ACE_Shortdot_Reticle", "PLAIN", 0, false];
|
|
|
|
(uiNamespace getVariable "ACE_ctrlShortdotReticle") ctrlSetText QUOTE(PATHTOF(data\reticles\ace_shortdot_reticle_1.paa));
|
|
|
|
GVAR(showShortdot) = true;
|
|
|
|
};
|
2015-04-02 20:40:21 +00:00
|
|
|
};
|
|
|
|
}] call EFUNC(common,addEventHandler);
|
2015-04-02 22:03:08 +00:00
|
|
|
|
|
|
|
addMissionEventHandler ["Draw3D", {if (GVAR(showShortdot)) then {call FUNC(onDrawShortdot)};}];
|