#include "..\script_component.hpp"

if (!isServer) exitWith {};

// init asset stores at bases
[true] call FUNC(updateAssetsByBase);

// starting 5 minutes after postInit, update asset stores every 5 minutes
[{
	[
		{[false] call FUNC(updateAssetsByBase);},
		60*5
	] call CBA_fnc_addPerFrameHandler;
}, 60*5] call CBA_fnc_waitAndExecute;


// add end mission EH
addMissionEventHandler ["MPEnded", {
	// log the "current" asset counts to RPT
	[false, true] call FUNC(updateAssetsByBase);
}];


[
	LEVEL_DEBUG,
	QUOTE(COMPONENT),
	"postInit complete",
	[]
] call EFUNC(common,log);