-- LocLaundry

LocLaundry = Location:new("LocLaundry")

----------------------------------------------------------------------------------------------------
function LocLaundry_UPDATE()
	return 0
end

----------------------------------------------------------------------------------------------------
function LocLaundry_INIT()
    LocLaundry:init()
end

----------------------------------------------------------------------------------------------------
LocLaundry:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'shirt', 'blackshirt'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({"shirt", "ink"}, {inventory = true})
            
            aScene:setWinTerms({"ho_collected", "activate_washingMashine2"})
            aScene:setHidsParams({"blackshirt"}, {visible = false, active = false, inventory = true})

        elseif aEvent == "start" then

            aScene:setRemark('ids_remark_loclaundry_1')
            aScene:setTask("ids_challenge_loclaundry_1")
            aScene:attachHids(aScene:getHidList({except = {'shirt_with_paint'}}))
            aScene:addItemMix('shirt_with_paint', {'shirt', 'ink'})
            
        elseif aEvent == "found_shirt_with_paint" then
            aScene:attachInteract('washingMashine2', 'shirt_with_paint')

        elseif aEvent == "activate_washingMashine2" then
            
            aScene:onChallengeComplete()
            Inventory:addItem("blackshirt")

            aScene:setHidsParams({"blackshirt"}, {visible = true, active = true, inventory = true})
            ho:click('hid_1_blackshirt')

            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocLaundry:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'key1', 'scissors1'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({"key1"}, {visible = false, active = false})
            aScene:setHidsParams({"scissors1"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_sack"})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loclaundry_2')
            aScene:setTask('ids_challenge_loclaundry_2')
            aScene:attachHids(aScene:getHidList({except = {"parrot"}}))
            aScene:attachInteract("sack", "scissors1")

        elseif aEvent == "activate_sack" then
            aScene:setHidsParams({"key1"}, { visible = true, active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocLaundry:setSceneHandler(3,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'gun', 'candle'})
        elseif aEvent == "generic_init" then
            
            aScene:setHidsParams({"gun"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_clothes"})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loclaundry_3')
            aScene:setTask('ids_challenge_loclaundry_3')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("clothes", "gun")

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

        end
    end)

----------------------------------------------------------------------------------------------------
LocLaundry:setSceneHandler(4,
    function (aScene, aEvent)

        -- bracelet visible,active(weight -> weights)

        if aEvent == "capture" then
            aScene:captureObjects({'weight', 'bracelet', 'fish', 'bag'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_weights"})
            aScene:setHidsParams({"weight"}, {inventory = true})
            aScene:setHidsParams({"bracelet"}, {visible = false, active = false})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loclaundry_4')
            aScene:setTask("ids_challenge_loclaundry_4")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("weights", "weight")

        elseif aEvent == "activate_weights" then
            aScene:setHidsParams({"bracelet"}, {visible = true, active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

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

        -- extra(water) play (-> valve)
        -- soap_loundry -> water

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

        elseif aEvent == "start" then
			aScene:setRemark('ids_remark_loclaundry_5')
            aScene:setTask("ids_challenge_loclaundry_5")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("valve")
            Inventory:addItem('soap_loundry')

        elseif aEvent == "activate_valve" then
            aScene:setExtraParams("water", {play = true})
            aScene:attachInteract("water", "soap_loundry")

        elseif aEvent == "activate_water" then
            aScene:setExtraParams("water", {play = false, frame = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)