function add_fibrillation_effector_light(obj, delay)
	local duration = 4.0

	eff= CreateAnimationEffector()
	eff:AttachTo(obj)
	eff:SetMode(_ANIM_LOOP)

    local dopacity = -0.

	eff:SetKey(_TRACK_O, 0.0 + delay, 1.0 + dopacity)
	eff:SetKey(_TRACK_O, duration * 1.0/4.0 + delay, 0.75 + dopacity)
	eff:SetKey(_TRACK_O, duration * 2.0/4.0 + delay, 1.0 + dopacity)
	eff:SetKey(_TRACK_O, duration * 3.0/4.0 + delay, 0.59 + dopacity)
	eff:SetKey(_TRACK_O, duration * 4.0/4.0 + delay, 1.0 + dopacity)
	eff:Play()
end

function OnSceneLoad(screen)
    LoadData(screen)
    DefaultOnSceneLoad('data/Scenes/15_Theatre_Workshop_Inside_HO.lua', 'hidden_object', 'data/Scenes/15_Theatre_Workshop_Inside_Main.lua')

	local level = play_field:GetLevelScreen()
    level:AddTask(CreateTask('ANVIL', '', 'Anvil'))
    level:AddTask(CreateTask('BRUSH', 'BRUSHES', 'Brush', 'Brush2'))
    level:AddTask(CreateTask('CARDS', '', 'Cards'))
    level:AddTask(CreateTask('BOWKNOT', '', 'Bowknot'))
    level:AddTask(CreateTask('CRAWFISH', '', 'Crawfish'))
    level:AddTask(CreateTask('CURVE', 'CURVES', 'Curve', 'Lekalo1', 'Lekalo2'))
    level:AddTask(CreateTask('HAMMER', 'HAMMERS', 'Hamer1', 'Hammer2'))
    level:AddTask(CreateTask('HANDPRINT', '', 'Hand'))
    level:AddTask(CreateTask('MAPLE_LEAF', '', 'Maple_Leaf'))
    level:AddTask(CreateTask('ORIGAMI', 'ORIGAMI', 'Origami', 'Origami1', 'Origami2', 'Origami3'))
    level:AddTask(CreateTask('SAW', 'SAWS', 'Saw1', 'Saw2'))
    level:AddTask(CreateTask('SNOWFLAKE', '', 'Snowflake'))

    RegisterToolFindInfo('15_hammer', nil, nil, nil)

	local on_click = function()
		play_field:GetObject('Layer_Shtora_Closed'):ChangeOpacity(1., 0., 0.3)
		MakeSoundEntity('15_Open_Curtain'):Play(false);
	end
	local on_load_when_clicked = function()
		play_field:GetObject('Layer_Shtora_Closed'):SetOpacity(0.)
	end
	RegisterActiveObject('Layer_Shtora_Closed', on_click, on_load_when_clicked)

    play_field:IgnoreOnTestPoint('BG_Lekalo1')
    play_field:IgnoreOnTestPoint('BG_Lekalo2')
    --add_fibrillation_effector_light(play_field:GetObject('Layer_Light'), 0.)
	
	LoadSound('15_Open_Curtain', 'data/Sound/15_Theatre_Workshop_Inside/Open_Curtain.ogg');
end

function OnSceneFree(screen)
    DefaultOnSceneFree()
    FreeData(screen)
end

function OnUpdate(dt)
    DefaultOnUpdate(dt)
end

function OnAllItemsFound()
    DefaultOnAllItemsFound()
end

function OnLose()
    DefaultOnLose()
end

function OnExit()
    DefaultOnExit()
end

function OnClose()
    DefaultOnClose()
end

function OnObjectMouseEnter(object)
    DefaultOnObjectMouseEnter(object)
end

function OnObjectMouseLeave(object)
    DefaultOnObjectMouseLeave(object)
end

function OnObjectMouseDown(object)
    local is_wrong_click = not DefaultOnObjectMouseDown(object)
    local obj_name = object:GetName()
    local pf = play_field

    DefaultOnObjectMouseDownProcessed(is_wrong_click);
end

function OnObjectMouseUp(object)
    DefaultOnObjectMouseUp(object)
end

function OnObjectFound(object)
    DefaultOnObjectFound(object)
end

function OnToolFound(tool)
    DefaultOnToolFound(tool)
end

function OnToolApply(tool, object)
    DefaultOnToolApply(tool, object)
end

function OnObjectReachPanel(object)
    DefaultOnObjectReachPanel(object)
end

function OnButtonPress(title)
    DefaultOnButtonPress(title)
end

function OnMouseMove(previous_pos, current_pos)
    DefaultOnMouseMove(previous_pos, current_pos)
end

function OnSetTool(tool)
    DefaultOnSetTool(tool)
end

function LevelLoaded(level)
end

function OnSceneDestroy(playfield)
    DefaultOnSceneDestroy(playfield)
end

--------------------------------------------------------------------------------
-- CLEAR_ON_SAVE_BEGIN
-- Do not edit code listed below (generated by the editor on each save)
function LoadData(screen)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/BG_Workshop_Inside.JPG',0,0,1024,768,1,0)
	anim:SetHotSpot(512,384)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('BG_Workshop_Inside',anim,512,384,40,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Anvil.PNG',0,0,110,79,1,0)
	anim:SetHotSpot(55,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Anvil',anim,51,131,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Brush2.PNG',0,0,91,57,1,0)
	anim:SetHotSpot(45,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Brush2',anim,39,276,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Brush.PNG',0,0,70,109,1,0)
	anim:SetHotSpot(35,54)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Brush',anim,976,470,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Cards.PNG',0,0,79,99,1,0)
	anim:SetHotSpot(39,49)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Cards',anim,731,138,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Bowknot.PNG',0,0,86,68,1,0)
	anim:SetHotSpot(43,34)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Bowknot',anim,626,364,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Crawfish.PNG',0,0,67,59,1,0)
	anim:SetHotSpot(33,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Crawfish',anim,318,385,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Curve.PNG',0,0,124,38,1,0)
	anim:SetHotSpot(62,19)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Curve',anim,110,483,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Hamer1.PNG',0,0,78,137,1,0)
	anim:SetHotSpot(39,68)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Hamer1',anim,143,403,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Hammer2.PNG',0,0,224,78,1,0)
	anim:SetHotSpot(112,39)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Hammer2',anim,511,592,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Hand.PNG',0,0,58,59,1,0)
	anim:SetHotSpot(29,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Hand',anim,877,110,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Maple_Leaf.PNG',0,0,60,56,1,0)
	anim:SetHotSpot(30,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Maple_Leaf',anim,256,29,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Origami.PNG',0,0,70,53,1,0)
	anim:SetHotSpot(35,26)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Origami',anim,479,218,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Saw1.PNG',0,0,239,58,1,0)
	anim:SetHotSpot(119,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Saw1',anim,77,372,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Saw2.PNG',0,0,95,189,1,0)
	anim:SetHotSpot(47,94)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Saw2',anim,412,479,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items/Snowflake.PNG',0,0,70,72,1,0)
	anim:SetHotSpot(35,36)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Snowflake',anim,758,38,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Cards_Over.PNG',0,0,36,123,1,0)
	anim:SetHotSpot(18,61)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Cards_Over',anim,713,152,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Origami_over.PNG',0,0,25,97,1,0)
	anim:SetHotSpot(12,48)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Origami_over',anim,507,251,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Curve_Over.png',0,0,124,55,1,0)
	anim:SetHotSpot(62,27)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Curve_Over',anim,125,476,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Hammer_Over.png',0,0,47,31,1,0)
	anim:SetHotSpot(23,15)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Hammer_Over',anim,602,625,103,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Brush_Over.png',0,0,137,60,1,0)
	anim:SetHotSpot(68,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Brush_Over',anim,953,505,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Saw_Over.png',0,0,62,74,1,0)
	anim:SetHotSpot(31,37)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Saw_Over',anim,181,403,101,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers/Layer_Shtora_Closed.png',0,0,363,544,1,0)
	anim:SetHotSpot(181,272)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Shtora_Closed',anim,537,272,110,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items_add/Lekalo1.png',0,0,73,150,1,0)
	anim:SetHotSpot(36,75)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Lekalo1',anim,822,416,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items_add/Origami1.png',0,0,73,57,1,0)
	anim:SetHotSpot(36,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Origami1',anim,581,74,120,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items_add/Origami2.png',0,0,73,59,1,0)
	anim:SetHotSpot(36,29)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Origami2',anim,110,255,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items_add/Origami3.png',0,0,63,46,1,0)
	anim:SetHotSpot(31,23)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Origami3',anim,601,541,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers_add/BG_Lekalo1.png',0,0,54,156,1,0)
	anim:SetHotSpot(27,78)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('BG_Lekalo1',anim,837,422,105,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers_add/BG_Lekalo2.png',0,0,93,56,1,0)
	anim:SetHotSpot(46,28)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('BG_Lekalo2',anim,466,143,100,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Items_add/Lekalo2.png',0,0,85,65,1,0)
	anim:SetHotSpot(42,32)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Lekalo2',anim,633,29,115,0,1,1)
	local anim = CreateAnimation('data/Texture/Scenes/15_Theatre_Workshop_Inside/Zone_HO/Layers_add/Layer_Lekalo2_Over.png',0,0,152,60,1,0)
	anim:SetHotSpot(76,30)
	anim:SetBlendMode(2)
	anim:SetColor('0xFFFFFFFF')
	screen:CreateObject('Layer_Lekalo2_Over',anim,609,40,116,0,1,1)
end

function FreeData(screen)
end
-- CLEAR_ON_SAVE_END
