-- LocSupplyCloset

--LocCourtyard = Location:new("LocCourtyard", {"LocCourtyardCloseup"})
LocCourtyard = Location:new("LocCourtyard")

----------------------------------------------------------------------------------------------------
function LocCourtyard_UPDATE()
	return 0 --LocCourtyard:update()
end

----------------------------------------------------------------------------------------------------
function LocCourtyard_INIT()
    LocCourtyard:init()
end

----------------------------------------------------------------------------------------------------
LocCourtyard:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
             aScene:captureObjects({'ventel'})
        elseif aEvent == "generic_init" then
            
             
            aScene:setHidsParams({"ventel"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_ventel_place"})

        elseif aEvent == "start" then
            aScene:setTask("ids_challenge_courtyard_1")
            aScene:setRemark('ids_remark_loccourtyard_1')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("ventel_place", "ventel")

        elseif aEvent == "activate_click_ventel_place" then
            aScene:setExtraParams("fountane", {play = true})
            aScene:setExtraParams("water", {play = true, loop = true})

        elseif aEvent == "activate_ventel_place" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocCourtyard:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
             aScene:captureObjects({'glowing_symbol', 'ink'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({'glowing_symbol'}, {visible = false, active = false})
            aScene:setHidsParams({"ink"}, {inventory = true})
            
            aScene:setWinTerms({"ho_collected", "activate_water"})
            

        elseif aEvent == "start" then
            aScene:setTask("ids_challenge_loccourtyard_2")
            aScene:setRemark('ids_remark_loccourtyard_2') 
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract('water', 'ink')

        elseif aEvent == "activate_click_water" then
            aScene:setExtraParams("fountane_inked", {play = true})
            aScene:setExtraParams("inked_water", {play = true, loop = true})

        elseif aEvent == "activate_water" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
            aScene:setHidsParams({'glowing_symbol'}, {visible = true, active = true})
            
            aScene:setExtraParams("fountane", {visible = false})
            aScene:setExtraParams("water", {visible = false})

        end
    end)

----------------------------------------------------------------------------------------------------
LocCourtyard:setSceneHandler(3,
    function(aScene, aEvent)
        -- hammer_court -> fountain_border
        --extra(crack_water)
        --extra(crack_water_appear)
        if aEvent == "capture" then
             --aScene:captureObjects({'part_place'})
        elseif aEvent == "generic_init" then
            
            
            aScene:setHidsParams({"hammer_court"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_fountain_border"})

        elseif aEvent == "start" then
			aScene:setRemark('ids_remark_loccourtyard_3') 
            aScene:setTask("ids_challenge_courtyard_3")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("fountain_border", "hammer_court")

        elseif aEvent == "activate_click_fountain_border" then
            aScene:setExtraParams("crack_water_appear", {play = true})
            aScene:setExtraParams("crack_water", {play = true, loop = true})

        elseif aEvent == "activate_fountain_border" then
            aScene:setExtraParams("crack_water_appear", {play = false, frame = 192})
            aScene:setExtraParams("crack_water", {play = true, loop = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocCourtyard:setSceneHandler(4,
    function (aScene, aEvent)
    
        -- (part -> part_place)

        if aEvent == "capture" then
             aScene:captureObjects({'part_place', 'part'})
        elseif aEvent == "generic_init" then
            
            
            aScene:setHidsParams({"part"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_part_place"})

        elseif aEvent == "start" then
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("part_place", "part")
            aScene:setRemark('ids_remark_loccourtyard_4') 
            aScene:setTask("ids_challenge_courtyard_4")

        elseif aEvent == "activate_part_place" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

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

        -- scissors_courty -> bush

        if aEvent == "generic_init" then
            
            aScene:setHidsParams({"scissors_courty"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_bush"})

        elseif aEvent == "start" then
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("bush", "scissors_courty")
            aScene:setRemark('ids_remark_loccourtyard_5') 
            aScene:setTask("ids_challenge_courtyard_5")

        elseif aEvent == "activate_bush" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)
