-- LocCoffeshop

LocCoffeshop = Location:new("LocCoffeshop")

----------------------------------------------------------------------------------------------------
function LocCoffeshop_UPDATE()
	return 0 --LocSupplyCloset:update()
end

----------------------------------------------------------------------------------------------------
function LocCoffeshop_INIT()
    LocCoffeshop:init()
end

----------------------------------------------------------------------------------------------------
LocCoffeshop:setSceneHandler(1,
    function(aScene, aEvent)
        if aEvent == "capture" then
             aScene:captureObjects({'transmitter'})
        elseif aEvent == "generic_init" then
            aScene:captureObjects({'transmitter'})
            
            aScene:setWinTerms({"ho_collected", "activate_microwave"})

        elseif aEvent == "start" then
            aScene:setTask("ids_challenge_loccoffeshop_1")
            aScene:setRemark('ids_remark_loccoffeshop_1')
            aScene:setHidsParams({"transmitter"}, {inventory = true})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("microwave", "transmitter")

        elseif aEvent == "activate_microwave" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
--[[
        elseif aEvent == "reset" then
            aScene:setExtraParams("darkness", {visible = true, frame = 0})
]]
        end
    end)

----------------------------------------------------------------------------------------------------
LocCoffeshop:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
             aScene:captureObjects({'ring'})
        elseif aEvent == "generic_init" then
            aScene:captureObjects({'ring'})
            
            aScene:setWinTerms({"ho_collected", "activate_door"})

        elseif aEvent == "start" then
			aScene:setRemark('ids_remark_loccoffeshop_2')
            aScene:setTask("ids_challenge_loccoffeshop_2")
            aScene:setHidsParams({"ring"}, {inventory = true})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("door", "ring")

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

        end
    end)

----------------------------------------------------------------------------------------------------
LocCoffeshop:setSceneHandler(3,
    function(aScene, aEvent)
        if aEvent == "capture" then
             aScene:captureObjects({'flour'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_traces"})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loccoffeshop_3')
            aScene:setTask("ids_challenge_loccoffeshop_3")
            aScene:setHidsParams({"flour"}, {inventory = true})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("traces", "flour")

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

        end
    end)

----------------------------------------------------------------------------------------------------
LocCoffeshop:setSceneHandler(4,
    function (aScene, aEvent)
    
        -- fomka -> floor
    
        if aEvent == "capture" then
             aScene:captureObjects({'fomka', 'euro'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_floor"})
            aScene:setHidsParams({"fomka"}, {inventory = true})
            aScene:setHidsParams({"euro"}, {active = false, visible = false})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loccoffeshop_4')
            aScene:setTask("ids_challenge_loccoffeshop_4")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("floor", "fomka")

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

        end
    end)

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

        -- cupofcoffe active,click(sleep -> coffee_cup)

        if aEvent == "capture" then
             aScene:captureObjects({'fomka'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_coffee_cup"})
            aScene:setHidsParams({"sleep"}, {inventory = true})
            aScene:setHidsParams({"cupofcoffe"}, {active = false})

        elseif aEvent == "start" then
        
            aScene:setRemark('ids_remark_loccoffeshop_5')
            aScene:setTask("ids_challenge_loccoffeshop_5")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("coffee_cup", "sleep")

        elseif aEvent == "activate_coffee_cup" then
            aScene:setHidsParams({"cupofcoffe"}, {active = false})
            ho:click('hid_5_cupofcoffe')
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)