-- ************************************ Chair ************************************ --
YogaMat = deriveLuaClass("YogaMat", "WorkStation")

function YogaMat:init(desc)
	YogaMat.superInit(desc)
	self.babyObject = desc.babyObject
end

function YogaMat:onTreatmentStart(task)
    local character = self:getOccupant(0)
    if (character and character.curStepValue == "DIAPER_PRACTICE" and self.babyObject ~= nil) then
        local baby = level:getSpriteExt(self.babyObject)
        if (baby) then
	        baby.visible = false
        end
    end
end

function YogaMat:onWorkFinish(task)
	if (self.babyObject ~= nil) then
		level:getSpriteExt(self.babyObject).visible = true
	end
	YogaMat.super.onWorkFinish(self, task)
end

function YogaMat:onCureStart()
	local character = self:getOccupant(0)
	assert(character)
	if (character.curStepValue == "YOGA") then
		self:getOccupant(0):playAnimation(self.yogaAnimation, -1, "stay", self.yogaAnimationFrameTime)
		return false
	end
	return true
end

function YogaMat:onCureFinish()
	if (self:getOccupant(0)) then
		self:getOccupant(0):playDefaultAnimation()
	end
end
