layoutLivingroomTelevision.thoughtSameWires = false
layoutLivingroomTelevision.hiddenTelevision = false
-- ----------------------------------------------------------------------------
layoutLivingroomTelevision.mExits =
{
}
layoutLivingroomTelevision.mPOIs = 
{
}
layoutLivingroomTelevision.mHOs = 
{
	[objectLivingroomWires] = 
	{
	},
}
layoutLivingroomTelevision.mIOs =
{
	[objectLivingroomTelevisionPlatePocket1] = 
	{
	},
	[objectLivingroomTelevisionPlatePocket2] = 
	{
	},
	[objectLivingroomWiresFixed] = 
	{
		links = {objectBasementWrench}
	},
	
}
-- ----------------------------------------------------------------------------
function layoutLivingroomTelevision:onConstruct()

	Layout.onConstruct(self)
	
	objectLivingroomTelevisionPlatePocket1:ss(kIdle)
	objectLivingroomTelevisionPlatePocket2:ss(kInactive)
	objectLivingroomTelevisionPlateOpen:ss(kInactive)
	objectLivingroomTelevisionSocketOpen:ss(kInactive)
	objectLivingroomWiresFixed:ss(kInactive)
	objectLivingroomWires:ss(kInactive)
	
end
-- ----------------------------------------------------------------------------
function layoutLivingroomTelevision:onShow()

	Layout.onShow(self)
	
	if (self.thoughtSameWires == false and goalGatherRadioParts:isStarted() and (not goalGatherRadioParts:isFinished())) then
		think("MESSAGE_LIVINGROOM_TELEVISION")
		self.thoughtSameWires = true
	end
	
	if (objectLivingroomTelevisionAnimation:isIdle()) then
		self.hiddenTelevision = true
		objectLivingroomTelevisionAnimation:ss(kInactive)
	end
	
end
-- ----------------------------------------------------------------------------
function layoutLivingroomTelevision:onHide()

	Layout.onHide(self)
	
	if (self.hiddenTelevision and not objectLivingroomTelevisionAnimation:isDone()) then
		objectLivingroomTelevisionAnimation:ss(kIdle)
	end
	
end
-- ----------------------------------------------------------------------------
function layoutLivingroomTelevision:onClickIO(object, x, y)

	if (object == objectLivingroomTelevisionPlatePocket1) then
		objectLivingroomTelevisionPlatePocket1:ss(kDone)
		objectLivingroomTelevisionPlatePocket2:ss(kActive)
		playAudioTrack("BEND_METAL_CORNER")
		return true
	end
	
	if (object == objectLivingroomTelevisionPlatePocket2) then
		objectLivingroomTelevisionPlatePocket2:ss(kDone)
		objectLivingroomTelevisionPlateOpen:ss(kIdle)
		objectLivingroomWiresFixed:ss(kActive)
		objectBasementWrench:ss(kActive)
		think("MESSAGE_TELEVISION_USE_CUTTERS")
		playAudioTrack("BEND_METAL_CORNER")
		return true
	end
	
	return Layout.onClickIO(self, object, x, y)

end
-- ----------------------------------------------------------------------------
function layoutLivingroomTelevision:onUsedAll(object, props)

	Layout.onUsedAll(self, object, props)

	if (object == objectLivingroomWiresFixed) then
		objectLivingroomTelevisionSocketOpen:ss(kIdle)
		objectLivingroomTelevisionPlateOpen:ss(kDone)
		objectLivingroomWiresFixed:ss(kDone)
		objectLivingroomWires:ss(kFound)
		playAudioTrack("GOOD_CLICK_FX")
		-- the tv stops animating!
		ghf.cancelAnimation("televisionAnimation")
		objectLivingroomTelevisionAnimation:ss(kDone)
	end

end