class 'InventoryBase' (Node)

function InventoryBase:__init(panel, order)
	Node.__init(self, panel:getMainEntity(), 'Inventory', order or 4)

	if self.CreateLoaderTable then
		local table_resource = self:CreateLoaderTable()
		LoadScene(self.main_entity, table_resource)
	end

	self.game_scene  = panel.game_scene
	self.timer		 = Timer()
	self.tools		 = {}
	self.activeTools = {}

	self.bOpen			= true
	self.openPosition	= nil
	self.closePosition	= nil
	self.closeAction	= nil	-- action, добавленый в timer, скрывающий инвентарь при потере им фокуса
	self.closeDelay		= 1.1	-- задержка скрытия инвентаря при потере им фокуса
	self.closeOpenTime	= 0.4	-- время проявления/скрытия инвентаря
	self.dropToolTime	= 0.3	-- время полета тулзы в инвентарь при ее сбросе

	self.organizer = CellsOrganizer(self, 10)
	self.organizer:postInit()
	self.organizer:createBlankCells()

	self:initOpenClosePositions()
	self:setupButtons()
	self:setupEvents()
	self:registerAllTools()
	
	if self:isLocked() then
		self:open()
	else
		self:close()
	end

	-- DOTO: временная мера для перехода на мультитачевый инвентарь
	do
		if self:hasEntityNamed('AnchorScissors') then
			self:getEntityNamed('AnchorScissors'):hide()
		end

		if self:hasEntityNamed('HintOnTool') then
			self:getEntityNamed('HintOnTool'):hide()
		end

		if self:hasEntityNamed('InventoryRoot') then
			self:getEntityNamed('InventoryRoot'):setSize(0, 0)
		end
	end
end
-------------------------------------------------------------------------------

function InventoryBase:postInit()
end
-------------------------------------------------------------------------------

function InventoryBase:initOpenClosePositions()
	self.openPosition	= Vector2f(0, 0)
	self.closePosition	= Vector2f(0, 70)
end
-------------------------------------------------------------------------------

function InventoryBase:setupButtons()
	local function on_left_button()
		self.organizer:shiftAt(1)
		self:checkShiftButtonsEnable()
	end
	-----
	
	local function on_right_button()
		self.organizer:shiftAt(-1)
		self:checkShiftButtonsEnable()
	end
	-----

	self.btn_left = self:getEntityNamed('InvLeftButton')
	self.btn_left.onPress:add(on_left_button)
	self.btn_left:setSendEventsToParent(true)
	self.btn_left:setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )

	self.btn_right = self:getEntityNamed('InvRightButton')
	self.btn_right.onPress:add(on_right_button)
	self.btn_right:setSendEventsToParent(true)
	self.btn_right:setSFXTrackOnPress( getCommonSoundEntity('ButtonClick') )


	-- Кнопки для закрепления инвентаря. Работает только если есть соотв. ентити
	if self:hasEntityNamed('LockButton') then
		self.btn_lock	= self:getEntityNamed('LockButton')
		self.btn_unlock	= self:getEntityNamed('UnlockButton')
	
		local function on_lock_button()
			self:lock()

			self.btn_lock:hide()
			self.btn_unlock:show()
		
			if self:getPanel():getMode() == EPanelMode.QUEST then
				self:open(self.closeOpenTime)
			end
		end
		-----------
	
		local function on_unlock_button()
			self:unlock()

			self.btn_unlock:hide()
			self.btn_lock:show()
			
			self:close(self.closeOpenTime)
		end
		-----------

		self.btn_lock.onPress:add(on_lock_button)
		self.btn_unlock.onPress:add(on_unlock_button)
		
		self.btn_lock:setSFXTrackOnPress(	getCommonSoundEntity('ButtonClick') )
		self.btn_unlock:setSFXTrackOnPress(	getCommonSoundEntity('ButtonClick') )

		if self:isLocked() then
			self.btn_lock:hide()
		else
			self.btn_unlock:hide()
		end
	end
end
-------------------------------------------------------------------------------

function InventoryBase:setupEvents()
	local update = function(entity, dt)
		self:onUpdate(dt)
	end
	-----

	self.game_scene:getWindow().onUpdate:add( update )

	self.main_entity:setHandlingChildEvents(true)
	self.main_entity.onFocusIn:add(  bind(self.onFocusInInventoryPanel,  self) )
	self.main_entity.onFocusOut:add( bind(self.onFocusOutInventoryPanel, self) )
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- GETTERS --------------------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:getPlayField()
	return self.game_scene:getPlayField()
end
-------------------------------------------------------------------------------

function InventoryBase:getPanel()
	return self.game_scene:getPanel()
end
-------------------------------------------------------------------------------

function InventoryBase:getTimer()
	return self.timer
end
-------------------------------------------------------------------------------

function InventoryBase:getCellsOrganizer()
	return self.organizer
end
-------------------------------------------------------------------------------

function InventoryBase:getTools()
	return self.tools
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- INVENTORY MANAGEMENT -------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:lock()
	AddUniqueGameState(INVENTORY_LOCK, 'true')
end
-------------------------------------------------------------------------------

function InventoryBase:unlock()
	if HasGameState(INVENTORY_LOCK) then
		RemoveGameState(INVENTORY_LOCK)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:isLocked()
	return HasGameState(INVENTORY_LOCK)
end
-------------------------------------------------------------------------------

function InventoryBase:open(time)
	if self.closeAction then
		self.closeAction:kill()
		self.closeAction = nil
	end

	if not self.bOpen then
		self.bOpen = true
		time = time or 0

		if time == 0 then
			self:getMainEntity():setPosition(self.openPosition)
			self:setShiftButtonsVisible(true)
		else
			playCommonSound('InventoryOpening')

			local effector = self:createOpenEffector(time)
			effector.onFinish:add(	function()
										self:setShiftButtonsVisible(true)
									end)
		end

		self.organizer:open(time)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:close(time)
	if self:canClose() then
		if self.closeAction then
			self.closeAction:kill()
			self.closeAction = nil
		end

		self.bOpen = false
		time = time or 0

		self:setShiftButtonsVisible(false)

		if time == 0 then
			self:getMainEntity():setPosition(self.closePosition)
		else
			local effector = self:createCloseEffector(time)
		end

		self.organizer:close(time)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:isOpen()
	return self.bOpen
end
-------------------------------------------------------------------------------

function InventoryBase:canClose()
	if self:isLocked() then
		return false
	end

	if not self:isOpen() then
		return false
	end

	if getToolComponent then
		local toolsInHand = self:getDraggingTools()

		for toolName, toolInfo in pairs(toolsInHand) do
			if getToolComponent(toolName) then
				return false
			end
		end
	end

	return true
end
-------------------------------------------------------------------------------

function InventoryBase:createOpenEffector(time)
	assert(time)

	local entity	= self:getMainEntity()
	local momentumY	= 3
	local deltaPos	= self.openPosition - entity:getPosition()
	local dir		= Vector2f(	deltaPos.x == 0 and 0 or deltaPos.x/math.abs(deltaPos.x),
							  	deltaPos.y == 0 and 0 or deltaPos.y/math.abs(deltaPos.y) )

	local effector = CreateAnimationEffector()
	effector:setDestroysOnEnd(true)
	effector:attachTo(entity)

	effector:setKey(_TRACK_X, 0,		entity:getX())
	effector:setKey(_TRACK_Y, 0,		entity:getY())
	effector:setKey(_TRACK_X, time*0.7,	self.openPosition.x + momentumY * dir.x)
	effector:setKey(_TRACK_Y, time*0.7,	self.openPosition.y + momentumY * dir.y)
	effector:setKey(_TRACK_X, time,		self.openPosition.x)
	effector:setKey(_TRACK_Y, time,		self.openPosition.y)
	effector:play()

	return effector
end
-------------------------------------------------------------------------------

function InventoryBase:createCloseEffector(time)
	assert(time)

	local entity	= self:getMainEntity()
	local effector	= entity:MoveTo(self.closePosition.x, self.closePosition.y, time)

	return effector
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- TOOLS ----------------------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:registerAllTools()
	local bCollectors	= IsLevelCollectorsEdition( current_scene:getName() )
	local toolsFolder	= bCollectors and TOOL_FOLDER_EXTRA or TOOL_FOLDER
	local toolsPathVec	= getResourceFolderSubfolders(toolsFolder)

	for i = 0, toolsPathVec:size() - 1 do
		local toolPath		= toolsPathVec:get(i)
		local iconsPathVec	= getResourceFolderFiles(toolPath)

		local toolName		= ExtractFileName(toolPath)
		local invIconPath	= nil
		local wndIconPath	= nil
		local bTempMarker = false
		
		for j = 0, iconsPathVec:size() - 1 do
			local iconPath = iconsPathVec:get(j)

			if string.find(iconPath, 'inv') then
				invIconPath = iconPath
			elseif string.find(iconPath, 'wnd') then
				wndIconPath = iconPath
			elseif string.find(iconPath, 'tmp') then
				bTempMarker = true
			end
		end
		
		self:registerTool(toolName, invIconPath, wndIconPath, bTempMarker)
	end

	self.organizer:checkCellsVisible()
	self:checkShiftButtonsEnable()

	-- Добавляем в команду консоли поика тулзов.
	if not isBuildForCustomerMode() then
		local command = Console:getCommand('findTool')
		
		if command then
			for toolName, toolInfo in pairs(self.tools) do
				if not IsToolFound(toolName) then
					command:addPossibleParam(toolName)
				end
			end
		end
	end
end
-------------------------------------------------------------------------------

function InventoryBase:registerTool(toolName, invIconPath, wndIconPath, bTempMarker)
	local toolInfo = ToolInfo(toolName)

	toolInfo:setInvIconPath(invIconPath)
	toolInfo:setWndIconPath(wndIconPath)

	if bTempMarker then
		toolInfo:tempMarker()
	end

	self.tools[toolName] = toolInfo

	if	ToolHelpers.isToolFound(toolName)	  and
		ToolHelpers.isToolInfoShown(toolName) and
		not ToolHelpers.isToolApplied(toolName)
	then
		self:addTool(toolInfo)
		self:onToolFound(toolInfo)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:getToolInfo(toolName)
	assert(toolName)
	return self.tools[toolName]
end
-------------------------------------------------------------------------------

function InventoryBase:addTool(toolInfo)
	local cell = self:getCellByToolInfo(toolInfo)

	if cell then
		-- добавление тулзы в коллекцию
	else
		local index	= self.organizer:getNewCellIndex(toolInfo)
		cell = self.organizer:getCell(index)

		if not cell then -- все созданные при старте ячейки уже занятые
			cell = self.organizer:createCell(index)
		end

		toolInfo:setCollectionOwner(true)
		toolInfo:createDragObject(	self.game_scene,
									bind(self.onToolTake,	self, toolInfo),
									bind(self.onToolDrop,	self, toolInfo),
									bind(self.onToolClick,	self, toolInfo) )
		cell:setToolInfo(toolInfo)
	end

	self.activeTools[toolInfo.name] = toolInfo
	cell:updateCollectionText()
end
-------------------------------------------------------------------------------

function InventoryBase:removeTool(toolInfo)
	toolInfo:getDragObject():deactivate()

	local entity	= toolInfo:getDragObject():getDraggedEntity()
	local effector	= entity:ChangeOpacity(nil, 0, 0.25)

	entity:attachInPlace(self.main_entity)
	entity:setMaxOrder()

	effector.onFinish:add(	function()
								entity:destroy()
							end)
	
	self.activeTools[toolInfo:getName()] = nil

	local _, cellIndex = self:getCellByToolInfo(toolInfo)
	self.organizer:removeCell(cellIndex)
	self:checkShiftButtonsEnable()
end
-------------------------------------------------------------------------------

function InventoryBase:isActiveTool(toolInfo)
	assert(toolInfo)
	return self.activeTools[toolInfo:getName()] ~= nil
end
-------------------------------------------------------------------------------

function InventoryBase:getActiveToolInfo(toolName)
	assert(toolName)
	return self.activeTools[toolName]
end
-------------------------------------------------------------------------------

function InventoryBase:takeTool(toolInfo, screenFocus)
	assert(screenFocus)

	local dragObject = toolInfo:getDragObject()
	dragObject:take(screenFocus)
end
-------------------------------------------------------------------------------

function InventoryBase:dropTool(toolInfo, time, bDontMoveToCell)
	local dragObject = toolInfo.dragObject

	if dragObject:isDragging() then
		local sessionData = dragObject:getSessionData()
		sessionData.bIgnoreApply	= true
		sessionData.toolDropTime	= time
		sessionData.bDontMoveToCell	= bDontMoveToCell
		dragObject:drop()
	elseif OS_MOBILE and not bDontMoveToCell then
		self:moveToolToCell(toolInfo, time)
	end
end
-------------------------------------------------------------------------------

-- preferable to use abortDrags function
function InventoryBase:dropAllTools(time)
	local draggingTools = self:getDraggingTools()

	for toolName, toolInfo in pairs(draggingTools) do
		if toolInfo:getDragObject():isDragging() then
			self:dropTool(toolInfo, time)
		end
	end
end
-------------------------------------------------------------------------------

function InventoryBase:moveToolToCell(toolInfo, time)
	local cell = self:getCellByToolInfo(toolInfo)
	assert(cell)

	time = time or self.dropToolTime

	if time == 0 then
		self:onToolMoveToCellFinish(toolInfo, cell)
	else
		local toolEntity = toolInfo:getDragObject():getDraggedEntity()
		toolEntity:attachInPlace(self.main_entity)
		toolEntity:setMaxOrder()

		local targetPos	= self.main_entity:screenToLocal( cell:getIconScrPosition() )
		local callback	= bind(self.onToolMoveToCellFinish, self, toolInfo, cell)
		local effector	= CreateAnimationEffector()

		effector:attachTo(toolEntity)
		effector:setDestroysOnEnd(true)
		effector.onFinish:add(callback)
		effector:setKey(_TRACK_X, 0, toolEntity:getX())
		effector:setKey(_TRACK_Y, 0, toolEntity:getY())
		effector:setKey(_TRACK_S, 0, toolEntity:getScale().x)
		effector:setKey(_TRACK_X, time, targetPos.x)
		effector:setKey(_TRACK_Y, time, targetPos.y)
		effector:setKey(_TRACK_S, time, cell:getIconScale())
		effector:play()
	end

	local callback = toolInfo.on_drop
	if callback then
		local event    = {}
		event.toolName = toolInfo:getName()
		
		callback(event)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:onToolMoveToCellFinish(toolInfo, cell)
	local toolEntity = toolInfo:getDragObject():getDraggedEntity()
	local toolOrder	 = cell:getToolOrder()

	cell:placeIcon(toolEntity, toolOrder)
	cell:getTakeBlocker():pop()
end
-------------------------------------------------------------------------------

--TODO: очищать и локальные таргеты
function InventoryBase:clearToolsEvents()
	for _, toolInfo in pairs(self.tools) do
		toolInfo.on_apply	= nil
		toolInfo.on_get		= nil
		toolInfo.on_drop	= nil
		toolInfo.on_find	= nil
		toolInfo.on_tool_window_close = nil
	end
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- TOOL FOUND SCREEN ----------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:checkFoundButNotShownTools()
	for toolName, toolInfo in pairs(self.tools) do
		if ToolHelpers.isToolFound( toolName )
			and not ToolHelpers.isToolApplied( toolName )
			and not ToolHelpers.isToolInfoShown( toolName )
			and not toolInfo.notInInventoryYet -- фикс во избежания появления двух окон тулфайнд
		then
			self:addTool(toolInfo)
			self:showToolFoundScreen(toolInfo)
		end
	end
end
-------------------------------------------------------------------------------

function InventoryBase:showToolFoundScreen(toolInfo)
	local cell = self:getCellByToolInfo(toolInfo)
	cell:getTakeBlocker():push()

	-- если тулза не относится к коллекции или является первой найденой из коллекции
	if cell:getToolInfo():getName() == toolInfo:getName() then
		cell:getShadowIcon():setVisible(false)
		cell:setWaitingTool(true)
	end

	toolInfo.notInInventoryYet = true

	local topScreen	= PopUpScreensMgr:GetTop()
	local screen	= Helpers.CallFunctionByName('ToolFoundScreen', 'ToolFoundScreen')
	screen:setToolInfo(toolInfo)

	if topScreen and topScreen:getName() == self.game_scene:getName() then
		PopUpScreensMgr:push(screen, false)
	else
		--GameScene еще не находится в стеке
		local mouseBlocker = self:getPlayField():getMouseBlocker()
		mouseBlocker:push()
		self.timer:add(	function()
							mouseBlocker:pop()
							PopUpScreensMgr:push(screen, false)
						end, 0)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:moveInfoIconToInventory(icon, toolInfo)
	ToolHelpers.setToolInfoShown(toolInfo:getName())

	local cell, cellIndex = self:getCellByToolInfo(toolInfo)
	local toolEntity = cell:getToolInfo():getDragObject():getDraggedEntity()

	local targetShift = math.min(0, self.organizer:getSlotsCount() - cellIndex)
	local targetPos	  = self.organizer:getPosByShiftAndCellIndex(targetShift, cellIndex)
	local targetScale = toolEntity:getWidth() * toolEntity:getScale().x / icon:getWidth()
	local moveTime	  = 1
	
	icon:attachInPlace(self.main_entity)
	icon:setMaxOrder()

	-- FIXME Добавить партиклы
	--icon:SetZ(TOOL_IN_INVENTORY_Z)
	--icon:AddParticleSystem('Data/ParticleSystem/ObjectMoveTail.psi', 'ZoneHighlightParticle', true)
		
	local effector = CreateAnimationEffector()
	effector:setDestroysOnEnd(true)
	effector:attachTo(icon)

	effector:setKey(_TRACK_X, 0,		icon:getX())
	effector:setKey(_TRACK_Y, 0,		icon:getY())
	effector:setKey(_TRACK_S, 0,		icon:getScale().x)
	effector:setKey(_TRACK_X, moveTime,	targetPos.x)
	effector:setKey(_TRACK_Y, moveTime,	targetPos.y)
	effector:setKey(_TRACK_S, moveTime,	targetScale)
	effector:setKey(_TRACK_O, moveTime * 0.9, 1)
	effector:setKey(_TRACK_O, moveTime, 0.5)
	effector:play()

	self:open(self.closeOpenTime)
	self.organizer:shiftTo(targetShift)

	effector.onFinish:add(	function()
								cell:getShadowIcon():setVisible(true)
								cell:setWaitingTool(false)
								cell:getTakeBlocker():pop()

								toolInfo.notInInventoryYet = nil

								icon:destroy()
								self:onToolFound(toolInfo)

								if self:canClose() then
									self:close(self.closeOpenTime)
								end
							end)
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- EVENTS ---------------------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:onUpdate(dt)
	self.timer:update(dt)
end
-------------------------------------------------------------------------------

function InventoryBase:onFocusInInventoryPanel()
	self:open(self.closeOpenTime)
end
-------------------------------------------------------------------------------

function InventoryBase:onFocusOutInventoryPanel()
	local action = function()
		self:close(self.closeOpenTime)
	end

	self.closeAction = self.timer:add(action, self.closeDelay)
end
-------------------------------------------------------------------------------

function InventoryBase:onToolFound(toolInfo)
	self:checkShiftButtonsEnable()

	local cell = self:getCellByToolInfo(toolInfo)
	GetScoreManager():addScoreToolFound(toolInfo:getName(), cell:getTakeTarget())
end
-------------------------------------------------------------------------------

function InventoryBase:onToolTake(toolInfo, e)
	if not self:getPlayField():getMouseBlocker():isHold() then
		self:getPlayField():hideBlackBar()
	end

	local cell = self:getCellByToolInfo(toolInfo)
	cell:getTakeBlocker():push()

	self:createDraggedToolPulseEffector(toolInfo)

	if OS_MOBILE then
		self:createDraggedToolHintText(toolInfo)
	end

	local callback = toolInfo.on_get
	if callback then
		local event	   = {}
		event.toolName = toolInfo.name
		callback(event)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:onToolDrop(toolInfo, e)
	local sessionData = e.sender:getSessionData()
	local bTryApply	  = not (e.bAborted or sessionData.bIgnoreApply)

	e.afterDrop = nil

	do
		local toolEntity = toolInfo:getDragObject():getDraggedEntity()

		toolEntity.properties.pulseEffector:destroy()
		toolEntity.properties.pulseEffector = nil

		if toolEntity.properties.hintText then
			toolEntity.properties.hintText:destroy()
			toolEntity.properties.hintText = nil
		end
	end

	if OS_MOBILE and bTryApply then
		local screenFocus	= e.sender:getSessionData().screenFocus
		local target		= sessionData.customTarget or screenFocus:getPointedResponder()

		if target.properties and target.properties.doTryToolApply then
			target.properties.doTryToolApply(toolInfo)
		else
			self:getPlayField():tryToolApply(toolInfo, target)
		end
	elseif not sessionData.bDontMoveToCell then
		local time = e.bAborted and 0 or sessionData.toolDropTime
		self:moveToolToCell(toolInfo, time)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:onToolClick(toolInfo, e)
	if not e.bPassClick then
		local playfield		= self:getPlayField()
		local sessionData	= e.sender:getSessionData()
		local target		= sessionData.screenFocus:getPointedResponder()

		e.bCancelDrop = true
		if target.properties and target.properties.doTryToolApply then
			target.properties.doTryToolApply(toolInfo)
		else
			playfield:tryToolApply(toolInfo, target)
		end
	end
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- HELPERS --------------------------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:getCellByToolInfo(toolInfo)
	local predicate = function(cell)
		local cellToolInfo = cell:getToolInfo()

		if cellToolInfo then
			if cellToolInfo.name == toolInfo.name then
				return true
			elseif cellToolInfo.additional_info.collection then
				local collectionTools = cellToolInfo.additional_info.collection:get_tools()

				for i, toolName in pairs(collectionTools) do
					if toolName == toolInfo.name and self:isActiveTool(cellToolInfo) then
						return true
					end
				end
			end
		end

		return false
	end
	-----

	local cell, index = self.organizer:findCell(predicate)
	return cell, index
end
------------------------------------------------------------------------------

function InventoryBase:getDraggingTools()
	local result = {}

	for toolName, toolInfo in pairs(self.activeTools) do
		local dragObject = toolInfo:getDragObject()

		if dragObject and dragObject:isDragging() then
			result[toolName] = toolInfo
		end
	end

	return result
end
------------------------------------------------------------------------------

function InventoryBase:checkShiftButtonsEnable()
	if self.organizer:canShiftForward() then
		self.btn_right:setActive(true)
	else
		self.btn_right:setPressed(false)
		self.btn_right:setActive(false)
	end

	if self.organizer:canShiftBack() then
		self.btn_left:setActive(true)
	else
		self.btn_left:setPressed(false)
		self.btn_left:setActive(false)
	end
end
-------------------------------------------------------------------------------

function InventoryBase:setShiftButtonsVisible(bVisible)
	self.btn_right:setVisible(bVisible)
	self.btn_left:setVisible(bVisible)
end
-------------------------------------------------------------------------------

function InventoryBase:createDraggedToolPulseEffector(toolInfo)
	local toolEntity = toolInfo:getDragObject():getDraggedEntity()
	local baseScale	 = toolEntity:getScale().x
	local eff		 = CreateAnimationEffector()

	eff:attachTo( toolEntity )
	eff:setMode(_ANIM_LOOP)
	eff:setKey(_TRACK_S, 0,    baseScale)
	eff:setKey(_TRACK_S, 0.65, baseScale + 0.1)
	eff:setKey(_TRACK_S, 1.,   baseScale)
	eff:play()

	toolEntity.properties.pulseEffector = eff
	return eff
end
-------------------------------------------------------------------------------

function InventoryBase:createDraggedToolHintText(toolInfo)
	local toolEntity = toolInfo:getDragObject():getDraggedEntity()
	local textEntity = CreateTextEntity()

	textEntity:attachTo	 ( toolEntity )
	textEntity:setXY	 ( 0, -40 )
	textEntity:setFont	 ( 'Data/Fonts/Options.fnt' )
	textEntity:setText	 ( toolInfo:getHintText() )
	textEntity:setRespondable( false )

	toolEntity.properties.hintText = textEntity
	return textEntity
end
-------------------------------------------------------------------------------


-------------------------------------------------------------------------------
-- !!!!! NEED REMOVE !!!!! ----------------------------------------------------
-------------------------------------------------------------------------------

function InventoryBase:getToolInfoByName(toolName)
	return self:getActiveToolInfo(toolName)
end
-------------------------------------------------------------------------------

function InventoryBase:lockInventory()
	self:lock()
end
-------------------------------------------------------------------------------

function InventoryBase:unlockInventory()
	self:unlock()
end
-------------------------------------------------------------------------------

function InventoryBase:slideUp(time)
	self:open(time)
end
-------------------------------------------------------------------------------

function InventoryBase:slideDown(time)
	self:close(time)
end
-------------------------------------------------------------------------------


--------------------------------------------------------------------------------
--                      GENERATED CONTENT. DO NOT EDIT.                       --
--------------------------------------------------------------------------------

function InventoryBase:CreateLoaderTable()
	local objects =
	{
	}
	return objects
end
