--------------------------------------------------------------------------------
--  File     : Mill_int
--  Author(s): Prokopovich Larisa
--
--  Summary  : Скрипт управления локацией.
--
--  Copyright © 2012 Floodlight Games.  All rsights reserved.
--------------------------------------------------------------------------------
function OnFirstEntry()
	stars:Show("M_TOOLS", "1")
	stars:Show("GLASS", "4")
	music:Stop(false)
	music:PlayLoopWithDelay(0, "horror_1")
end
--------------------------------------------------------------------------------
function OnEntry()
	ambient:Play("mill_int")
	music:PlayLoopWithDelay(10, "horror_1")
end
--------------------------------------------------------------------------------
function OnMouseClickOnItem(item)
	local itemName = item:GetName()

	if itemName == "M_TO_MILL" then
		chapter:JumpRoom("Mill_ext")							--выход из мельницы
		return true
	
	elseif itemName == "M_TOOLS"  then							--переход в hidden object с инструментами
		chapter:JumpRoom("Mill_int_Tools_HO")
		return true
	end
			
	
	if itemName == "GLASS"  then						--стакан
		pick_panel:AddItems(itemName, false)
		return true
	end
end
--------------------------------------------------------------------------------
function OnChapterStoreEvent_Tools_HO(value)					--закрыть hidden object с инструментами
	if (value == 1) or (value == 3) then
		room:GetItem("M_TOOLS"):Hide()
	elseif value == 2 then
		room:GetItem("M_TOOLS"):Show()
	end
end
--------------------------------------------------------------------------------
function OnChapterStoreEvent_Cheat_MillInt(value)				--выполнить все в локации  !!!
	room:GetItem("GLASS"):Hide()
	cstore:SetKey("Tools_HO", 3)
end