-- LocNightClub

LocNightClub = Location:new("LocNightClub")

----------------------------------------------------------------------------------------------------
function LocNightClub_UPDATE()
	return 0 --LocNightClub:update()
end

----------------------------------------------------------------------------------------------------
function LocNightClub_INIT()
    LocNightClub:init()
end

local smoke_disabled = false -- ÕÀÊ!! Ìíå ìîæíî. Íî òàê íå íàäî äåëàòü ÍÈ Â ÊÎÅÌ ÑËÓ×ÀÅ!!!11!1

----------------------------------------------------------------------------------------------------
LocNightClub:setSceneHandler(1,
    function(aScene, aEvent)

        if aEvent == "capture" then
            aScene:captureObjects({'pipe_ventel'})

        elseif aEvent == "generic_init" then
            smoke_disabled = false
            aScene:setHidsParams({"pipe_ventel"}, {inventory = true})
            aScene:setHidsParams({"cd"}, {active = false})
            aScene:setWinTerms({"ho_collected", "activate_pipe"})
            
        elseif aEvent == "show" then
            if not smoke_disabled then
                aScene.mDisplay:link_effect('ClubSmoke', 'smoke_locator')
            end

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locnightclub_1')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("pipe", "pipe_ventel")
            aScene:setTask("ids_challenge_locnightclub_1")
            aScene:setExtraParams("ball", {play = true, loop = true})

        elseif aEvent == "activate_click_pipe" then
            smoke_disabled = true
            aScene.mDisplay:stop_linked_effect('smoke_locator')

        elseif aEvent == "activate_pipe" then
            aScene.mDisplay:unlink_effect('smoke_locator')
            aScene:setHidsParams({"cd"}, {active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocNightClub:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'ice', 'key'})
        elseif aEvent == "generic_init" then
            
            aScene:setWinTerms({"ho_collected", "activate_lamp"})
            aScene:setHidsParams({"ice"}, {inventory = true})
            aScene:setHidsParams({"key"}, {visible = false, active = false})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locnightclub_2')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("lamp", "ice")  
            aScene:setTask("ids_challenge_locnightclub_2")
            aScene:setExtraParams("ball", {play = true, loop = true})
            
            
        elseif aEvent == "activate_lamp" then
            aScene:setHidsParams({"key"}, {visible = true, active = true})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
        end
    end)

----------------------------------------------------------------------------------------------------
LocNightClub:setSceneHandler(3,
    function(aScene, aEvent)
    
        -- crowbar_nightclub -> door
    
        if aEvent == "capture" then
            aScene:captureObjects({'spruce', 'balon', 'orientalrug'})
        elseif aEvent == "generic_init" then
            aScene:setWinTerms({"ho_collected", "activate_door"})
            aScene:setHidsParams({"crowbar_nightclub"}, {inventory = true})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locnightclub_3')
            aScene:setTask("ids_challenge_locnightclub_3")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("door", "crowbar_nightclub")
            aScene:setExtraParams("ball", {play = true, loop = true})

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

        end
    end)

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

        -- dice active(nippers01 -> wires)

        if aEvent == "capture" then
            aScene:captureObjects({'spruce', 'balon', 'corpet'})
        elseif aEvent == "generic_init" then
            aScene:setWinTerms({"ho_collected", "activate_wires"})
            aScene:setHidsParams({"nippers01"}, {inventory = true})
            aScene:setHidsParams({"dice"}, {active = false})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locnightclub_4')
            aScene:setTask("ids_challenge_locnightclub_4")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("wires", "nippers01")
            aScene:setExtraParams("ball", {play = true, loop = true})

        elseif aEvent == "activate_click_wires" then
            aScene:setExtraParams("ballAn", {play = true})

        elseif aEvent == "activate_wires" then
            aScene:setHidsParams({"dice"}, {active = true})
            aScene:setExtraParams("ballAn", {frame = 129})
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

----------------------------------------------------------------------------------------------------
LocNightClub:setSceneHandler(5,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'spruce', 'balon'})
        elseif aEvent == "generic_init" then
            aScene:setWinTerms({"ho_collected","activate_gun"})
            aScene:setHidsParams({"twister"}, {inventory = true})
            
        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locnightclub_5')
            aScene:setTask('ids_challenge_locnightclub_5')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("gun", "twister")

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

        end
 end)