#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * AI plays a given sentence/conversation
 *
 * Arguments:
 * 0: Unit that is playing the given sentence/conversation <OBJECT>
 * 1: Topic that is being talked about <STRING>
 * 2: Sentence partaining to the topic at hand <STRING>
 *
 * Return Value:
 * None
 *
 * Example:
 * [player, "topic", "sentence"] call forge_client_briefing_fnc_spawnLecture
 *
 * Public: No
 */

params ["_unit", "_topic", "_sentence"];

FORGE_Briefing_inProgress = true;
publicVariable "FORGE_Briefing_inProgress";

while { alive _unit } do {
	_unit disableAI "ALL";
	_unit switchMove " ";
	_handle = [_topic, _sentence, nil, nil, nil, [_unit], 1, false] spawn BIS_fnc_kbTell;

	if (!alive _unit) exitWith {
		[_unit] spawn BIS_fnc_kbSkip;

		FORGE_Briefing_inProgress = false;
		publicVariable "FORGE_Briefing_inProgress";
	};

	uiSleep 5;
};

waitUntil { scriptDone _handle };

FORGE_Briefing_inProgress = false;
publicVariable "FORGE_Briefing_inProgress";