tutorial = tutorial or {}

function tutorial.start()


    tutorial.last_correct_action_time = tutorial.tutorial_timer.Get().GetTime()
	tutorial.check_inv_state()
	form_event([[
		if  profile.GetVariable("tutorial_finished") == 0 then
		show_ex(0, false, "Tutorial_tasks")
			sleep(4500)	 -- стрелочка на список задач
			hide_ex(200, false, "Tutorial_tasks")
			if is_easy_difficulty() then
				show_ex(0, false, "Tutorial_upperpanel")
				play_clip("Tutorial_upperpanel")
			end
			if is_object_on_level("Cupboard_key") then
				show_ex(0, false, "Tutorial_key")
				show_ex(0, false, "key_glow")
			end
			
			while true do
				if cursor("Cupboard_key") then
					-- показать на шкаф
					show_ex(300, false, "Tutorial_cupboard")
					if not is_object_in_inventory("Cupboard_key", "__inv") then
						change_invent_state_by_id("Cupboard_key", "__inv")
					end
				elseif is_object_in_inventory("Cupboard_key") then
					hide_ex(300, false, "Tutorial_cupboard")
				end
				sleep(50)
			end
		else
			hide_ex(0, false, "Tutorial_tasks")
		end
	]])
	
end

-- управляет стрелкой в инвентаре
function tutorial.check_inv_state()
	form_event([[
		while (true) do
			if not cursor("Cupboard_key") and is_object_in_inventory("Cupboard_key") then
				sleep(2500)
				if is_object_in_inventory("Cupboard_key", "__inv") then
					-- показать на объект в инвентаре
					change_invent_state_by_id("Cupboard_key", "__inv_arrow")
				else
					change_invent_state_by_id("Cupboard_key", "__inv")
				end
				sleep(2500)
			else
				sleep(50)
			end
		end
	]])
end

