Files
braf/braf_air2/braf_fnc/fn_initRSC.sqf
2026-06-14 21:25:45 -03:00

49 lines
1.5 KiB
Plaintext

/*
Author: Brazilian Armed Forces
File: fn_initRSC.sqf
Objetivo:
- Cria e gerencia o loop EachFrame que chama uma função de atualização BRAF_fnc_flirControls
*/
disableSerialization;
params ["_display"];
// Diagnóstico: Verificar se a função está definida
if (isNil "BRAF_fnc_flirControls") then {
systemChat "[BRAF A-29] AVISO: BRAF_fnc_flirControls não foi carregada!";
};
uiNamespace setVariable ["BRAF_A29_UI_Display", _display];
if ((uiNamespace getVariable ["BRAF_A29_PFH_eachFrame", -1]) > -1) then {
removeMissionEventHandler ["EachFrame", (uiNamespace getVariable "BRAF_A29_PFH_eachFrame")];
uiNamespace setVariable ["BRAF_A29_PFH_eachFrame", nil];
};
private _pfh = addMissionEventHandler ["EachFrame", {
if (cameraView != "GUNNER") exitWith {};
private _display = uiNamespace getVariable ["BRAF_A29_UI_Display", displayNull];
if (isNull _display) exitWith {
removeMissionEventHandler ["EachFrame", (uiNamespace getVariable "BRAF_A29_PFH_eachFrame")];
uiNamespace setVariable ["BRAF_A29_PFH_eachFrame", nil];
uiNamespace setVariable ["BRAF_A29_UI_Display", nil];
};
private _veh = vehicle player;
if (isNull _veh) exitWith {
removeMissionEventHandler ["EachFrame", (uiNamespace getVariable "BRAF_A29_PFH_eachFrame")];
uiNamespace setVariable ["BRAF_A29_PFH_eachFrame", nil];
uiNamespace setVariable ["BRAF_A29_UI_Display", nil];
};
[_display] call BRAF_fnc_flirControls;
}];
uiNamespace setVariable ["BRAF_A29_PFH_eachFrame", _pfh];
//systemChat "[BRAF A-29] Sistema FLIR iniciado com sucesso";