Files

46 lines
1.1 KiB
Plaintext

/*
Author: Brazilian Armed Forces
File: fn_initRSC.sqf
Purpose:
- Create and manage the EachFrame loop that updates the generic air FLIR optics
*/
disableSerialization;
private _display = _this;
if (_display isEqualType []) then {
_display = _display param [0, displayNull];
};
if (isNull _display) exitWith {
systemChat "[BRAF FLIR] ERROR: initRSC received an invalid display.";
};
if (isNil "BRAF_fnc_flirControls") then {
systemChat "[BRAF FLIR] WARNING: BRAF_fnc_flirControls is not loaded.";
};
[] call BRAF_fnc_shutdownRSC;
uiNamespace setVariable ["BRAF_FLIR_UI_Display", _display];
private _pfh = addMissionEventHandler ["EachFrame", {
if (cameraView != "GUNNER") exitWith {};
private _display = uiNamespace getVariable ["BRAF_FLIR_UI_Display", displayNull];
if (isNull _display) exitWith {
[] call BRAF_fnc_shutdownRSC;
};
private _veh = vehicle player;
if (isNull _veh) exitWith {
[] call BRAF_fnc_shutdownRSC;
};
[_display] call BRAF_fnc_flirControls;
}];
uiNamespace setVariable ["BRAF_FLIR_PFH_eachFrame", _pfh];