layoutCryptStove.mExits =
{
}

layoutCryptStove.mPOIs = 
{
}

layoutCryptStove.mHOs = 
{
	[objectHoHmSlidingPiece01] = 
	{
		siblings = {objectHoHmSlidingPiece01Lit, objectHoHmSlidingPiece01Pocket},
	},
}

layoutCryptStove.mIOs =
{
	[objectIoStoveFire] = 
	{
		links = {objectHoFilesGroup, objectHoSpecimen01, objectHoSpecimen02, objectHoSpecimen03}
	},
	[objectIoStoveDoor] = 
	{
		links = {objectHoMetalStick}
	}
}
layoutCryptStove.mEffectBurningBack 	= nil
layoutCryptStove.mEffectCombustion 		= nil
-- ----------------------------------------------------------------------------
function layoutCryptStove:onConstruct()
	
	Layout.onConstruct(self)

	objectIoStoveDoor:ss(kIdle)
	objectStoveDoorOpen:ss(kInactive)
	objectIoStoveFire:ss(kInactive)
	
	layoutCryptStove.mEffectBurningBack  = self:newChildParticle( { name = "PARTICLE_CRYPTSTOVE_BURNING_BACK", x=237, y=268, library="PARTICLE_CRYPTSTOVE_BURNING", section="particles", play=true, removeWhenFinished=false } )
	layoutCryptStove.mEffectBurningBack:moveBehind(objectCryptStoveFireMask)
	layoutCryptStove.mEffectBurningBack:addInitialTime(10000)
	
	layoutCryptStove.mEffectCombustion   = self:newChildParticle( { name = "PARTICLE_CRYPTSTOVE_COMBUSTION",    x=240,  y=267, library="PARTICLE_CRYPTSTOVE_COMBUSTION", section="particles", play=false, removeWhenFinished=false } )
	layoutCryptStove.mEffectCombustion:moveBehind(objectCryptStoveFireMask)
	layoutCryptStove.mEffectCombustion:addInitialTime(10000)
	
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onClickIO(object, x, y)

	if (object == objectIoStoveDoor) then
		if (not gSelection) then
			if (not objectHoMetalStick:isFound()) then
				objectHoMetalStick:ss(kActive)
			end
			think("MESSAGE_STOVE_TOO_HOT")
			
			return true
		end	
	end
	
	return Layout.onClickIO(self, object, x, y)

end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onQuickPlay()
	for i, object in ipairs(self.mIOs[objectIoStoveFire].links) do
		object:ss(kFound)
	end
	objectIoStoveDoor:ss(kActive)
	objectHoMetalStick:ss(kFound)
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onUsedAll(object, props)

	Layout.onUsedAll(self, object, props)

	if (object == objectIoStoveDoor) then
		objectStoveDoorOpen:setAlpha(0)
		objectStoveDoorOpen:ss(kIdle)		
		objectStoveDoorOpen:animate("OpenDoor_blocking",
			{ alpha=0									},
			{ alpha=1,		duration=kTimeFadeSwitch	}
		)
		
		objectIoStoveDoor:ss(kIdle)
		objectIoStoveDoor:animate(
			{ alpha=0,		duration=kTimeFadeSwitch	}
		)
		
		objectIoStoveFire:ss(kActive)
		think("MESSAGE_STOVE_BURN_ALL")
		
		objectPoiStoveOpen:ss(kActive)
		objectPoiStoveClosed:ss(kInactive)
	end
	
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onStopEffect(effect)
	effect:stop()
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onUseObject(selectedObject, targetObject, targetProps)

	Layout.onUseObject(self, selectedObject, targetObject, targetProps)
	
	for i, object in ipairs(self.mIOs[objectIoStoveFire].links) do
		if (selectedObject == object) then
			self.mEffectBurningBack:animate(
				{ alpha=0.6, duration=300 	},
				{ delay=700					},
				{ alpha=1,	 duration=300	}
			)
			layoutCryptStove.mEffectCombustion:play()
		end
	end
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onMovieStart(movieName)

	Layout.onMovieStart(self, movieName)
	
	if (movieName == kMovieStove) then
		-- game play continues in the right side of the crypt
		-- so hide the stove
		self:hide()
		
		-- destroy the keypad poi trigger
		objectPoiKeypad:ss(kDone)
		objectPoiKeypadBroken:ss(kActive)
		
		-- destroy the keypad poi
		objectKeypadBroken:ss(kActive)
		objectHoWiresBattery:ss(kActive)
		
		-- update fire audio
		layoutCrypt:updateFireAudio(true)
		
	end

end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onStartAudio()
	layoutCrypt:updateFireAudio(true)
end
-- ----------------------------------------------------------------------------
function layoutCryptStove:onStopAudio()
	layoutCrypt:updateFireAudio(false)
end
