--------------------------------------------------------------------------------
--  File     :Witch's_house_int_Cache
--  Author(s): Prokopovich Larisa
--
--  Summary  : Скрипт управления локацией.
--
--  Copyright © 2012 Floodlight Games.  All rights reserved.
--------------------------------------------------------------------------------
function OnFirstEntry()
	stars:Show("SLEEP_POWDER", "4")
	stars:Show("VIAL", "4")
end
--------------------------------------------------------------------------------
function OnMouseClickOnBack()
	chapter:ExitCloseup()
	return true
end
--------------------------------------------------------------------------------
function OnMouseClickOnItem(item)
	local itemName = item:GetName()
	
	if itemName == "SLEEP_POWDER" then			--сонный порошок	
		EndCloseup("VIAL", "SLEEP_POWDER")
		cstore:SetKey("Sleep_Powder", 1)
		return true	
	
	elseif itemName == "VIAL" then				--пузырек	
		EndCloseup("SLEEP_POWDER", "VIAL")
		cstore:SetKey("VialFind", true)
		return true	
	end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function EndCloseup(check_name, pick_name)
	if room:GetItem(check_name):IsVisible() then
		pick_panel:AddItems(pick_name, false)
	else
		cstore:SetKey("Close_up_Cache", true)
		pick_panel:AddItems(pick_name, true)
		room:MarkCompleted()
	end
end