-- ----------------------------------------------------------------------------
layoutCryptKeypad.mHOs = 
{
}
layoutCryptKeypad.mIOs =
{
	[objectHoWiresBattery] =
	{
		links = {objectHoHook},
		cursor = kCursorDefault, 
		siblings = {objectHoWiresBatteryLit, objectHoWiresBatteryPocket}
	}
}
layoutCryptKeypad.mEffectSpark = nil
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:onConstruct()
	
	Layout.onConstruct(self)

	objectKeypadBroken:ss(kInactive)
	objectHoWiresBattery:ss(kInactive)
	
	self.mEffectSpark = self:newChildParticle( { name = "PARTICLE_CRYPTKEYPAD_SPARK",    x=249,  y=177, library="PARTICLE_CRYPT_KEYPAD_SPARK_POI", section="particles", play=false, removeWhenFinished=false } )
	
end
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:onInitialize()

	Layout.onInitialize(self)
	
end
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:onShow()

	Layout.onShow(self)
	
	-- when not broken
	-- christine thinks
	if (objectKeypadBroken:isInactive()) then
		think("MESSAGE_KEYPAD_CODE")
	end	
	
end
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:onUsedAll(object, props)

	if (object == objectHoWiresBattery) then
		objectHoWiresBattery:ss(kFound)
		playAudioTrack("GOOD_CLICK_FX")
	end

end
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:animKeypadSpark()

	self.mEffectSpark:play()

	local delay = math.random(2000, 3500)
	
	self:animate("animKeypadSparkDelay",
		{ delay=delay } 
	)	

end
-- ----------------------------------------------------------------------------
function layoutCryptKeypad:onAnimationFinish(animationName)

	Layout.onAnimationFinish(self, animationName)
		
	if (animationName == "animKeypadSparkDelay") then
		self:animKeypadSpark()
	end

end