-- LocWinterGarden

LocWinterGarden = Location:new("LocWinterGarden")

----------------------------------------------------------------------------------------------------
function LocWinterGarden_UPDATE()
	return 0
end

----------------------------------------------------------------------------------------------------
function LocWinterGarden_INIT()
    LocWinterGarden:init()
end

----------------------------------------------------------------------------------------------------
LocWinterGarden:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'spruce', 'balon'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_signalization"})
            aScene:setHidsParams({"spruce"}, {active = false})
            aScene:setHidsParams({"balon"}, {inventory = true})
            
        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locwintergarden_1') 
            aScene:setTask("ids_challenge_locwintergarden_1")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("signalization", "balon")
        
        elseif aEvent == "activate_click_signalization" then
            aScene.mDisplay:link_effect("WinterGardenGas", 'effectGas')

        elseif aEvent == "activate_signalization" then
            aScene.mDisplay:unlink_effect('effectGas')
            aScene:setInteractParams("signalization", {active = false})
            aScene:setHidsParams({"spruce"}, {active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocWinterGarden:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'fan_winter_garden', 'heart'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_petals"})
            aScene:setHidsParams({"fan_winter_garden"}, {inventory = true})
            aScene:setHidsParams({"heart"}, {active = false})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locwintergarden_2') 
            aScene:setTask("ids_challenge_locwintergarden_2")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("petals", "fan_winter_garden")
            aScene:addAmbFrameSoundEvent('parrot', 162, 'parrot.voice')

        elseif aEvent == "activate_petals" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
            aScene:detachInteract("petals")
            aScene:setHidsParams({"heart"}, {active = true})

        end
    end)

----------------------------------------------------------------------------------------------------
LocWinterGarden:setSceneHandler(3,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'leopard', 'candle_winter_garden'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({'ho_collected', 'activate_light'})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locwintergarden_3') 
            aScene:setTask("ids_challenge_locwintergarden_3")
            aScene:addAmbFrameSoundEvent('parrot', 162, 'parrot.voice')

            aScene:setHidsParams({'leopard'}, {active = false})
            aScene:setHidsParams({'candle_winter_garden'}, {inventory = true})

            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("light", "candle_winter_garden")

        elseif aEvent == "activate_light" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
            aScene:setInteractParams({'light'}, {active = false})
            aScene:setHidsParams({'leopard'}, {active = true})

        end
    end)

----------------------------------------------------------------------------------------------------
LocWinterGarden:setSceneHandler(4,
    function (aScene, aEvent)
        -- rag_winter_garden -> cage
    
        if aEvent == "capture" then
            aScene:captureObjects({'rag_winter_garden'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({'ho_collected', 'activate_cage'})
            aScene:setHidsParams({"rag_winter_garden"}, {inventory = true})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locwintergarden_4') 
            aScene:setTask("ids_challenge_locwintergarden_4")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("cage", "rag_winter_garden")
            aScene:addAmbFrameSoundEvent('parrot', 162, 'parrot.voice')

        elseif aEvent == "activate_cage" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
            aScene:removeAmbFrameSoundEvent('parrot', 162)

        end
    end)

----------------------------------------------------------------------------------------------------
LocWinterGarden:setSceneHandler(5,
    function(aScene, aEvent)

        -- wintergarden_key active(hook_rope(hook + rope_winter_garden) -> grating)

        if aEvent == "capture" then
            aScene:captureObjects({'hook_rope', 'hook', 'rope_winter_garden', 'wintergarden_key'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({'ho_collected', 'activate_grating'})
            aScene:setHidsParams({'wintergarden_key'}, {active = false, visible = false})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locwintergarden_5') 
            aScene:setTask('ids_challenge_locwintergarden_5')
            aScene:attachHids(aScene:getHidList({except = {'hook_rope'}}))
            aScene:addItemMix('hook_rope', {'hook', 'rope_winter_garden'})

        elseif aEvent == "found_hook_rope" then
            aScene:attachInteract("grating", "hook_rope")

        elseif aEvent == "activate_grating" then
            aScene:setHidsParams({'wintergarden_key'}, {active = true, visible = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)
