-- LocSupplyCloset

LocSupplyCloset = Location:new("LocSupplyCloset")

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

----------------------------------------------------------------------------------------------------
function LocSupplyCloset_INIT()
    LocSupplyCloset:init()
end

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

        elseif aEvent == "start" then
			aScene:setRemark('ids_remark_locsupplycloset_1')
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("electric", "tape")
            aScene:setTask("ids_challenge_locsupplycloset_1")
            aScene:setHidsParams(aScene:getHidList({except = {"tape"}}), {active = false})

        elseif aEvent == "activate_electric" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")
            aScene:setExtraParams("darkness", {play = true})
            aScene:setHidsParams(aScene:getHidList({except = {"tape"}}), {active = true})

        elseif aEvent == "reset" then
            aScene:setExtraParams("darkness", {visible = true, frame = 0})

        end
    end)

----------------------------------------------------------------------------------------------------
LocSupplyCloset:setSceneHandler(2,
    function(aScene, aEvent)
        if aEvent == "capture" then
            aScene:captureObjects({'key_supply', 'magnifier'})
        elseif aEvent == "generic_init" then
            
        
            aScene:setHidsParams({"key_supply"}, {inventory = true})
            aScene:setHidsParams({"magnifier"}, {visible = false, active = false})
            aScene:setWinTerms({"ho_collected", "found_magnifier"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locsupplycloset_2')
            aScene:setExtraParams("darkness", {visible = false})
            aScene:setTask("ids_challenge_locsupplycloset_2")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("desk", "key_supply")       

        elseif aEvent == "activate_desk" then
            aScene:setHidsParams({"magnifier"}, {visible = true, active = true})

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

        end
    end)

----------------------------------------------------------------------------------------------------
LocSupplyCloset:setSceneHandler(3,
    function(aScene, aEvent)

        -- overalls activate (crowbar -> door)

        if aEvent == "capture" then
            aScene:captureObjects({'money_sc', 'can2'})
        elseif aEvent == "generic_init" then
        
            aScene:setHidsParams({"crowbar"}, {inventory = true})
            aScene:setHidsParams({"money_sc"}, {active = false})
            aScene:setWinTerms({"ho_collected", "activate_door"})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locsupplycloset_3')
            aScene:setTask("ids_challenge_locsupplycloset_3")
            aScene:setExtraParams("darkness", {visible = false})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("door", "crowbar")

        elseif aEvent == "activate_door" then
            aScene:onChallengeComplete()
            aScene:setHidsParams({"money_sc"}, {active = true})
            aScene:setTask("ids_collect_ho")

        end
    end)

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

        -- overalls asctive,click(badge -> overalls)

        if aEvent == "capture" then
            aScene:captureObjects({'overalls', 'can1'})
        elseif aEvent == "generic_init" then
        
            aScene:setHidsParams({"badge"}, {inventory = true})
            aScene:setWinTerms({"ho_collected", "activate_overalls"})
            aScene:setHidsParams({"overalls"}, {active = false})

        elseif aEvent == "start" then
            aScene:setRemark('ids_remark_locsupplycloset_4')
            aScene:setTask("ids_challenge_supplycloset_4")
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract("overalls", "badge")
            
        elseif aEvent == "activate_overalls" then
            aScene:setHidsParams({"overalls"}, {active = true})
            ho:click('hid_4_overalls')
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")

        end
    end)

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

        -- pencil_supply -> timetable

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

        elseif aEvent == "start" then
             aScene:setRemark('ids_remark_locsupplycloset_5')
            aScene:setTask("ids_challenge_locsupplycloset_5")
            aScene:setExtraParams("darkness", {visible = false})
            aScene:attachHids(aScene:getHidList())
            aScene:attachInteract ("timetable", "pencil_supply")
            
        elseif aEvent == "activate_timetable" then
            aScene:onChallengeComplete()
            aScene:setTask("ids_collect_ho")        
 
       end
 end)