#include "..\script_component.hpp"

if (!hasInterface) exitWith {};

[
	LEVEL_INFO,
	QUOTE(COMPONENT),
	"Initializing client stats PFH",
	[]
] call EFUNC(common,log);

_cpsPFH = [
	{ 
		[] call FUNC(calculateClientStats);
	},
	QGVAR(client_cps_interval) call CBA_settings_fnc_get,
	[],
	{ 
		[
			LEVEL_INFO,
			QUOTE(COMPONENT),
			"Client PFH loaded",
			[["pfhInterval", QGVAR(client_cps_interval) call CBA_settings_fnc_get]]
		] call EFUNC(common,log);
	},
	{ 	[
			LEVEL_INFO,
			QUOTE(COMPONENT),
			"Client PFH unloaded",
			[]
		] call EFUNC(common,log);
	},
	{ QGVAR(client_cps_enable) call CBA_settings_fnc_get },
	{ false },
	[]
] call CBA_fnc_createPerFrameHandlerObject;

player setVariable [QGVAR(client_cps_handler), _cpsPFH];
