2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
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
|
|
|
|
2015-09-11 14:58:26 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
2015-01-16 12:15:14 +00:00
|
|
|
|
2024-04-11 15:43:19 +00:00
|
|
|
// Add keybinds
|
|
|
|
#include "initKeybinds.inc.sqf"
|
|
|
|
|
2016-11-07 11:01:36 +00:00
|
|
|
GVAR(Optics) = ["", "", ""];
|
2016-11-08 16:15:16 +00:00
|
|
|
GVAR(Guns) = ["", "", ""];
|
2016-11-08 13:47:12 +00:00
|
|
|
GVAR(canAdjustElevation) = [false, false, false];
|
|
|
|
GVAR(canAdjustWindage) = [false, false, false];
|
|
|
|
GVAR(scopeAdjust) = [[[0,0],0,[0,0],0], [[0,0],0,[0,0],0], [[0,0],0,[0,0],0]];
|
2016-11-07 11:01:36 +00:00
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2015-02-10 04:22:10 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
if (!GVAR(enabled)) exitWith {};
|
2017-08-22 18:30:56 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
if (GVAR(deduceBarometricPressureFromTerrainAltitude)) then {
|
|
|
|
GVAR(zeroReferenceBarometricPressure) = 1013.25 * (1 - (0.0065 * EGVAR(common,mapAltitude)) / 288.15) ^ 5.255754495;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Check inventory when it changes
|
2024-03-28 18:57:23 +00:00
|
|
|
["loadout", LINKFUNC(inventoryCheck), true] call CBA_fnc_addPlayerEventHandler;
|
2016-06-21 23:39:20 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
// Instantly hide knobs when scoping in
|
|
|
|
["cameraView", {
|
|
|
|
params ["_player", "_newCameraView"];
|
2015-02-10 04:22:10 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
if (_newCameraView == "GUNNER") then {
|
|
|
|
private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer;
|
|
|
|
_layer cutText ["", "PLAIN", 0];
|
|
|
|
|
2020-02-11 22:46:39 +00:00
|
|
|
if (!isNil QGVAR(fadePFH)) then {
|
2016-11-12 10:23:14 +00:00
|
|
|
[GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler;
|
|
|
|
GVAR(fadePFH) = nil;
|
|
|
|
};
|
2015-02-10 04:22:10 +00:00
|
|
|
};
|
2016-11-12 10:23:14 +00:00
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
2015-01-18 20:01:07 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
// Register fire event handler
|
2024-03-28 18:57:23 +00:00
|
|
|
["ace_firedPlayer", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
|
|
|
["ace_firedPlayerNonLocal", LINKFUNC(firedEH)] call CBA_fnc_addEventHandler;
|
2017-08-22 18:30:56 +00:00
|
|
|
|
2016-11-12 10:23:14 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|