--------------------------------------------------------------------------------
--  File     : Hut_2nd_floor_Telescope
--  Author(s): Prokopovich Larisa
--
--  Summary  : Скрипт управления локацией.
--
--  Copyright © 2012 Floodlight Games.  All rights reserved.
--------------------------------------------------------------------------------
LOC_2FLOOR				= "Hut_2nd_floor"

I_LENS					= "LENS"					--линза
I_N_LENS				= "N_LENS"					--накладка на линзу
I_TEL_PART2				= "TEL_PART2"				--часть трубы
I_TEL_PART2_LYING		= "TEL_PART2_LYING"			--лежащая часть трубы
--------------------------------------------------------------------------------
function OnFirstEntry()
	comment:Add("CMT_Telescope_Player")
	cstore:SetKey("Close_up_Telescope", 0)
	
	stars:Show(I_LENS, "4")
end
--------------------------------------------------------------------------------
function OnMouseClickOnBack()
	chapter:ExitCloseup()
	return true
end
--------------------------------------------------------------------------------
function OnMouseClickOnItem(item)
	local itemName = item:GetName()
	
	if itemName == I_TEL_PART2 then						--часть трубы
		item:Hide()
		room:GetItem(I_TEL_PART2_LYING):Show()
		cstore:SetKey("Close_up_Telescope", 1)
		room.sfx:Play ("disassemble_magnifier")			--звук "разбираем телескоп"
		return true

	elseif itemName == I_LENS then						--линза
		room:GetItem(I_N_LENS):Hide()
		cstore:SetKey("Close_up_Telescope", 2)
		pick_panel:AddItems(itemName, true)
		room:MarkCompleted()
		room.sfx:Play ("unscrew_lens")					--звук "скручиваем линзу у телескопа"
		return true
	end
end
--------------------------------------------------------------------------------