2015-01-16 12:15:14 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: KoffeinFlummi and esteldunedain
|
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-03-05 07:32:26 +00:00
|
|
|
["ACE3", QGVAR(AdjustUp), localize "STR_ACE_Scopes_AdjustUp",
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
if !([ACE_player, 0, 0.1] call FUNC(canAdjustScope)) exitWith {false};
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
|
|
|
[ACE_player, 0, 0.1] call FUNC(adjustScope);
|
|
|
|
true
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-03-05 07:32:26 +00:00
|
|
|
[201, [false, false, false]], false] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
["ACE3", QGVAR(AdjustDown), localize "STR_ACE_Scopes_AdjustDown",
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
if !([ACE_player, 0, -0.1] call FUNC(canAdjustScope)) exitWith {false};
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
|
|
|
[ACE_player, 0, -0.1] call FUNC(adjustScope);
|
|
|
|
true
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-03-05 07:32:26 +00:00
|
|
|
[209, [false, false, false]], false] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
["ACE3", QGVAR(AdjustLeft), localize "STR_ACE_Scopes_AdjustLeft",
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
if !([ACE_player, -0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
|
|
|
[ACE_player, -0.1, 0] call FUNC(adjustScope);
|
|
|
|
true
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-03-05 07:32:26 +00:00
|
|
|
[209, [false, true, false]], false] call cba_fnc_addKeybind;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
["ACE3", QGVAR(AdjustRight), localize "STR_ACE_Scopes_AdjustRight",
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
if !([ACE_player, 0.1, 0] call FUNC(canAdjustScope)) exitWith {false};
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Statement
|
|
|
|
[ACE_player, 0.1, 0] call FUNC(adjustScope);
|
|
|
|
true
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-03-05 07:32:26 +00:00
|
|
|
[201, [false, true, false]], false] call cba_fnc_addKeybind;
|